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_
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/common/accessibility_mode_enums.h"
18 #include "content/common/mojo/service_registry_impl.h"
19 #include "content/public/common/javascript_message_type.h"
20 #include "content/public/common/referrer.h"
21 #include "content/public/renderer/render_frame.h"
22 #include "content/renderer/media/webmediaplayer_delegate.h"
23 #include "content/renderer/render_frame_proxy.h"
24 #include "content/renderer/renderer_webcookiejar_impl.h"
25 #include "ipc/ipc_message.h"
26 #include "third_party/WebKit/public/web/WebAXObject.h"
27 #include "third_party/WebKit/public/web/WebDataSource.h"
28 #include "third_party/WebKit/public/web/WebFrameClient.h"
29 #include "third_party/WebKit/public/web/WebHistoryCommitType.h"
30 #include "ui/gfx/range/range.h"
32 #if defined(OS_ANDROID)
33 #include "content/renderer/media/android/renderer_media_player_manager.h"
37 struct FrameMsg_Navigate_Params;
40 class WebGeolocationClient;
43 class WebContentDecryptionModule;
45 class WebNotificationPresenter;
47 class WebSecurityOrigin;
48 struct WebCompositionUnderline;
49 struct WebContextMenuData;
59 #if defined(OS_TIZEN) && defined(ENABLE_MURPHY)
61 class RendererMediaPlayerManager;
67 class ChildFrameCompositingHelper;
68 class GeolocationDispatcher;
69 class MediaStreamDispatcher;
70 class MediaStreamImpl;
71 class MediaStreamRendererFactory;
73 class NotificationPermissionDispatcher;
74 class NotificationProvider;
75 class PepperPluginInstanceImpl;
76 class PushMessagingDispatcher;
77 class RendererAccessibility;
78 class RendererCdmManager;
79 class RendererMediaPlayerManager;
80 class RendererPpapiHost;
81 class RenderFrameObserver;
84 class RenderWidgetFullscreenPepper;
85 class ScreenOrientationDispatcher;
86 struct CustomContextMenuContext;
88 class CONTENT_EXPORT RenderFrameImpl
90 NON_EXPORTED_BASE(public blink::WebFrameClient),
91 NON_EXPORTED_BASE(public WebMediaPlayerDelegate) {
93 // Creates a new RenderFrame. |render_view| is the RenderView object that this
95 // Callers *must* call |SetWebFrame| immediately after creation.
96 // Note: This is called only when RenderFrame is created by Blink through
98 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
99 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
101 // Creates a new RenderFrame with |routing_id| as a child of the RenderFrame
102 // identified by |parent_routing_id| or as the top-level frame if the latter
103 // is MSG_ROUTING_NONE. It creates the Blink WebLocalFrame and inserts it in
104 // the proper place in the frame tree.
105 // Note: This is called only when RenderFrame is being created in response to
106 // IPC message from the browser process. All other frame creation is driven
107 // through Blink and Create.
108 static void CreateFrame(int routing_id, int parent_routing_id);
110 // Returns the RenderFrameImpl for the given routing ID.
111 static RenderFrameImpl* FromRoutingID(int routing_id);
113 // Just like RenderFrame::FromWebFrame but returns the implementation.
114 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
116 // Used by content_layouttest_support to hook into the creation of
118 static void InstallCreateHook(
119 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32));
121 virtual ~RenderFrameImpl();
123 bool is_swapped_out() const {
124 return is_swapped_out_;
127 // TODO(nasko): This can be removed once we don't have a swapped out state on
128 // RenderFrames. See https://crbug.com/357747.
129 void set_render_frame_proxy(RenderFrameProxy* proxy) {
130 render_frame_proxy_ = proxy;
133 // Out-of-process child frames receive a signal from RenderWidgetCompositor
134 // when a compositor frame has committed.
135 void DidCommitCompositorFrame();
137 // TODO(jam): this is a temporary getter until all the code is transitioned
138 // to using RenderFrame instead of RenderView.
139 RenderViewImpl* render_view() { return render_view_.get(); }
141 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
143 // Returns the RenderWidget associated with this frame.
144 RenderWidget* GetRenderWidget();
146 // This is called right after creation with the WebLocalFrame for this
147 // RenderFrame. It must be called before Initialize.
148 void SetWebFrame(blink::WebLocalFrame* web_frame);
150 // This method must be called after the frame has been added to the frame
151 // tree. It creates all objects that depend on the frame being at its proper
155 // Notification from RenderView.
156 virtual void OnStop();
158 // Notifications from RenderWidget.
162 // Start/Stop loading notifications.
163 // TODO(nasko): Those are page-level methods at this time and come from
164 // WebViewClient. We should move them to be WebFrameClient calls and put
165 // logic in the browser side to balance starts/stops.
166 // |to_different_document| will be true unless the load is a fragment
167 // navigation, or triggered by history.pushState/replaceState.
168 virtual void didStartLoading(bool to_different_document);
169 virtual void didStopLoading();
170 virtual void didChangeLoadProgress(double load_progress);
172 AccessibilityMode accessibility_mode() {
173 return accessibility_mode_;
176 RendererAccessibility* renderer_accessibility() {
177 return renderer_accessibility_;
180 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
181 blink::WebAXEvent event);
183 // TODO(dmazzoni): the only reason this is here is to plumb it through to
184 // RendererAccessibility. It should be part of RenderFrameObserver, once
185 // blink has a separate accessibility tree per frame.
186 void FocusedNodeChanged(const blink::WebNode& node);
188 #if defined(ENABLE_PLUGINS)
189 // Notification that a PPAPI plugin has been created.
190 void PepperPluginCreated(RendererPpapiHost* host);
192 // Notifies that |instance| has changed the cursor.
193 // This will update the cursor appearance if it is currently over the plugin
195 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
196 const blink::WebCursorInfo& cursor);
198 // Notifies that |instance| has received a mouse event.
199 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
201 // Informs the render view that a PPAPI plugin has changed text input status.
202 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
203 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
205 // Cancels current composition.
206 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
208 // Informs the render view that a PPAPI plugin has changed selection.
209 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
211 // Creates a fullscreen container for a pepper plugin instance.
212 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
213 PepperPluginInstanceImpl* plugin);
215 bool IsPepperAcceptingCompositionEvents() const;
217 // Notification that the given plugin has crashed.
218 void PluginCrashed(const base::FilePath& plugin_path,
219 base::ProcessId plugin_pid);
221 // Simulates IME events for testing purpose.
222 void SimulateImeSetComposition(
223 const base::string16& text,
224 const std::vector<blink::WebCompositionUnderline>& underlines,
227 void SimulateImeConfirmComposition(const base::string16& text,
228 const gfx::Range& replacement_range);
230 // TODO(jam): remove these once the IPC handler moves from RenderView to
232 void OnImeSetComposition(
233 const base::string16& text,
234 const std::vector<blink::WebCompositionUnderline>& underlines,
237 void OnImeConfirmComposition(
238 const base::string16& text,
239 const gfx::Range& replacement_range,
240 bool keep_selection);
241 #endif // ENABLE_PLUGINS
243 // May return NULL in some cases, especially if userMediaClient() returns
245 MediaStreamDispatcher* GetMediaStreamDispatcher();
248 virtual bool Send(IPC::Message* msg) OVERRIDE;
251 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
253 // RenderFrame implementation:
254 virtual RenderView* GetRenderView() OVERRIDE;
255 virtual int GetRoutingID() OVERRIDE;
256 virtual blink::WebFrame* GetWebFrame() OVERRIDE;
257 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
258 virtual int ShowContextMenu(ContextMenuClient* client,
259 const ContextMenuParams& params) OVERRIDE;
260 virtual void CancelContextMenu(int request_id) OVERRIDE;
261 virtual blink::WebNode GetContextMenuNode() const OVERRIDE;
262 virtual blink::WebPlugin* CreatePlugin(
263 blink::WebFrame* frame,
264 const WebPluginInfo& info,
265 const blink::WebPluginParams& params) OVERRIDE;
266 virtual void LoadURLExternally(blink::WebLocalFrame* frame,
267 const blink::WebURLRequest& request,
268 blink::WebNavigationPolicy policy) OVERRIDE;
269 virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE;
270 virtual bool IsHidden() OVERRIDE;
271 virtual ServiceRegistry* GetServiceRegistry() OVERRIDE;
272 virtual bool IsFTPDirectoryListing() OVERRIDE;
274 // blink::WebFrameClient implementation:
275 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
276 const blink::WebPluginParams& params);
277 virtual blink::WebMediaPlayer* createMediaPlayer(
278 blink::WebLocalFrame* frame,
279 const blink::WebURL& url,
280 blink::WebMediaPlayerClient* client);
281 virtual blink::WebContentDecryptionModule* createContentDecryptionModule(
282 blink::WebLocalFrame* frame,
283 const blink::WebSecurityOrigin& security_origin,
284 const blink::WebString& key_system);
285 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
286 blink::WebLocalFrame* frame,
287 blink::WebApplicationCacheHostClient* client);
288 virtual blink::WebWorkerPermissionClientProxy*
289 createWorkerPermissionClientProxy(blink::WebLocalFrame* frame);
290 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
291 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
292 blink::WebLocalFrame* frame);
293 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
294 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
295 const blink::WebString& name);
296 virtual void didDisownOpener(blink::WebLocalFrame* frame);
297 virtual void frameDetached(blink::WebFrame* frame);
298 virtual void frameFocused();
299 virtual void willClose(blink::WebFrame* frame);
300 virtual void didChangeName(blink::WebLocalFrame* frame,
301 const blink::WebString& name);
302 virtual void didMatchCSS(
303 blink::WebLocalFrame* frame,
304 const blink::WebVector<blink::WebString>& newly_matching_selectors,
305 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
306 virtual bool shouldReportDetailedMessageForSource(
307 const blink::WebString& source);
308 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
309 const blink::WebString& source_name,
310 unsigned source_line,
311 const blink::WebString& stack_trace);
312 virtual void loadURLExternally(blink::WebLocalFrame* frame,
313 const blink::WebURLRequest& request,
314 blink::WebNavigationPolicy policy,
315 const blink::WebString& suggested_name);
316 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
317 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
318 const NavigationPolicyInfo& info);
319 virtual blink::WebHistoryItem historyItemForNewChildFrame(
320 blink::WebFrame* frame);
321 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
322 const blink::WebFormElement& form);
323 virtual void willSubmitForm(blink::WebLocalFrame* frame,
324 const blink::WebFormElement& form);
325 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
326 blink::WebDataSource* datasource);
327 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame,
328 bool is_transition_navigation);
329 virtual void didReceiveServerRedirectForProvisionalLoad(
330 blink::WebLocalFrame* frame);
331 virtual void didFailProvisionalLoad(
332 blink::WebLocalFrame* frame,
333 const blink::WebURLError& error);
334 virtual void didCommitProvisionalLoad(
335 blink::WebLocalFrame* frame,
336 const blink::WebHistoryItem& item,
337 blink::WebHistoryCommitType commit_type);
338 virtual void didClearWindowObject(blink::WebLocalFrame* frame);
339 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
340 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
341 const blink::WebString& title,
342 blink::WebTextDirection direction);
343 virtual void didChangeIcon(blink::WebLocalFrame* frame,
344 blink::WebIconURL::Type icon_type);
345 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
346 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
347 virtual void didFailLoad(blink::WebLocalFrame* frame,
348 const blink::WebURLError& error);
349 virtual void didFinishLoad(blink::WebLocalFrame* frame);
350 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
351 const blink::WebHistoryItem& item,
352 blink::WebHistoryCommitType commit_type);
353 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
354 virtual void addNavigationTransitionData(
355 const blink::WebString& allowedDestinationOrigin,
356 const blink::WebString& selector,
357 const blink::WebString& markup);
358 virtual void didChangeThemeColor();
359 virtual void requestNotificationPermission(
360 const blink::WebSecurityOrigin& origin,
361 blink::WebNotificationPermissionCallback* callback);
362 virtual blink::WebNotificationPresenter* notificationPresenter();
363 virtual void didChangeSelection(bool is_empty_selection);
364 virtual blink::WebColorChooser* createColorChooser(
365 blink::WebColorChooserClient* client,
366 const blink::WebColor& initial_color,
367 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
368 virtual void runModalAlertDialog(const blink::WebString& message);
369 virtual bool runModalConfirmDialog(const blink::WebString& message);
370 virtual bool runModalPromptDialog(const blink::WebString& message,
371 const blink::WebString& default_value,
372 blink::WebString* actual_value);
373 virtual bool runModalBeforeUnloadDialog(bool is_reload,
374 const blink::WebString& message);
375 virtual void showContextMenu(const blink::WebContextMenuData& data);
376 virtual void clearContextMenu();
377 virtual void willSendRequest(blink::WebLocalFrame* frame,
379 blink::WebURLRequest& request,
380 const blink::WebURLResponse& redirect_response);
381 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
383 const blink::WebURLResponse& response);
384 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
385 unsigned identifier);
386 virtual void didLoadResourceFromMemoryCache(
387 blink::WebLocalFrame* frame,
388 const blink::WebURLRequest& request,
389 const blink::WebURLResponse& response);
390 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
391 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
392 const blink::WebSecurityOrigin& origin,
393 const blink::WebURL& target);
394 virtual void didAbortLoading(blink::WebLocalFrame* frame);
395 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
396 v8::Handle<v8::Context> context,
399 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
400 v8::Handle<v8::Context> context,
402 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
403 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
404 virtual void willInsertBody(blink::WebLocalFrame* frame);
405 virtual void reportFindInPageMatchCount(int request_id,
408 virtual void reportFindInPageSelection(int request_id,
409 int active_match_ordinal,
410 const blink::WebRect& sel);
411 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
412 blink::WebStorageQuotaType type,
413 unsigned long long requested_size,
414 blink::WebStorageQuotaCallbacks callbacks);
415 virtual void willOpenSocketStream(
416 blink::WebSocketStreamHandle* handle);
417 virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
418 virtual blink::WebGeolocationClient* geolocationClient();
419 virtual blink::WebPushClient* pushClient();
420 virtual void willStartUsingPeerConnectionHandler(
421 blink::WebLocalFrame* frame,
422 blink::WebRTCPeerConnectionHandler* handler);
423 virtual blink::WebUserMediaClient* userMediaClient();
424 virtual blink::WebMIDIClient* webMIDIClient();
425 virtual bool willCheckAndDispatchMessageEvent(
426 blink::WebLocalFrame* source_frame,
427 blink::WebFrame* target_frame,
428 blink::WebSecurityOrigin target_origin,
429 blink::WebDOMMessageEvent event);
430 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
431 const blink::WebURL& url);
432 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
433 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
434 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
435 int arb_robustness_status_code);
436 virtual void forwardInputEvent(const blink::WebInputEvent* event);
437 virtual void initializeChildFrame(const blink::WebRect& frame_rect,
439 virtual blink::WebScreenOrientationClient* webScreenOrientationClient();
441 // WebMediaPlayerDelegate implementation:
442 virtual void DidPlay(blink::WebMediaPlayer* player) OVERRIDE;
443 virtual void DidPause(blink::WebMediaPlayer* player) OVERRIDE;
444 virtual void PlayerGone(blink::WebMediaPlayer* player) OVERRIDE;
446 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
447 // this back to private member.
448 void OnNavigate(const FrameMsg_Navigate_Params& params);
450 // Binds this render frame's service registry to a handle to the remote
452 void BindServiceRegistry(
453 mojo::ScopedMessagePipeHandle service_provider_handle);
456 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
459 friend class RenderFrameObserver;
460 friend class RendererAccessibilityTest;
461 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
462 AccessibilityMessagesQueueWhileSwappedOut);
463 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
464 ShouldUpdateSelectionTextFromContextMenuParams);
465 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
466 OnExtendSelectionAndDelete);
467 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
468 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
469 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
470 SetEditableSelectionAndComposition);
471 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
472 OnSetAccessibilityMode);
474 typedef std::map<GURL, double> HostZoomLevels;
476 // Functions to add and remove observers for this object.
477 void AddObserver(RenderFrameObserver* observer);
478 void RemoveObserver(RenderFrameObserver* observer);
480 // Builds and sends DidCommitProvisionalLoad to the host.
481 void SendDidCommitProvisionalLoad(blink::WebFrame* frame);
483 // Gets the focused element. If no such element exists then the element will
485 blink::WebElement GetFocusedElement();
487 // IPC message handlers ------------------------------------------------------
489 // The documentation for these functions should be in
490 // content/common/*_messages.h for the message that the function is handling.
491 void OnBeforeUnload();
492 void OnSwapOut(int proxy_routing_id);
493 void OnShowContextMenu(const gfx::Point& location);
494 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
495 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
502 void OnPasteAndMatchStyle();
505 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
507 void OnReplace(const base::string16& text);
508 void OnReplaceMisspelling(const base::string16& text);
509 void OnCSSInsertRequest(const std::string& css);
510 void OnJavaScriptExecuteRequest(const base::string16& javascript,
513 void OnSetEditableSelectionOffsets(int start, int end);
514 void OnSetCompositionFromExistingText(
516 const std::vector<blink::WebCompositionUnderline>& underlines);
517 void OnExtendSelectionAndDelete(int before, int after);
518 void OnReload(bool ignore_cache);
519 void OnTextSurroundingSelectionRequest(size_t max_length);
520 void OnAddStyleSheetByURL(const std::string& url);
521 void OnSetupTransitionView(const std::string& markup);
522 void OnBeginExitTransition(const std::string& css_selector);
523 void OnSetAccessibilityMode(AccessibilityMode new_mode);
524 #if defined(OS_MACOSX)
525 void OnCopyToFindPboard();
528 // Virtual since overridden by WebTestProxy for layout tests.
529 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
530 RenderFrame* render_frame,
531 const NavigationPolicyInfo& info);
532 void OpenURL(blink::WebFrame* frame,
534 const Referrer& referrer,
535 blink::WebNavigationPolicy policy);
537 // Update current main frame's encoding and send it to browser window.
538 // Since we want to let users see the right encoding info from menu
539 // before finishing loading, we call the UpdateEncoding in
540 // a) function:DidCommitLoadForFrame. When this function is called,
541 // that means we have got first data. In here we try to get encoding
542 // of page if it has been specified in http header.
543 // b) function:DidReceiveTitle. When this function is called,
544 // that means we have got specified title. Because in most of webpages,
545 // title tags will follow meta tags. In here we try to get encoding of
546 // page if it has been specified in meta tag.
547 // c) function:DidFinishDocumentLoadForFrame. When this function is
548 // called, that means we have got whole html page. In here we should
549 // finally get right encoding of page.
550 void UpdateEncoding(blink::WebFrame* frame,
551 const std::string& encoding_name);
553 // Dispatches the current state of selection on the webpage to the browser if
555 // TODO(varunjain): delete this method once we figure out how to keep
556 // selection handles in sync with the webpage.
557 void SyncSelectionIfRequired();
559 // Returns whether |params.selection_text| should be synchronized to the
560 // browser before bringing up the context menu. Static for testing.
561 static bool ShouldUpdateSelectionTextFromContextMenuParams(
562 const base::string16& selection_text,
563 size_t selection_text_offset,
564 const gfx::Range& selection_range,
565 const ContextMenuParams& params);
567 bool RunJavaScriptMessage(JavaScriptMessageType type,
568 const base::string16& message,
569 const base::string16& default_value,
570 const GURL& frame_url,
571 base::string16* result);
573 // Loads the appropriate error page for the specified failure into the frame.
574 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
575 const blink::WebURLError& error,
578 // Initializes |web_user_media_client_|. If this fails, because it wasn't
579 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
580 // |web_user_media_client_| will remain NULL.
581 void InitializeUserMediaClient();
583 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
584 const blink::WebURL& url,
585 blink::WebMediaPlayerClient* client);
587 // Creates a factory object used for creating audio and video renderers.
588 // The method is virtual so that layouttests can override it.
589 virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
591 // Returns the URL being loaded by the |frame_|'s request.
592 GURL GetLoadingUrl() const;
594 #if defined(OS_ANDROID)
595 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
596 const blink::WebURL& url,
597 blink::WebMediaPlayerClient* client);
599 RendererMediaPlayerManager* GetMediaPlayerManager();
600 #elif defined(OS_TIZEN) && defined(ENABLE_MURPHY)
601 tizen::RendererMediaPlayerManager* GetTizenMediaPlayerManager();
604 #if defined(ENABLE_BROWSER_CDMS)
605 RendererCdmManager* GetCdmManager();
608 // Stores the WebLocalFrame we are associated with.
609 blink::WebLocalFrame* frame_;
611 base::WeakPtr<RenderViewImpl> render_view_;
613 bool is_swapped_out_;
614 // RenderFrameProxy exists only when is_swapped_out_ is true.
615 // TODO(nasko): This can be removed once we don't have a swapped out state on
616 // RenderFrame. See https://crbug.com/357747.
617 RenderFrameProxy* render_frame_proxy_;
620 #if defined(ENABLE_PLUGINS)
621 // Current text input composition text. Empty if no composition is in
623 base::string16 pepper_composition_text_;
626 RendererWebCookieJarImpl cookie_jar_;
628 // All the registered observers.
629 ObserverList<RenderFrameObserver> observers_;
631 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
633 // The node that the context menu was pressed over.
634 blink::WebNode context_menu_node_;
636 // External context menu requests we're waiting for. "Internal"
637 // (WebKit-originated) context menu events will have an ID of 0 and will not
640 // We don't want to add internal ones since some of the "special" page
641 // handlers in the browser process just ignore the context menu requests so
642 // avoid showing context menus, and so this will cause right clicks to leak
643 // entries in this map. Most users of the custom context menu (e.g. Pepper
644 // plugins) are normally only on "regular" pages and the regular pages will
645 // always respond properly to the request, so we don't have to worry so
647 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
649 // The text selection the last time DidChangeSelection got called. May contain
650 // additional characters before and after the selected text, for IMEs. The
651 // portion of this string that is the actual selected text starts at index
652 // |selection_range_.GetMin() - selection_text_offset_| and has length
653 // |selection_range_.length()|.
654 base::string16 selection_text_;
655 // The offset corresponding to the start of |selection_text_| in the document.
656 size_t selection_text_offset_;
657 // Range over the document corresponding to the actual selected text (which
658 // could correspond to a substring of |selection_text_|; see above).
659 gfx::Range selection_range_;
660 // Used to inform didChangeSelection() when it is called in the context
661 // of handling a InputMsg_SelectRange IPC.
662 bool handling_select_range_;
664 // The next group of objects all implement RenderFrameObserver, so are deleted
665 // along with the RenderFrame automatically. This is why we just store weak
668 // Dispatches permission requests for Web Notifications.
669 NotificationPermissionDispatcher* notification_permission_dispatcher_;
671 // Holds a reference to the service which provides desktop notifications.
672 // TODO(peter) Remove this once Web Notifications are routed through Platform.
673 NotificationProvider* notification_provider_;
675 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
676 MediaStreamImpl* web_user_media_client_;
678 // MidiClient attached to this frame; lazily initialized.
679 MidiDispatcher* midi_dispatcher_;
681 #if defined(OS_ANDROID)
682 // Manages all media players in this render frame for communicating with the
683 // real media player in the browser process. It's okay to use a raw pointer
684 // since it's a RenderFrameObserver.
685 RendererMediaPlayerManager* media_player_manager_;
686 #elif defined(OS_TIZEN) && defined(ENABLE_MURPHY)
687 tizen::RendererMediaPlayerManager* media_player_manager_;
690 #if defined(ENABLE_BROWSER_CDMS)
691 // Manage all CDMs in this render frame for communicating with the real CDM in
692 // the browser process. It's okay to use a raw pointer since it's a
693 // RenderFrameObserver.
694 RendererCdmManager* cdm_manager_;
697 #if defined(VIDEO_HOLE)
698 // Whether or not this RenderFrameImpl contains a media player. Used to
699 // register as an observer for video-hole-specific events.
700 bool contains_media_player_;
703 // The geolocation dispatcher attached to this frame, lazily initialized.
704 GeolocationDispatcher* geolocation_dispatcher_;
706 // The push messaging dispatcher attached to this frame, lazily initialized.
707 PushMessagingDispatcher* push_messaging_dispatcher_;
709 ServiceRegistryImpl service_registry_;
711 // The screen orientation dispatcher attached to the frame, lazily
713 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
715 // The current accessibility mode.
716 AccessibilityMode accessibility_mode_;
718 // Only valid if |accessibility_mode_| is anything other than
719 // AccessibilityModeOff.
720 RendererAccessibility* renderer_accessibility_;
722 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
724 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
727 } // namespace content
729 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_