chrome.bluetoothSocket: clean-up Listen functions
[chromium-blink-merge.git] / content / renderer / render_frame_impl.h
blob2b4fbe0310866e4281422e2b587ac4072fe2104a
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/id_map.h"
14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h"
16 #include "base/process/process_handle.h"
17 #include "content/public/common/javascript_message_type.h"
18 #include "content/public/common/referrer.h"
19 #include "content/public/renderer/render_frame.h"
20 #include "content/renderer/media/webmediaplayer_delegate.h"
21 #include "content/renderer/render_frame_proxy.h"
22 #include "content/renderer/renderer_webcookiejar_impl.h"
23 #include "ipc/ipc_message.h"
24 #include "third_party/WebKit/public/web/WebDataSource.h"
25 #include "third_party/WebKit/public/web/WebFrameClient.h"
26 #include "third_party/WebKit/public/web/WebHistoryCommitType.h"
27 #include "ui/gfx/range/range.h"
29 #if defined(OS_ANDROID)
30 #include "content/renderer/media/android/renderer_media_player_manager.h"
31 #endif
33 class TransportDIB;
34 struct FrameMsg_BuffersSwapped_Params;
35 struct FrameMsg_CompositorFrameSwapped_Params;
36 struct FrameMsg_Navigate_Params;
38 namespace blink {
39 class WebGeolocationClient;
40 class WebInputEvent;
41 class WebMouseEvent;
42 class WebContentDecryptionModule;
43 class WebMIDIClient;
44 class WebMediaPlayer;
45 class WebNotificationPresenter;
46 class WebSecurityOrigin;
47 struct WebCompositionUnderline;
48 struct WebContextMenuData;
49 struct WebCursorInfo;
52 namespace gfx {
53 class Point;
54 class Range;
55 class Rect;
58 namespace content {
60 class ChildFrameCompositingHelper;
61 class GeolocationDispatcher;
62 class MediaStreamRendererFactory;
63 class NotificationProvider;
64 class PepperPluginInstanceImpl;
65 class RendererPpapiHost;
66 class RenderFrameObserver;
67 class RenderViewImpl;
68 class RenderWidget;
69 class RenderWidgetFullscreenPepper;
70 struct CustomContextMenuContext;
72 #if defined(OS_ANDROID)
73 class RendererCdmManager;
74 class RendererMediaPlayerManager;
75 #endif
77 class CONTENT_EXPORT RenderFrameImpl
78 : public RenderFrame,
79 NON_EXPORTED_BASE(public blink::WebFrameClient),
80 NON_EXPORTED_BASE(public WebMediaPlayerDelegate) {
81 public:
82 // Creates a new RenderFrame. |render_view| is the RenderView object that this
83 // frame belongs to.
84 // Callers *must* call |SetWebFrame| immediately after creation.
85 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
86 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
88 // Returns the RenderFrameImpl for the given routing ID.
89 static RenderFrameImpl* FromRoutingID(int routing_id);
91 // Just like RenderFrame::FromWebFrame but returns the implementation.
92 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
94 // Used by content_layouttest_support to hook into the creation of
95 // RenderFrameImpls.
96 static void InstallCreateHook(
97 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32));
99 virtual ~RenderFrameImpl();
101 bool is_swapped_out() const {
102 return is_swapped_out_;
105 // TODO(nasko): This can be removed once we don't have a swapped out state on
106 // RenderFrames. See https://crbug.com/357747.
107 void set_render_frame_proxy(RenderFrameProxy* proxy) {
108 render_frame_proxy_ = proxy;
111 // Out-of-process child frames receive a signal from RenderWidgetCompositor
112 // when a compositor frame has committed.
113 void DidCommitCompositorFrame();
115 // TODO(jam): this is a temporary getter until all the code is transitioned
116 // to using RenderFrame instead of RenderView.
117 RenderViewImpl* render_view() { return render_view_.get(); }
119 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
121 // Returns the RenderWidget associated with this frame.
122 RenderWidget* GetRenderWidget();
124 // This is called right after creation with the WebLocalFrame for this
125 // RenderFrame. It must be called before Initialize.
126 void SetWebFrame(blink::WebLocalFrame* web_frame);
128 // This method must be called after the frame has been added to the frame
129 // tree. It creates all objects that depend on the frame being at its proper
130 // spot.
131 void Initialize();
133 // Notification from RenderView.
134 virtual void OnStop();
136 // Notifications from RenderWidget.
137 void WasHidden();
138 void WasShown();
140 // Start/Stop loading notifications.
141 // TODO(nasko): Those are page-level methods at this time and come from
142 // WebViewClient. We should move them to be WebFrameClient calls and put
143 // logic in the browser side to balance starts/stops.
144 // |to_different_document| will be true unless the load is a fragment
145 // navigation, or triggered by history.pushState/replaceState.
146 virtual void didStartLoading(bool to_different_document);
147 virtual void didStopLoading();
148 virtual void didChangeLoadProgress(double load_progress);
150 #if defined(ENABLE_PLUGINS)
151 // Notification that a PPAPI plugin has been created.
152 void PepperPluginCreated(RendererPpapiHost* host);
154 // Notifies that |instance| has changed the cursor.
155 // This will update the cursor appearance if it is currently over the plugin
156 // instance.
157 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
158 const blink::WebCursorInfo& cursor);
160 // Notifies that |instance| has received a mouse event.
161 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
163 // Informs the render view that a PPAPI plugin has changed text input status.
164 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
165 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
167 // Cancels current composition.
168 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
170 // Informs the render view that a PPAPI plugin has changed selection.
171 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
173 // Creates a fullscreen container for a pepper plugin instance.
174 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
175 PepperPluginInstanceImpl* plugin);
177 bool IsPepperAcceptingCompositionEvents() const;
179 // Notification that the given plugin has crashed.
180 void PluginCrashed(const base::FilePath& plugin_path,
181 base::ProcessId plugin_pid);
183 // Simulates IME events for testing purpose.
184 void SimulateImeSetComposition(
185 const base::string16& text,
186 const std::vector<blink::WebCompositionUnderline>& underlines,
187 int selection_start,
188 int selection_end);
189 void SimulateImeConfirmComposition(const base::string16& text,
190 const gfx::Range& replacement_range);
192 // TODO(jam): remove these once the IPC handler moves from RenderView to
193 // RenderFrame.
194 void OnImeSetComposition(
195 const base::string16& text,
196 const std::vector<blink::WebCompositionUnderline>& underlines,
197 int selection_start,
198 int selection_end);
199 void OnImeConfirmComposition(
200 const base::string16& text,
201 const gfx::Range& replacement_range,
202 bool keep_selection);
203 #endif // ENABLE_PLUGINS
205 // IPC::Sender
206 virtual bool Send(IPC::Message* msg) OVERRIDE;
208 // IPC::Listener
209 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
211 // RenderFrame implementation:
212 virtual RenderView* GetRenderView() OVERRIDE;
213 virtual int GetRoutingID() OVERRIDE;
214 virtual blink::WebFrame* GetWebFrame() OVERRIDE;
215 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
216 virtual int ShowContextMenu(ContextMenuClient* client,
217 const ContextMenuParams& params) OVERRIDE;
218 virtual void CancelContextMenu(int request_id) OVERRIDE;
219 virtual blink::WebNode GetContextMenuNode() const OVERRIDE;
220 virtual blink::WebPlugin* CreatePlugin(
221 blink::WebFrame* frame,
222 const WebPluginInfo& info,
223 const blink::WebPluginParams& params) OVERRIDE;
224 virtual void LoadURLExternally(blink::WebLocalFrame* frame,
225 const blink::WebURLRequest& request,
226 blink::WebNavigationPolicy policy) OVERRIDE;
227 virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE;
228 virtual bool IsHidden() OVERRIDE;
230 // blink::WebFrameClient implementation:
231 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
232 const blink::WebPluginParams& params);
233 virtual blink::WebMediaPlayer* createMediaPlayer(
234 blink::WebLocalFrame* frame,
235 const blink::WebURL& url,
236 blink::WebMediaPlayerClient* client);
237 virtual blink::WebContentDecryptionModule* createContentDecryptionModule(
238 blink::WebLocalFrame* frame,
239 const blink::WebSecurityOrigin& security_origin,
240 const blink::WebString& key_system);
241 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
242 blink::WebLocalFrame* frame,
243 blink::WebApplicationCacheHostClient* client);
244 virtual blink::WebWorkerPermissionClientProxy*
245 createWorkerPermissionClientProxy(blink::WebLocalFrame* frame);
246 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
247 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
248 blink::WebLocalFrame* frame);
249 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
250 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
251 const blink::WebString& name);
252 virtual void didDisownOpener(blink::WebLocalFrame* frame);
253 virtual void frameDetached(blink::WebFrame* frame);
254 virtual void frameFocused();
255 virtual void willClose(blink::WebFrame* frame);
256 virtual void didChangeName(blink::WebLocalFrame* frame,
257 const blink::WebString& name);
258 virtual void didMatchCSS(
259 blink::WebLocalFrame* frame,
260 const blink::WebVector<blink::WebString>& newly_matching_selectors,
261 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
262 virtual bool shouldReportDetailedMessageForSource(
263 const blink::WebString& source);
264 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
265 const blink::WebString& source_name,
266 unsigned source_line,
267 const blink::WebString& stack_trace);
268 virtual void loadURLExternally(blink::WebLocalFrame* frame,
269 const blink::WebURLRequest& request,
270 blink::WebNavigationPolicy policy,
271 const blink::WebString& suggested_name);
272 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
273 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
274 blink::WebLocalFrame* frame,
275 blink::WebDataSource::ExtraData* extra_data,
276 const blink::WebURLRequest& request,
277 blink::WebNavigationType type,
278 blink::WebNavigationPolicy default_policy,
279 bool is_redirect);
280 virtual blink::WebHistoryItem historyItemForNewChildFrame(
281 blink::WebFrame* frame);
282 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
283 const blink::WebFormElement& form);
284 virtual void willSubmitForm(blink::WebLocalFrame* frame,
285 const blink::WebFormElement& form);
286 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
287 blink::WebDataSource* datasource);
288 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame);
289 virtual void didReceiveServerRedirectForProvisionalLoad(
290 blink::WebLocalFrame* frame);
291 virtual void didFailProvisionalLoad(
292 blink::WebLocalFrame* frame,
293 const blink::WebURLError& error);
294 virtual void didCommitProvisionalLoad(
295 blink::WebLocalFrame* frame,
296 const blink::WebHistoryItem& item,
297 blink::WebHistoryCommitType commit_type);
298 virtual void didClearWindowObject(blink::WebLocalFrame* frame);
299 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
300 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
301 const blink::WebString& title,
302 blink::WebTextDirection direction);
303 virtual void didChangeIcon(blink::WebLocalFrame* frame,
304 blink::WebIconURL::Type icon_type);
305 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
306 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
307 virtual void didFailLoad(blink::WebLocalFrame* frame,
308 const blink::WebURLError& error);
309 virtual void didFinishLoad(blink::WebLocalFrame* frame);
310 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
311 const blink::WebHistoryItem& item,
312 blink::WebHistoryCommitType commit_type);
313 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
314 virtual blink::WebNotificationPresenter* notificationPresenter();
315 virtual void didChangeSelection(bool is_empty_selection);
316 virtual blink::WebColorChooser* createColorChooser(
317 blink::WebColorChooserClient* client,
318 const blink::WebColor& initial_color,
319 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
320 virtual void runModalAlertDialog(const blink::WebString& message);
321 virtual bool runModalConfirmDialog(const blink::WebString& message);
322 virtual bool runModalPromptDialog(const blink::WebString& message,
323 const blink::WebString& default_value,
324 blink::WebString* actual_value);
325 virtual bool runModalBeforeUnloadDialog(bool is_reload,
326 const blink::WebString& message);
327 virtual void showContextMenu(const blink::WebContextMenuData& data);
328 virtual void clearContextMenu();
329 virtual void willRequestAfterPreconnect(blink::WebLocalFrame* frame,
330 blink::WebURLRequest& request);
331 virtual void willSendRequest(blink::WebLocalFrame* frame,
332 unsigned identifier,
333 blink::WebURLRequest& request,
334 const blink::WebURLResponse& redirect_response);
335 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
336 unsigned identifier,
337 const blink::WebURLResponse& response);
338 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
339 unsigned identifier);
340 virtual void didLoadResourceFromMemoryCache(
341 blink::WebLocalFrame* frame,
342 const blink::WebURLRequest& request,
343 const blink::WebURLResponse& response);
344 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
345 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
346 const blink::WebSecurityOrigin& origin,
347 const blink::WebURL& target);
348 virtual void didAbortLoading(blink::WebLocalFrame* frame);
349 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
350 v8::Handle<v8::Context> context,
351 int extension_group,
352 int world_id);
353 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
354 v8::Handle<v8::Context> context,
355 int world_id);
356 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
357 virtual void didChangeContentsSize(blink::WebLocalFrame* frame,
358 const blink::WebSize& size);
359 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
360 virtual void willInsertBody(blink::WebLocalFrame* frame);
361 virtual void reportFindInPageMatchCount(int request_id,
362 int count,
363 bool final_update);
364 virtual void reportFindInPageSelection(int request_id,
365 int active_match_ordinal,
366 const blink::WebRect& sel);
367 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
368 blink::WebStorageQuotaType type,
369 unsigned long long requested_size,
370 blink::WebStorageQuotaCallbacks callbacks);
371 virtual void willOpenSocketStream(
372 blink::WebSocketStreamHandle* handle);
373 virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
374 virtual blink::WebGeolocationClient* geolocationClient();
375 virtual void willStartUsingPeerConnectionHandler(
376 blink::WebLocalFrame* frame,
377 blink::WebRTCPeerConnectionHandler* handler);
378 virtual blink::WebUserMediaClient* userMediaClient();
379 virtual blink::WebMIDIClient* webMIDIClient();
380 virtual bool willCheckAndDispatchMessageEvent(
381 blink::WebLocalFrame* source_frame,
382 blink::WebFrame* target_frame,
383 blink::WebSecurityOrigin target_origin,
384 blink::WebDOMMessageEvent event);
385 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
386 const blink::WebURL& url);
387 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
388 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
389 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
390 int arb_robustness_status_code);
391 virtual void forwardInputEvent(const blink::WebInputEvent* event);
392 virtual void initializeChildFrame(const blink::WebRect& frame_rect,
393 float scale_factor);
395 // WebMediaPlayerDelegate implementation:
396 virtual void DidPlay(blink::WebMediaPlayer* player) OVERRIDE;
397 virtual void DidPause(blink::WebMediaPlayer* player) OVERRIDE;
398 virtual void PlayerGone(blink::WebMediaPlayer* player) OVERRIDE;
400 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
401 // this back to private member.
402 void OnNavigate(const FrameMsg_Navigate_Params& params);
404 protected:
405 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
407 private:
408 friend class RenderFrameObserver;
409 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
410 AccessibilityMessagesQueueWhileSwappedOut);
411 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
412 ShouldUpdateSelectionTextFromContextMenuParams);
413 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
414 OnExtendSelectionAndDelete);
415 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
416 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
417 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
418 SetEditableSelectionAndComposition);
420 typedef std::map<GURL, double> HostZoomLevels;
422 // Functions to add and remove observers for this object.
423 void AddObserver(RenderFrameObserver* observer);
424 void RemoveObserver(RenderFrameObserver* observer);
426 void UpdateURL(blink::WebFrame* frame);
428 // Gets the focused element. If no such element exists then the element will
429 // be NULL.
430 blink::WebElement GetFocusedElement();
432 // IPC message handlers ------------------------------------------------------
434 // The documentation for these functions should be in
435 // content/common/*_messages.h for the message that the function is handling.
436 void OnBeforeUnload();
437 void OnSwapOut(int proxy_routing_id);
438 void OnChildFrameProcessGone();
439 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params);
440 void OnCompositorFrameSwapped(const IPC::Message& message);
441 void OnShowContextMenu(const gfx::Point& location);
442 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
443 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
444 unsigned action);
445 void OnUndo();
446 void OnRedo();
447 void OnCut();
448 void OnCopy();
449 void OnPaste();
450 void OnPasteAndMatchStyle();
451 void OnDelete();
452 void OnSelectAll();
453 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
454 void OnUnselect();
455 void OnReplace(const base::string16& text);
456 void OnReplaceMisspelling(const base::string16& text);
457 void OnCSSInsertRequest(const std::string& css);
458 void OnJavaScriptExecuteRequest(const base::string16& javascript,
459 int id,
460 bool notify_result);
461 void OnSetEditableSelectionOffsets(int start, int end);
462 void OnSetCompositionFromExistingText(
463 int start, int end,
464 const std::vector<blink::WebCompositionUnderline>& underlines);
465 void OnExtendSelectionAndDelete(int before, int after);
466 void OnReload(bool ignore_cache);
467 #if defined(OS_MACOSX)
468 void OnCopyToFindPboard();
469 #endif
471 // Virtual since overridden by WebTestProxy for layout tests.
472 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
473 RenderFrame* render_frame,
474 blink::WebFrame* frame,
475 blink::WebDataSource::ExtraData* extraData,
476 const blink::WebURLRequest& request,
477 blink::WebNavigationType type,
478 blink::WebNavigationPolicy default_policy,
479 bool is_redirect);
480 void OpenURL(blink::WebFrame* frame,
481 const GURL& url,
482 const Referrer& referrer,
483 blink::WebNavigationPolicy policy);
485 // Update current main frame's encoding and send it to browser window.
486 // Since we want to let users see the right encoding info from menu
487 // before finishing loading, we call the UpdateEncoding in
488 // a) function:DidCommitLoadForFrame. When this function is called,
489 // that means we have got first data. In here we try to get encoding
490 // of page if it has been specified in http header.
491 // b) function:DidReceiveTitle. When this function is called,
492 // that means we have got specified title. Because in most of webpages,
493 // title tags will follow meta tags. In here we try to get encoding of
494 // page if it has been specified in meta tag.
495 // c) function:DidFinishDocumentLoadForFrame. When this function is
496 // called, that means we have got whole html page. In here we should
497 // finally get right encoding of page.
498 void UpdateEncoding(blink::WebFrame* frame,
499 const std::string& encoding_name);
501 // Dispatches the current state of selection on the webpage to the browser if
502 // it has changed.
503 // TODO(varunjain): delete this method once we figure out how to keep
504 // selection handles in sync with the webpage.
505 void SyncSelectionIfRequired();
507 // Returns whether |params.selection_text| should be synchronized to the
508 // browser before bringing up the context menu. Static for testing.
509 static bool ShouldUpdateSelectionTextFromContextMenuParams(
510 const base::string16& selection_text,
511 size_t selection_text_offset,
512 const gfx::Range& selection_range,
513 const ContextMenuParams& params);
515 bool RunJavaScriptMessage(JavaScriptMessageType type,
516 const base::string16& message,
517 const base::string16& default_value,
518 const GURL& frame_url,
519 base::string16* result);
521 // Loads the appropriate error page for the specified failure into the frame.
522 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
523 const blink::WebURLError& error,
524 bool replace);
526 // Initializes |web_user_media_client_|, returning true if successful. Returns
527 // false if it wasn't possible to create a MediaStreamClient (e.g., WebRTC is
528 // disabled) in which case |web_user_media_client_| is NULL.
529 bool InitializeUserMediaClient();
531 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
532 const blink::WebURL& url,
533 blink::WebMediaPlayerClient* client);
535 // Creates a factory object used for creating audio and video renderers.
536 // The method is virtual so that layouttests can override it.
537 virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
539 #if defined(OS_ANDROID)
540 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
541 const blink::WebURL& url,
542 blink::WebMediaPlayerClient* client);
544 RendererMediaPlayerManager* GetMediaPlayerManager();
545 RendererCdmManager* GetCdmManager();
546 #endif
548 // Stores the WebLocalFrame we are associated with.
549 blink::WebLocalFrame* frame_;
551 base::WeakPtr<RenderViewImpl> render_view_;
552 int routing_id_;
553 bool is_swapped_out_;
554 // RenderFrameProxy exists only when is_swapped_out_ is true.
555 // TODO(nasko): This can be removed once we don't have a swapped out state on
556 // RenderFrame. See https://crbug.com/357747.
557 RenderFrameProxy* render_frame_proxy_;
558 bool is_detaching_;
560 #if defined(ENABLE_PLUGINS)
561 // Current text input composition text. Empty if no composition is in
562 // progress.
563 base::string16 pepper_composition_text_;
564 #endif
566 RendererWebCookieJarImpl cookie_jar_;
568 // All the registered observers.
569 ObserverList<RenderFrameObserver> observers_;
571 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
573 // The node that the context menu was pressed over.
574 blink::WebNode context_menu_node_;
576 // External context menu requests we're waiting for. "Internal"
577 // (WebKit-originated) context menu events will have an ID of 0 and will not
578 // be in this map.
580 // We don't want to add internal ones since some of the "special" page
581 // handlers in the browser process just ignore the context menu requests so
582 // avoid showing context menus, and so this will cause right clicks to leak
583 // entries in this map. Most users of the custom context menu (e.g. Pepper
584 // plugins) are normally only on "regular" pages and the regular pages will
585 // always respond properly to the request, so we don't have to worry so
586 // much about leaks.
587 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
589 // The text selection the last time DidChangeSelection got called. May contain
590 // additional characters before and after the selected text, for IMEs. The
591 // portion of this string that is the actual selected text starts at index
592 // |selection_range_.GetMin() - selection_text_offset_| and has length
593 // |selection_range_.length()|.
594 base::string16 selection_text_;
595 // The offset corresponding to the start of |selection_text_| in the document.
596 size_t selection_text_offset_;
597 // Range over the document corresponding to the actual selected text (which
598 // could correspond to a substring of |selection_text_|; see above).
599 gfx::Range selection_range_;
600 // Used to inform didChangeSelection() when it is called in the context
601 // of handling a InputMsg_SelectRange IPC.
602 bool handling_select_range_;
604 // The next group of objects all implement RenderFrameObserver, so are deleted
605 // along with the RenderFrame automatically. This is why we just store weak
606 // references.
608 // Holds a reference to the service which provides desktop notifications.
609 NotificationProvider* notification_provider_;
611 blink::WebUserMediaClient* web_user_media_client_;
613 #if defined(OS_ANDROID)
614 // These manage all media players and CDMs in this render frame for
615 // communicating with the real media player and CDM objects in the browser
616 // process. It's okay to use raw pointers since they are RenderFrameObservers.
617 RendererMediaPlayerManager* media_player_manager_;
618 RendererCdmManager* cdm_manager_;
619 #endif
621 // The geolocation dispatcher attached to this view, lazily initialized.
622 GeolocationDispatcher* geolocation_dispatcher_;
624 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
626 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
629 } // namespace content
631 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_