web_contents_impl.h revision e5d81f57cb97b3b6b7fccc9c5610d21eb81db09d
1// Copyright (c) 2012 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_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6#define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 7 8#include <map> 9#include <set> 10#include <string> 11 12#include "base/compiler_specific.h" 13#include "base/gtest_prod_util.h" 14#include "base/memory/scoped_ptr.h" 15#include "base/observer_list.h" 16#include "base/process/process.h" 17#include "base/values.h" 18#include "content/browser/frame_host/frame_tree.h" 19#include "content/browser/frame_host/navigation_controller_delegate.h" 20#include "content/browser/frame_host/navigation_controller_impl.h" 21#include "content/browser/frame_host/navigator_delegate.h" 22#include "content/browser/frame_host/render_frame_host_delegate.h" 23#include "content/browser/frame_host/render_frame_host_manager.h" 24#include "content/browser/renderer_host/render_view_host_delegate.h" 25#include "content/browser/renderer_host/render_widget_host_delegate.h" 26#include "content/common/content_export.h" 27#include "content/public/browser/ax_event_notification_details.h" 28#include "content/public/browser/notification_observer.h" 29#include "content/public/browser/notification_registrar.h" 30#include "content/public/browser/web_contents.h" 31#include "content/public/common/page_transition_types.h" 32#include "content/public/common/renderer_preferences.h" 33#include "content/public/common/three_d_api_types.h" 34#include "net/base/load_states.h" 35#include "third_party/WebKit/public/web/WebDragOperation.h" 36#include "ui/gfx/rect_f.h" 37#include "ui/gfx/size.h" 38#include "webkit/common/resource_type.h" 39 40struct BrowserPluginHostMsg_ResizeGuest_Params; 41struct ViewHostMsg_DateTimeDialogValue_Params; 42struct ViewMsg_PostMessage_Params; 43 44namespace content { 45class BrowserPluginEmbedder; 46class BrowserPluginGuest; 47class BrowserPluginGuestManager; 48class ColorChooser; 49class DateTimeChooserAndroid; 50class DownloadItem; 51class InterstitialPageImpl; 52class JavaBridgeDispatcherHostManager; 53class JavaScriptDialogManager; 54class PowerSaveBlocker; 55class RenderViewHost; 56class RenderViewHostDelegateView; 57class RenderViewHostImpl; 58class RenderWidgetHostImpl; 59class RenderWidgetHostViewPort; 60class SavePackage; 61class SessionStorageNamespaceImpl; 62class SiteInstance; 63class TestWebContents; 64class WebContentsDelegate; 65class WebContentsImpl; 66class WebContentsObserver; 67class WebContentsViewPort; 68class WebContentsViewDelegate; 69struct AXEventNotificationDetails; 70struct ColorSuggestion; 71struct FaviconURL; 72struct LoadNotificationDetails; 73struct ResourceRedirectDetails; 74struct ResourceRequestDetails; 75 76// Factory function for the implementations that content knows about. Takes 77// ownership of |delegate|. 78WebContentsViewPort* CreateWebContentsView( 79 WebContentsImpl* web_contents, 80 WebContentsViewDelegate* delegate, 81 RenderViewHostDelegateView** render_view_host_delegate_view); 82 83class CONTENT_EXPORT WebContentsImpl 84 : public NON_EXPORTED_BASE(WebContents), 85 public NON_EXPORTED_BASE(RenderFrameHostDelegate), 86 public RenderViewHostDelegate, 87 public RenderWidgetHostDelegate, 88 public RenderFrameHostManager::Delegate, 89 public NotificationObserver, 90 public NON_EXPORTED_BASE(NavigationControllerDelegate), 91 public NON_EXPORTED_BASE(NavigatorDelegate) { 92 public: 93 virtual ~WebContentsImpl(); 94 95 static WebContentsImpl* CreateWithOpener( 96 const WebContents::CreateParams& params, 97 WebContentsImpl* opener); 98 99 // Returns the opener WebContentsImpl, if any. This can be set to null if the 100 // opener is closed or the page clears its window.opener. 101 WebContentsImpl* opener() const { return opener_; } 102 103 // Creates a WebContents to be used as a browser plugin guest. 104 static BrowserPluginGuest* CreateGuest( 105 BrowserContext* browser_context, 106 content::SiteInstance* site_instance, 107 int guest_instance_id, 108 scoped_ptr<base::DictionaryValue> extra_params); 109 110 // Creates a swapped out RenderView. This is used by the browser plugin to 111 // create a swapped out RenderView in the embedder render process for the 112 // guest, to expose the guest's window object to the embedder. 113 // This returns the routing ID of the newly created swapped out RenderView. 114 int CreateSwappedOutRenderView(SiteInstance* instance); 115 116 // Complex initialization here. Specifically needed to avoid having 117 // members call back into our virtual functions in the constructor. 118 virtual void Init(const WebContents::CreateParams& params); 119 120 // Returns the SavePackage which manages the page saving job. May be NULL. 121 SavePackage* save_package() const { return save_package_.get(); } 122 123#if defined(OS_ANDROID) 124 JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { 125 return java_bridge_dispatcher_host_manager_.get(); 126 } 127 128 // In Android WebView, the RenderView needs created even there is no 129 // navigation entry, this allows Android WebViews to use 130 // javascript: URLs that load into the DOMWindow before the first page 131 // load. This is not safe to do in any context that a web page could get a 132 // reference to the DOMWindow before the first page load. 133 bool CreateRenderViewForInitialEmptyDocument(); 134#endif 135 136 // Expose the render manager for testing. 137 // TODO(creis): Remove this now that we can get to it via FrameTreeNode. 138 RenderFrameHostManager* GetRenderManagerForTesting(); 139 140 // Returns guest browser plugin object, or NULL if this WebContents is not a 141 // guest. 142 BrowserPluginGuest* GetBrowserPluginGuest() const; 143 144 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents 145 // has a BrowserPluginGuest then that implies that it is being hosted by 146 // a BrowserPlugin object in an embedder renderer process. 147 void SetBrowserPluginGuest(BrowserPluginGuest* guest); 148 149 // Returns embedder browser plugin object, or NULL if this WebContents is not 150 // an embedder. 151 BrowserPluginEmbedder* GetBrowserPluginEmbedder() const; 152 153 // Returns the BrowserPluginGuestManager object, or NULL if this web contents 154 // does not have a BrowserPluginGuestManager. 155 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; 156 157 // Gets the current fullscreen render widget's routing ID. Returns 158 // MSG_ROUTING_NONE when there is no fullscreen render widget. 159 int GetFullscreenWidgetRoutingID() const; 160 161 // Invoked when visible SSL state (as defined by SSLStatus) changes. 162 void DidChangeVisibleSSLState(); 163 164 // Informs the render view host and the BrowserPluginEmbedder, if present, of 165 // a Drag Source End. 166 void DragSourceEndedAt(int client_x, int client_y, int screen_x, 167 int screen_y, blink::WebDragOperation operation); 168 169 // Informs the render view host and the BrowserPluginEmbedder, if present, of 170 // a Drag Source Move. 171 void DragSourceMovedTo(int client_x, int client_y, 172 int screen_x, int screen_y); 173 174 // A response has been received for a resource request. 175 void DidGetResourceResponseStart( 176 const ResourceRequestDetails& details); 177 178 // A redirect was received while requesting a resource. 179 void DidGetRedirectForResourceRequest( 180 RenderViewHost* render_view_host, 181 const ResourceRedirectDetails& details); 182 183 // WebContents ------------------------------------------------------ 184 virtual WebContentsDelegate* GetDelegate() OVERRIDE; 185 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; 186 virtual NavigationControllerImpl& GetController() OVERRIDE; 187 virtual const NavigationControllerImpl& GetController() const OVERRIDE; 188 virtual BrowserContext* GetBrowserContext() const OVERRIDE; 189 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; 190 virtual RenderFrameHost* GetMainFrame() OVERRIDE; 191 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; 192 virtual void ForEachFrame( 193 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; 194 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; 195 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; 196 virtual WebContents* GetEmbedderWebContents() const OVERRIDE; 197 virtual int GetEmbeddedInstanceID() const OVERRIDE; 198 virtual int GetRoutingID() const OVERRIDE; 199 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; 200 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const 201 OVERRIDE; 202 virtual WebContentsView* GetView() const OVERRIDE; 203 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; 204 virtual WebUI* GetWebUI() const OVERRIDE; 205 virtual WebUI* GetCommittedWebUI() const OVERRIDE; 206 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; 207 virtual const std::string& GetUserAgentOverride() const OVERRIDE; 208#if defined(OS_WIN) 209 virtual void SetParentNativeViewAccessible( 210 gfx::NativeViewAccessible accessible_parent) OVERRIDE; 211#endif 212 virtual const base::string16& GetTitle() const OVERRIDE; 213 virtual int32 GetMaxPageID() OVERRIDE; 214 virtual int32 GetMaxPageIDForSiteInstance( 215 SiteInstance* site_instance) OVERRIDE; 216 virtual SiteInstance* GetSiteInstance() const OVERRIDE; 217 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; 218 virtual bool IsLoading() const OVERRIDE; 219 virtual bool IsWaitingForResponse() const OVERRIDE; 220 virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; 221 virtual const base::string16& GetLoadStateHost() const OVERRIDE; 222 virtual uint64 GetUploadSize() const OVERRIDE; 223 virtual uint64 GetUploadPosition() const OVERRIDE; 224 virtual std::set<GURL> GetSitesInTab() const OVERRIDE; 225 virtual const std::string& GetEncoding() const OVERRIDE; 226 virtual bool DisplayedInsecureContent() const OVERRIDE; 227 virtual void IncrementCapturerCount(const gfx::Size& capture_size) OVERRIDE; 228 virtual void DecrementCapturerCount() OVERRIDE; 229 virtual int GetCapturerCount() const OVERRIDE; 230 virtual bool IsCrashed() const OVERRIDE; 231 virtual void SetIsCrashed(base::TerminationStatus status, 232 int error_code) OVERRIDE; 233 virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE; 234 virtual bool IsBeingDestroyed() const OVERRIDE; 235 virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE; 236 virtual base::TimeTicks GetLastActiveTime() const OVERRIDE; 237 virtual void WasShown() OVERRIDE; 238 virtual void WasHidden() OVERRIDE; 239 virtual bool NeedToFireBeforeUnload() OVERRIDE; 240 virtual void Stop() OVERRIDE; 241 virtual WebContents* Clone() OVERRIDE; 242 virtual void ReloadFocusedFrame(bool ignore_cache) OVERRIDE; 243 virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE; 244 virtual bool ShowingInterstitialPage() const OVERRIDE; 245 virtual InterstitialPage* GetInterstitialPage() const OVERRIDE; 246 virtual bool IsSavable() OVERRIDE; 247 virtual void OnSavePage() OVERRIDE; 248 virtual bool SavePage(const base::FilePath& main_file, 249 const base::FilePath& dir_path, 250 SavePageType save_type) OVERRIDE; 251 virtual void SaveFrame(const GURL& url, 252 const Referrer& referrer) OVERRIDE; 253 virtual void GenerateMHTML( 254 const base::FilePath& file, 255 const base::Callback<void(int64)>& callback) 256 OVERRIDE; 257 virtual bool IsActiveEntry(int32 page_id) OVERRIDE; 258 259 virtual const std::string& GetContentsMimeType() const OVERRIDE; 260 virtual bool WillNotifyDisconnection() const OVERRIDE; 261 virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE; 262 virtual void ResetOverrideEncoding() OVERRIDE; 263 virtual RendererPreferences* GetMutableRendererPrefs() OVERRIDE; 264 virtual void Close() OVERRIDE; 265 virtual void SystemDragEnded() OVERRIDE; 266 virtual void UserGestureDone() OVERRIDE; 267 virtual void SetClosedByUserGesture(bool value) OVERRIDE; 268 virtual bool GetClosedByUserGesture() const OVERRIDE; 269 virtual double GetZoomLevel() const OVERRIDE; 270 virtual int GetZoomPercent(bool* enable_increment, 271 bool* enable_decrement) const OVERRIDE; 272 virtual void ViewSource() OVERRIDE; 273 virtual void ViewFrameSource(const GURL& url, 274 const PageState& page_state) OVERRIDE; 275 virtual int GetMinimumZoomPercent() const OVERRIDE; 276 virtual int GetMaximumZoomPercent() const OVERRIDE; 277 virtual gfx::Size GetPreferredSize() const OVERRIDE; 278 virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE; 279 virtual bool HasOpener() const OVERRIDE; 280 virtual void DidChooseColorInColorChooser(SkColor color) OVERRIDE; 281 virtual void DidEndColorChooser() OVERRIDE; 282 virtual int DownloadImage(const GURL& url, 283 bool is_favicon, 284 uint32_t max_bitmap_size, 285 const ImageDownloadCallback& callback) OVERRIDE; 286 virtual bool IsSubframe() const OVERRIDE; 287 virtual void Find(int request_id, 288 const base::string16& search_text, 289 const blink::WebFindOptions& options) OVERRIDE; 290 virtual void SetZoomLevel(double level) OVERRIDE; 291 virtual void StopFinding(StopFindAction action) OVERRIDE; 292#if defined(OS_ANDROID) 293 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() 294 OVERRIDE; 295#endif 296 297 // Implementation of PageNavigator. 298 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE; 299 300 // Implementation of IPC::Sender. 301 virtual bool Send(IPC::Message* message) OVERRIDE; 302 303 // RenderFrameHostDelegate --------------------------------------------------- 304 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host, 305 const IPC::Message& message) OVERRIDE; 306 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; 307 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; 308 virtual void DidStartLoading(RenderFrameHost* render_frame_host, 309 bool to_different_document) OVERRIDE; 310 virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE; 311 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE; 312 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE; 313 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, 314 const ContextMenuParams& params) OVERRIDE; 315 virtual WebContents* GetAsWebContents() OVERRIDE; 316 317 // RenderViewHostDelegate ---------------------------------------------------- 318 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; 319 virtual bool OnMessageReceived(RenderViewHost* render_view_host, 320 const IPC::Message& message) OVERRIDE; 321 virtual const GURL& GetURL() const OVERRIDE; 322 virtual const GURL& GetVisibleURL() const OVERRIDE; 323 virtual const GURL& GetLastCommittedURL() const OVERRIDE; 324 // RenderFrameHostDelegate has the same method, so list it there because this 325 // interface is going away. 326 // virtual WebContents* GetAsWebContents() OVERRIDE; 327 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; 328 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; 329 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; 330 virtual void RenderViewTerminated(RenderViewHost* render_view_host, 331 base::TerminationStatus status, 332 int error_code) OVERRIDE; 333 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; 334 virtual void UpdateState(RenderViewHost* render_view_host, 335 int32 page_id, 336 const PageState& page_state) OVERRIDE; 337 virtual void UpdateTitle(RenderViewHost* render_view_host, 338 int32 page_id, 339 const base::string16& title, 340 base::i18n::TextDirection title_direction) OVERRIDE; 341 virtual void UpdateEncoding(RenderViewHost* render_view_host, 342 const std::string& encoding) OVERRIDE; 343 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; 344 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; 345 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; 346 virtual void DidCancelLoading() OVERRIDE; 347 virtual void DidChangeLoadProgress(double progress) OVERRIDE; 348 virtual void DidDisownOpener(RenderViewHost* rvh) OVERRIDE; 349 virtual void DidAccessInitialDocument() OVERRIDE; 350 virtual void DocumentAvailableInMainFrame( 351 RenderViewHost* render_view_host) OVERRIDE; 352 virtual void DocumentOnLoadCompletedInMainFrame( 353 RenderViewHost* render_view_host, 354 int32 page_id) OVERRIDE; 355 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; 356 virtual void RouteMessageEvent( 357 RenderViewHost* rvh, 358 const ViewMsg_PostMessage_Params& params) OVERRIDE; 359 virtual void RunJavaScriptMessage(RenderViewHost* rvh, 360 const base::string16& message, 361 const base::string16& default_prompt, 362 const GURL& frame_url, 363 JavaScriptMessageType type, 364 IPC::Message* reply_msg, 365 bool* did_suppress_message) OVERRIDE; 366 virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh, 367 const base::string16& message, 368 bool is_reload, 369 IPC::Message* reply_msg) OVERRIDE; 370 virtual bool AddMessageToConsole(int32 level, 371 const base::string16& message, 372 int32 line_no, 373 const base::string16& source_id) OVERRIDE; 374 virtual RendererPreferences GetRendererPrefs( 375 BrowserContext* browser_context) const OVERRIDE; 376 virtual WebPreferences GetWebkitPrefs() OVERRIDE; 377 virtual void OnUserGesture() OVERRIDE; 378 virtual void OnIgnoredUIEvent() OVERRIDE; 379 virtual void RendererUnresponsive(RenderViewHost* render_view_host, 380 bool is_during_beforeunload, 381 bool is_during_unload) OVERRIDE; 382 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; 383 virtual void LoadStateChanged(const GURL& url, 384 const net::LoadStateWithParam& load_state, 385 uint64 upload_position, 386 uint64 upload_size) OVERRIDE; 387 virtual void Activate() OVERRIDE; 388 virtual void Deactivate() OVERRIDE; 389 virtual void LostCapture() OVERRIDE; 390 virtual void HandleMouseDown() OVERRIDE; 391 virtual void HandleMouseUp() OVERRIDE; 392 virtual void HandlePointerActivate() OVERRIDE; 393 virtual void HandleGestureBegin() OVERRIDE; 394 virtual void HandleGestureEnd() OVERRIDE; 395 virtual void RunFileChooser( 396 RenderViewHost* render_view_host, 397 const FileChooserParams& params) OVERRIDE; 398 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; 399 virtual bool IsFullscreenForCurrentTab() const OVERRIDE; 400 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; 401 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE; 402 virtual void RequestToLockMouse(bool user_gesture, 403 bool last_unlocked_by_target) OVERRIDE; 404 virtual void LostMouseLock() OVERRIDE; 405 virtual void CreateNewWindow( 406 int render_process_id, 407 int route_id, 408 int main_frame_route_id, 409 const ViewHostMsg_CreateWindow_Params& params, 410 SessionStorageNamespace* session_storage_namespace) OVERRIDE; 411 virtual void CreateNewWidget(int render_process_id, 412 int route_id, 413 blink::WebPopupType popup_type) OVERRIDE; 414 virtual void CreateNewFullscreenWidget(int render_process_id, 415 int route_id) OVERRIDE; 416 virtual void ShowCreatedWindow(int route_id, 417 WindowOpenDisposition disposition, 418 const gfx::Rect& initial_pos, 419 bool user_gesture) OVERRIDE; 420 virtual void ShowCreatedWidget(int route_id, 421 const gfx::Rect& initial_pos) OVERRIDE; 422 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; 423 virtual void RequestMediaAccessPermission( 424 const MediaStreamRequest& request, 425 const MediaResponseCallback& callback) OVERRIDE; 426 virtual SessionStorageNamespace* GetSessionStorageNamespace( 427 SiteInstance* instance) OVERRIDE; 428 virtual FrameTree* GetFrameTree() OVERRIDE; 429 virtual void AccessibilityEventReceived( 430 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; 431 432 // NavigatorDelegate --------------------------------------------------------- 433 434 virtual void DidStartProvisionalLoad( 435 RenderFrameHostImpl* render_frame_host, 436 int parent_routing_id, 437 const GURL& validated_url, 438 bool is_error_page, 439 bool is_iframe_srcdoc) OVERRIDE; 440 virtual void DidFailProvisionalLoadWithError( 441 RenderFrameHostImpl* render_frame_host, 442 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) 443 OVERRIDE; 444 virtual void DidFailLoadWithError( 445 RenderFrameHostImpl* render_frame_host, 446 const GURL& url, 447 int error_code, 448 const base::string16& error_description) OVERRIDE; 449 virtual void DidRedirectProvisionalLoad( 450 RenderFrameHostImpl* render_frame_host, 451 const GURL& validated_target_url) OVERRIDE; 452 virtual void DidCommitProvisionalLoad( 453 RenderFrameHostImpl* render_frame_host, 454 const base::string16& frame_unique_name, 455 bool is_main_frame, 456 const GURL& url, 457 PageTransition transition_type) OVERRIDE; 458 virtual void DidNavigateMainFramePreCommit( 459 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE; 460 virtual void DidNavigateMainFramePostCommit( 461 const LoadCommittedDetails& details, 462 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE; 463 virtual void DidNavigateAnyFramePostCommit( 464 RenderFrameHostImpl* render_frame_host, 465 const LoadCommittedDetails& details, 466 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE; 467 virtual void SetMainFrameMimeType(const std::string& mime_type) OVERRIDE; 468 virtual bool CanOverscrollContent() OVERRIDE; 469 virtual void NotifyChangedNavigationState( 470 InvalidateTypes changed_flags) OVERRIDE; 471 virtual void AboutToNavigateRenderFrame( 472 RenderFrameHostImpl* render_frame_host) OVERRIDE; 473 virtual void DidStartNavigationToPendingEntry( 474 RenderFrameHostImpl* render_frame_host, 475 const GURL& url, 476 NavigationController::ReloadType reload_type) OVERRIDE; 477 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host, 478 const OpenURLParams& params) OVERRIDE; 479 480 // RenderWidgetHostDelegate -------------------------------------------------- 481 482 virtual void RenderWidgetDeleted( 483 RenderWidgetHostImpl* render_widget_host) OVERRIDE; 484 virtual bool PreHandleKeyboardEvent( 485 const NativeWebKeyboardEvent& event, 486 bool* is_keyboard_shortcut) OVERRIDE; 487 virtual void HandleKeyboardEvent( 488 const NativeWebKeyboardEvent& event) OVERRIDE; 489 virtual bool HandleWheelEvent( 490 const blink::WebMouseWheelEvent& event) OVERRIDE; 491 virtual bool PreHandleGestureEvent( 492 const blink::WebGestureEvent& event) OVERRIDE; 493 virtual bool HandleGestureEvent( 494 const blink::WebGestureEvent& event) OVERRIDE; 495 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; 496#if defined(OS_WIN) 497 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; 498#endif 499 500 // RenderFrameHostManager::Delegate ------------------------------------------ 501 502 virtual bool CreateRenderViewForRenderManager( 503 RenderViewHost* render_view_host, 504 int opener_route_id, 505 CrossProcessFrameConnector* frame_connector) OVERRIDE; 506 virtual void BeforeUnloadFiredFromRenderManager( 507 bool proceed, const base::TimeTicks& proceed_time, 508 bool* proceed_to_fire_unload) OVERRIDE; 509 virtual void RenderProcessGoneFromRenderManager( 510 RenderViewHost* render_view_host) OVERRIDE; 511 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; 512 virtual void CancelModalDialogsForRenderManager() OVERRIDE; 513 virtual void NotifySwappedFromRenderManager( 514 RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE; 515 virtual int CreateOpenerRenderViewsForRenderManager( 516 SiteInstance* instance) OVERRIDE; 517 virtual NavigationControllerImpl& 518 GetControllerForRenderManager() OVERRIDE; 519 virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE; 520 virtual NavigationEntry* 521 GetLastCommittedNavigationEntryForRenderManager() OVERRIDE; 522 virtual bool FocusLocationBarByDefault() OVERRIDE; 523 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; 524 virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE; 525 virtual bool IsHidden() OVERRIDE; 526 527 // NotificationObserver ------------------------------------------------------ 528 529 virtual void Observe(int type, 530 const NotificationSource& source, 531 const NotificationDetails& details) OVERRIDE; 532 533 // NavigationControllerDelegate ---------------------------------------------- 534 535 virtual WebContents* GetWebContents() OVERRIDE; 536 virtual void NotifyNavigationEntryCommitted( 537 const LoadCommittedDetails& load_details) OVERRIDE; 538 539 // Invoked before a form repost warning is shown. 540 virtual void NotifyBeforeFormRepostWarningShow() OVERRIDE; 541 542 // Activate this WebContents and show a form repost warning. 543 virtual void ActivateAndShowRepostFormWarningDialog() OVERRIDE; 544 545 // Updates the max page ID for the current SiteInstance in this 546 // WebContentsImpl to be at least |page_id|. 547 virtual void UpdateMaxPageID(int32 page_id) OVERRIDE; 548 549 // Updates the max page ID for the given SiteInstance in this WebContentsImpl 550 // to be at least |page_id|. 551 virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance, 552 int32 page_id) OVERRIDE; 553 554 // Copy the current map of SiteInstance ID to max page ID from another tab. 555 // This is necessary when this tab adopts the NavigationEntries from 556 // |web_contents|. 557 virtual void CopyMaxPageIDsFrom(WebContents* web_contents) OVERRIDE; 558 559 // Called by the NavigationController to cause the WebContentsImpl to navigate 560 // to the current pending entry. The NavigationController should be called 561 // back with RendererDidNavigate on success or DiscardPendingEntry on failure. 562 // The callbacks can be inside of this function, or at some future time. 563 // 564 // The entry has a PageID of -1 if newly created (corresponding to navigation 565 // to a new URL). 566 // 567 // If this method returns false, then the navigation is discarded (equivalent 568 // to calling DiscardPendingEntry on the NavigationController). 569 virtual bool NavigateToPendingEntry( 570 NavigationController::ReloadType reload_type) OVERRIDE; 571 572 // Sets the history for this WebContentsImpl to |history_length| entries, and 573 // moves the current page_id to the last entry in the list if it's valid. 574 // This is mainly used when a prerendered page is swapped into the current 575 // tab. The method is virtual for testing. 576 virtual void SetHistoryLengthAndPrune( 577 const SiteInstance* site_instance, 578 int merge_history_length, 579 int32 minimum_page_id) OVERRIDE; 580 581 // Called by InterstitialPageImpl when it creates a RenderFrameHost. 582 virtual void RenderFrameForInterstitialPageCreated( 583 RenderFrameHost* render_frame_host) OVERRIDE; 584 585 // Sets the passed interstitial as the currently showing interstitial. 586 // No interstitial page should already be attached. 587 virtual void AttachInterstitialPage( 588 InterstitialPageImpl* interstitial_page) OVERRIDE; 589 590 // Unsets the currently showing interstitial. 591 virtual void DetachInterstitialPage() OVERRIDE; 592 593 // Changes the IsLoading state and notifies the delegate as needed. 594 // |details| is used to provide details on the load that just finished 595 // (but can be null if not applicable). 596 virtual void SetIsLoading(RenderViewHost* render_view_host, 597 bool is_loading, 598 bool to_different_document, 599 LoadNotificationDetails* details) OVERRIDE; 600 601 typedef base::Callback<void(WebContents*)> CreatedCallback; 602 603 private: 604 friend class NavigationControllerImpl; 605 friend class TestNavigationObserver; 606 friend class WebContentsObserver; 607 friend class WebContents; // To implement factory methods. 608 609 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); 610 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); 611 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); 612 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, 613 CrossSiteCantPreemptAfterUnload); 614 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); 615 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); 616 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime); 617 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); 618 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); 619 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); 620 621 // So InterstitialPageImpl can access SetIsLoading. 622 friend class InterstitialPageImpl; 623 624 // TODO(brettw) TestWebContents shouldn't exist! 625 friend class TestWebContents; 626 627 class DestructionObserver; 628 629 // See WebContents::Create for a description of these parameters. 630 WebContentsImpl(BrowserContext* browser_context, 631 WebContentsImpl* opener); 632 633 // Add and remove observers for page navigation notifications. The order in 634 // which notifications are sent to observers is undefined. Clients must be 635 // sure to remove the observer before they go away. 636 void AddObserver(WebContentsObserver* observer); 637 void RemoveObserver(WebContentsObserver* observer); 638 639 // Clears this tab's opener if it has been closed. 640 void OnWebContentsDestroyed(WebContentsImpl* web_contents); 641 642 // Creates and adds to the map a destruction observer watching |web_contents|. 643 // No-op if such an observer already exists. 644 void AddDestructionObserver(WebContentsImpl* web_contents); 645 646 // Deletes and removes from the map a destruction observer 647 // watching |web_contents|. No-op if there is no such observer. 648 void RemoveDestructionObserver(WebContentsImpl* web_contents); 649 650 // Callback function when showing JS dialogs. 651 void OnDialogClosed(RenderViewHost* rvh, 652 IPC::Message* reply_msg, 653 bool success, 654 const base::string16& user_input); 655 656 // Callback function when requesting permission to access the PPAPI broker. 657 // |result| is true if permission was granted. 658 void OnPpapiBrokerPermissionResult(int routing_id, bool result); 659 660 bool OnMessageReceived(RenderViewHost* render_view_host, 661 RenderFrameHost* render_frame_host, 662 const IPC::Message& message); 663 664 // IPC message handlers. 665 void OnDidLoadResourceFromMemoryCache(const GURL& url, 666 const std::string& security_info, 667 const std::string& http_request, 668 const std::string& mime_type, 669 ResourceType::Type resource_type); 670 void OnDidDisplayInsecureContent(); 671 void OnDidRunInsecureContent(const std::string& security_origin, 672 const GURL& target_url); 673 void OnDocumentLoadedInFrame(); 674 void OnDidFinishLoad(const GURL& url); 675 void OnGoToEntryAtOffset(int offset); 676 void OnUpdateZoomLimits(int minimum_percent, 677 int maximum_percent, 678 bool remember); 679 void OnEnumerateDirectory(int request_id, const base::FilePath& path); 680 681 void OnRegisterProtocolHandler(const std::string& protocol, 682 const GURL& url, 683 const base::string16& title, 684 bool user_gesture); 685 void OnFindReply(int request_id, 686 int number_of_matches, 687 const gfx::Rect& selection_rect, 688 int active_match_ordinal, 689 bool final_update); 690#if defined(OS_ANDROID) 691 void OnFindMatchRectsReply(int version, 692 const std::vector<gfx::RectF>& rects, 693 const gfx::RectF& active_rect); 694 695 void OnOpenDateTimeDialog( 696 const ViewHostMsg_DateTimeDialogValue_Params& value); 697 void OnJavaBridgeGetChannelHandle(IPC::Message* reply_msg); 698#endif 699 void OnPepperPluginHung(int plugin_child_id, 700 const base::FilePath& path, 701 bool is_hung); 702 void OnPluginCrashed(const base::FilePath& plugin_path, 703 base::ProcessId plugin_pid); 704 void OnDomOperationResponse(const std::string& json_string, 705 int automation_id); 706 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); 707 void OnOpenColorChooser(int color_chooser_id, 708 SkColor color, 709 const std::vector<ColorSuggestion>& suggestions); 710 void OnEndColorChooser(int color_chooser_id); 711 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); 712 void OnWebUISend(const GURL& source_url, 713 const std::string& name, 714 const base::ListValue& args); 715 void OnRequestPpapiBrokerPermission(int routing_id, 716 const GURL& url, 717 const base::FilePath& plugin_path); 718 void OnBrowserPluginMessage(const IPC::Message& message); 719 void OnDidDownloadImage(int id, 720 int http_status_code, 721 const GURL& image_url, 722 const std::vector<SkBitmap>& bitmaps, 723 const std::vector<gfx::Size>& original_bitmap_sizes); 724 void OnUpdateFaviconURL(int32 page_id, 725 const std::vector<FaviconURL>& candidates); 726 void OnFirstVisuallyNonEmptyPaint(int32 page_id); 727 void OnMediaPlayingNotification(int64 player_cookie, 728 bool has_video, 729 bool has_audio); 730 void OnMediaPausedNotification(int64 player_cookie); 731 void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view, 732 const base::string16& main_text, 733 const base::string16& sub_text); 734 void OnHideValidationMessage(); 735 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); 736 737 738 // Called by derived classes to indicate that we're no longer waiting for a 739 // response. This won't actually update the throbber, but it will get picked 740 // up at the next animation step if the throbber is going. 741 void SetNotWaitingForResponse() { waiting_for_response_ = false; } 742 743 // Navigation helpers -------------------------------------------------------- 744 // 745 // These functions are helpers for Navigate() and DidNavigate(). 746 747 // Handles post-navigation tasks in DidNavigate AFTER the entry has been 748 // committed to the navigation controller. Note that the navigation entry is 749 // not provided since it may be invalid/changed after being committed. The 750 // current navigation entry is in the NavigationController at this point. 751 752 // If our controller was restored, update the max page ID associated with the 753 // given RenderViewHost to be larger than the number of restored entries. 754 // This is called in CreateRenderView before any navigations in the RenderView 755 // have begun, to prevent any races in updating RenderView::next_page_id. 756 void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh); 757 758 // Saves the given title to the navigation entry and does associated work. It 759 // will update history and the view for the new title, and also synthesize 760 // titles for file URLs that have none (so we require that the URL of the 761 // entry already be set). 762 // 763 // This is used as the backend for state updates, which include a new title, 764 // or the dedicated set title message. It returns true if the new title is 765 // different and was therefore updated. 766 bool UpdateTitleForEntry(NavigationEntryImpl* entry, 767 const base::string16& title); 768 769 // Recursively creates swapped out RenderViews for this tab's opener chain 770 // (including this tab) in the given SiteInstance, allowing other tabs to send 771 // cross-process JavaScript calls to their opener(s). Returns the route ID of 772 // this tab's RenderView for |instance|. 773 int CreateOpenerRenderViews(SiteInstance* instance); 774 775 // Helper for CreateNewWidget/CreateNewFullscreenWidget. 776 void CreateNewWidget(int render_process_id, 777 int route_id, 778 bool is_fullscreen, 779 blink::WebPopupType popup_type); 780 781 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. 782 void ShowCreatedWidget(int route_id, 783 bool is_fullscreen, 784 const gfx::Rect& initial_pos); 785 786 // Finds the new RenderWidgetHost and returns it. Note that this can only be 787 // called once as this call also removes it from the internal map. 788 RenderWidgetHostView* GetCreatedWidget(int route_id); 789 790 // Finds the new WebContentsImpl by route_id, initializes it for 791 // renderer-initiated creation, and returns it. Note that this can only be 792 // called once as this call also removes it from the internal map. 793 WebContentsImpl* GetCreatedWindow(int route_id); 794 795 // Returns the RenderWidgetHostView that is associated with a native window 796 // and can be used in showing created widgets. 797 // If this WebContents belongs to a browser plugin guest, there is no native 798 // window 'view' associated with this WebContents. This method returns the 799 // 'view' of the embedder instead. 800 RenderWidgetHostViewPort* GetRenderWidgetHostViewPort() const; 801 802 // Misc non-view stuff ------------------------------------------------------- 803 804 // Helper functions for sending notifications. 805 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host); 806 void NotifyDisconnected(); 807 808 void SetEncoding(const std::string& encoding); 809 810 // TODO(creis): This should take in a FrameTreeNode to know which node's 811 // render manager to return. For now, we just return the root's. 812 RenderFrameHostManager* GetRenderManager() const; 813 814 RenderViewHostImpl* GetRenderViewHostImpl(); 815 816 // Removes browser plugin embedder if there is one. 817 void RemoveBrowserPluginEmbedder(); 818 819 // Clear |render_view_host|'s PowerSaveBlockers. 820 void ClearPowerSaveBlockers(RenderViewHost* render_view_host); 821 822 // Clear all PowerSaveBlockers, leave power_save_blocker_ empty. 823 void ClearAllPowerSaveBlockers(); 824 825 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView(). 826 gfx::Size GetSizeForNewRenderView() const; 827 828 void OnFrameRemoved(RenderViewHostImpl* render_view_host, 829 int frame_routing_id); 830 831 // Helper method that's called whenever |preferred_size_| or 832 // |preferred_size_for_capture_| changes, to propagate the new value to the 833 // |delegate_|. 834 void OnPreferredSizeChanged(const gfx::Size& old_size); 835 836 // Adds/removes a callback called on creation of each new WebContents. 837 // Deprecated, about to remove. 838 static void AddCreatedCallback(const CreatedCallback& callback); 839 static void RemoveCreatedCallback(const CreatedCallback& callback); 840 841 // Data for core operation --------------------------------------------------- 842 843 // Delegate for notifying our owner about stuff. Not owned by us. 844 WebContentsDelegate* delegate_; 845 846 // Handles the back/forward list and loading. 847 NavigationControllerImpl controller_; 848 849 // The corresponding view. 850 scoped_ptr<WebContentsViewPort> view_; 851 852 // The view of the RVHD. Usually this is our WebContentsView implementation, 853 // but if an embedder uses a different WebContentsView, they'll need to 854 // provide this. 855 RenderViewHostDelegateView* render_view_host_delegate_view_; 856 857 // Tracks created WebContentsImpl objects that have not been shown yet. They 858 // are identified by the route ID passed to CreateNewWindow. 859 typedef std::map<int, WebContentsImpl*> PendingContents; 860 PendingContents pending_contents_; 861 862 // These maps hold on to the widgets that we created on behalf of the renderer 863 // that haven't shown yet. 864 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; 865 PendingWidgetViews pending_widget_views_; 866 867 typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers; 868 DestructionObservers destruction_observers_; 869 870 // A list of observers notified when page state changes. Weak references. 871 // This MUST be listed above frame_tree_ since at destruction time the 872 // latter might cause RenderViewHost's destructor to call us and we might use 873 // the observer list then. 874 ObserverList<WebContentsObserver> observers_; 875 876 // The tab that opened this tab, if any. Will be set to null if the opener 877 // is closed. 878 WebContentsImpl* opener_; 879 880#if defined(OS_WIN) 881 gfx::NativeViewAccessible accessible_parent_; 882#endif 883 884 // Helper classes ------------------------------------------------------------ 885 886 // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker 887 // pairs. Key is the RenderViewHost, value is the map which maps player_cookie 888 // on to PowerSaveBlocker. 889 typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> > 890 PowerSaveBlockerMap; 891 PowerSaveBlockerMap power_save_blockers_; 892 893 // Manages the frame tree of the page and process swaps in each node. 894 FrameTree frame_tree_; 895 896#if defined(OS_ANDROID) 897 // Manages injecting Java objects into all RenderViewHosts associated with 898 // this WebContentsImpl. 899 scoped_ptr<JavaBridgeDispatcherHostManager> 900 java_bridge_dispatcher_host_manager_; 901#endif 902 903 // SavePackage, lazily created. 904 scoped_refptr<SavePackage> save_package_; 905 906 // Data for loading state ---------------------------------------------------- 907 908 // Indicates whether we're currently loading a resource. 909 bool is_loading_; 910 911 // Indicates if the tab is considered crashed. 912 base::TerminationStatus crashed_status_; 913 int crashed_error_code_; 914 915 // Whether this WebContents is waiting for a first-response for the 916 // main resource of the page. This controls whether the throbber state is 917 // "waiting" or "loading." 918 bool waiting_for_response_; 919 920 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific 921 // to a given tab and SiteInstance, and must be valid for the lifetime of the 922 // WebContentsImpl. 923 std::map<int32, int32> max_page_ids_; 924 925 // The current load state and the URL associated with it. 926 net::LoadStateWithParam load_state_; 927 base::string16 load_state_host_; 928 // Upload progress, for displaying in the status bar. 929 // Set to zero when there is no significant upload happening. 930 uint64 upload_size_; 931 uint64 upload_position_; 932 933 // Data for current page ----------------------------------------------------- 934 935 // When a title cannot be taken from any entry, this title will be used. 936 base::string16 page_title_when_no_navigation_entry_; 937 938 // When a navigation occurs, we record its contents MIME type. It can be 939 // used to check whether we can do something for some special contents. 940 std::string contents_mime_type_; 941 942 // Character encoding. 943 std::string encoding_; 944 945 // True if this is a secure page which displayed insecure content. 946 bool displayed_insecure_content_; 947 948 // Data for misc internal state ---------------------------------------------- 949 950 // When > 0, the WebContents is currently being captured (e.g., for 951 // screenshots or mirroring); and the underlying RenderWidgetHost should not 952 // be told it is hidden. 953 int capturer_count_; 954 955 // Tracks whether RWHV should be visible once capturer_count_ becomes zero. 956 bool should_normally_be_visible_; 957 958 // See getter above. 959 bool is_being_destroyed_; 960 961 // Indicates whether we should notify about disconnection of this 962 // WebContentsImpl. This is used to ensure disconnection notifications only 963 // happen if a connection notification has happened and that they happen only 964 // once. 965 bool notify_disconnection_; 966 967 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the 968 // delegate of this WebContentsImpl is nulled before its destructor is called. 969 JavaScriptDialogManager* dialog_manager_; 970 971 // Set to true when there is an active "before unload" dialog. When true, 972 // we've forced the throbber to start in Navigate, and we need to remember to 973 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. 974 bool is_showing_before_unload_dialog_; 975 976 // Settings that get passed to the renderer process. 977 RendererPreferences renderer_preferences_; 978 979 // The time that this WebContents was last made active. The initial value is 980 // the WebContents creation time. 981 base::TimeTicks last_active_time_; 982 983 // See description above setter. 984 bool closed_by_user_gesture_; 985 986 // Minimum/maximum zoom percent. 987 int minimum_zoom_percent_; 988 int maximum_zoom_percent_; 989 // If true, the default zoom limits have been overriden for this tab, in which 990 // case we don't want saved settings to apply to it and we don't want to 991 // remember it. 992 bool temporary_zoom_settings_; 993 994 // The raw accumulated zoom value and the actual zoom increments made for an 995 // an in-progress pinch gesture. 996 float totalPinchGestureAmount_; 997 int currentPinchZoomStepDelta_; 998 999 // The intrinsic size of the page. 1000 gfx::Size preferred_size_; 1001 1002 // The preferred size for content screen capture. When |capturer_count_| > 0, 1003 // this overrides |preferred_size_|. 1004 gfx::Size preferred_size_for_capture_; 1005 1006#if defined(OS_ANDROID) 1007 // Date time chooser opened by this tab. 1008 // Only used in Android since all other platforms use a multi field UI. 1009 scoped_ptr<DateTimeChooserAndroid> date_time_chooser_; 1010#endif 1011 1012 // Color chooser that was opened by this tab. 1013 scoped_ptr<ColorChooser> color_chooser_; 1014 1015 // A unique identifier for the current color chooser. Identifiers are unique 1016 // across a renderer process. This avoids race conditions in synchronizing 1017 // the browser and renderer processes. For example, if a renderer closes one 1018 // chooser and opens another, and simultaneously the user picks a color in the 1019 // first chooser, the IDs can be used to drop the "chose a color" message 1020 // rather than erroneously tell the renderer that the user picked a color in 1021 // the second chooser. 1022 int color_chooser_identifier_; 1023 1024 // Manages the embedder state for browser plugins, if this WebContents is an 1025 // embedder; NULL otherwise. 1026 scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_; 1027 // Manages the guest state for browser plugin, if this WebContents is a guest; 1028 // NULL otherwise. 1029 scoped_ptr<BrowserPluginGuest> browser_plugin_guest_; 1030 1031 // This must be at the end, or else we might get notifications and use other 1032 // member variables that are gone. 1033 NotificationRegistrar registrar_; 1034 1035 // Used during IPC message dispatching from the RenderView/RenderFrame so that 1036 // the handlers can get a pointer to the RVH through which the message was 1037 // received. 1038 RenderViewHost* render_view_message_source_; 1039 RenderFrameHost* render_frame_message_source_; 1040 1041 // All live RenderWidgetHostImpls that are created by this object and may 1042 // outlive it. 1043 std::set<RenderWidgetHostImpl*> created_widgets_; 1044 1045 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise. 1046 int fullscreen_widget_routing_id_; 1047 1048 // Maps the ids of pending image downloads to their callbacks 1049 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; 1050 ImageDownloadMap image_download_map_; 1051 1052 // Whether this WebContents is responsible for displaying a subframe in a 1053 // different process from its parent page. 1054 bool is_subframe_; 1055 1056 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1057}; 1058 1059} // namespace content 1060 1061#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1062