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