web_contents_impl.h revision b2df76ea8fec9e32f6f3718986dba0d95315b29c
18a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// Copyright (c) 2012 The Chromium Authors. All rights reserved.
28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// Use of this source code is governed by a BSD-style license that can be
38a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// found in the LICENSE file.
48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
58a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
68a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include <map>
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include <set>
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include <string>
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/compiler_specific.h"
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/gtest_prod_util.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/memory/scoped_ptr.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/observer_list.h"
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/process.h"
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/browser/renderer_host/frame_tree_node.h"
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/browser/renderer_host/render_view_host_delegate.h"
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/browser/renderer_host/render_widget_host_delegate.h"
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/browser/web_contents/navigation_controller_impl.h"
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/browser/web_contents/render_view_host_manager.h"
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/common/content_export.h"
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/public/browser/notification_observer.h"
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/public/browser/notification_registrar.h"
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/public/browser/web_contents.h"
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/public/common/renderer_preferences.h"
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/public/common/three_d_api_types.h"
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "net/base/load_states.h"
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "ui/gfx/rect_f.h"
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "ui/gfx/size.h"
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "webkit/glue/resource_type.h"
339aa8b32233702b19b97bebdc2c702e0c53407d45reed@android.com
349aa8b32233702b19b97bebdc2c702e0c53407d45reed@android.comstruct BrowserPluginHostMsg_ResizeGuest_Params;
359aa8b32233702b19b97bebdc2c702e0c53407d45reed@android.comstruct ViewHostMsg_DateTimeDialogValue_Params;
369aa8b32233702b19b97bebdc2c702e0c53407d45reed@android.comstruct ViewMsg_PostMessage_Params;
379aa8b32233702b19b97bebdc2c702e0c53407d45reed@android.com
389aa8b32233702b19b97bebdc2c702e0c53407d45reed@android.comnamespace content {
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass BrowserPluginEmbedder;
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass BrowserPluginGuest;
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass BrowserPluginGuestManager;
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass ColorChooser;
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass DateTimeChooserAndroid;
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass DownloadItem;
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass InterstitialPageImpl;
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass JavaBridgeDispatcherHostManager;
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass JavaScriptDialogManager;
488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass RenderViewHost;
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass RenderViewHostDelegateView;
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass RenderViewHostImpl;
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass RenderWidgetHostImpl;
528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass RenderWidgetHostViewPort;
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SavePackage;
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SessionStorageNamespaceImpl;
558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SiteInstance;
568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass TestWebContents;
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass WebContentsDelegate;
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass WebContentsImpl;
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass WebContentsObserver;
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass WebContentsViewPort;
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass WebContentsViewDelegate;
627ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.orgstruct FaviconURL;
638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct LoadNotificationDetails;
648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// Factory function for the implementations that content knows about. Takes
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// ownership of |delegate|.
678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comWebContentsViewPort* CreateWebContentsView(
688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    WebContentsImpl* web_contents,
698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    WebContentsViewDelegate* delegate,
708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    RenderViewHostDelegateView** render_view_host_delegate_view);
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
727ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.orgclass CONTENT_EXPORT WebContentsImpl
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    : public NON_EXPORTED_BASE(WebContents),
744516f4786f5dda1b86a8f825b9e8e910d9c2363creed@android.com      public RenderViewHostDelegate,
754516f4786f5dda1b86a8f825b9e8e910d9c2363creed@android.com      public RenderWidgetHostDelegate,
764516f4786f5dda1b86a8f825b9e8e910d9c2363creed@android.com      public RenderViewHostManager::Delegate,
774516f4786f5dda1b86a8f825b9e8e910d9c2363creed@android.com      public NotificationObserver {
784516f4786f5dda1b86a8f825b9e8e910d9c2363creed@android.com public:
798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual ~WebContentsImpl();
808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  static WebContentsImpl* CreateWithOpener(
828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const WebContents::CreateParams& params,
838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      WebContentsImpl* opener);
848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Returns the opener WebContentsImpl, if any. This can be set to null if the
868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // opener is closed or the page clears its window.opener.
878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  WebContentsImpl* opener() const { return opener_; }
888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Creates a WebContents to be used as a browser plugin guest.
908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  static BrowserPluginGuest* CreateGuest(
918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      BrowserContext* browser_context,
928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      content::SiteInstance* site_instance,
938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int guest_instance_id);
948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Returns the content specific prefs for the given RVH.
968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  static WebPreferences GetWebkitPrefs(
978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      RenderViewHost* rvh, const GURL& url);
988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Creates a swapped out RenderView. This is used by the browser plugin to
1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // create a swapped out RenderView in the embedder render process for the
1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // guest, to expose the guest's window object to the embedder.
1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // This returns the routing ID of the newly created swapped out RenderView.
1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  int CreateSwappedOutRenderView(SiteInstance* instance);
1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Complex initialization here. Specifically needed to avoid having
10628be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  // members call back into our virtual functions in the constructor.
10728be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  virtual void Init(const WebContents::CreateParams& params);
10828be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org
10928be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  // Returns the SavePackage which manages the page saving job. May be NULL.
11028be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  SavePackage* save_package() const { return save_package_.get(); }
11128be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org
11228be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  // Updates the max page ID for the current SiteInstance in this
11328be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  // WebContentsImpl to be at least |page_id|.
11428be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  void UpdateMaxPageID(int32 page_id);
11528be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org
11628be72b63e457c680c192a34fb9f58e1c693363fvandebo@chromium.org  // Updates the max page ID for the given SiteInstance in this WebContentsImpl
1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // to be at least |page_id|.
1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
11937a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com                                      int32 page_id);
12037a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com
12137a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // Copy the current map of SiteInstance ID to max page ID from another tab.
12237a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // This is necessary when this tab adopts the NavigationEntries from
12337a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // |web_contents|.
1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  void CopyMaxPageIDsFrom(WebContentsImpl* web_contents);
12537a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com
12637a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // Called by the NavigationController to cause the WebContentsImpl to navigate
12737a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // to the current pending entry. The NavigationController should be called
12837a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
12937a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // The callbacks can be inside of this function, or at some future time.
13037a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  //
13137a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // The entry has a PageID of -1 if newly created (corresponding to navigation
13237a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // to a new URL).
13337a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  //
13437a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // If this method returns false, then the navigation is discarded (equivalent
13537a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // to calling DiscardPendingEntry on the NavigationController).
13637a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  bool NavigateToPendingEntry(NavigationController::ReloadType reload_type);
13737a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com
13837a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // Called by InterstitialPageImpl when it creates a RenderViewHost.
13937a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  void RenderViewForInterstitialPageCreated(RenderViewHost* render_view_host);
14037a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com
14137a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // Sets the passed interstitial as the currently showing interstitial.
14237a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // No interstitial page should already be attached.
14337a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  void AttachInterstitialPage(InterstitialPageImpl* interstitial_page);
14437a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com
14537a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  // Unsets the currently showing interstitial.
14637a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  void DetachInterstitialPage();
14737a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com
14837a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com#if defined(ENABLE_JAVA_BRIDGE)
14937a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const {
15037a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com    return java_bridge_dispatcher_host_manager_.get();
15137a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com  }
15237a3133d2009b276f2126ccb61be1f69074cacb9reed@google.com#endif
1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Expose the render manager for testing.
1557ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org  RenderViewHostManager* GetRenderManagerForTesting();
1567ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org
1577ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org  // Returns guest browser plugin object, or NULL if this WebContents is not a
1587ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org  // guest.
1597ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org  BrowserPluginGuest* GetBrowserPluginGuest() const;
1607ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org  // Returns embedder browser plugin object, or NULL if this WebContents is not
1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // an embedder.
1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Returns the BrowserPluginGuestManager object, or NULL if this web contents
1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // does not have a BrowserPluginGuestManager.
1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  BrowserPluginGuestManager* GetBrowserPluginGuestManager() const;
1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Gets the current fullscreen render widget's routing ID. Returns
1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // MSG_ROUTING_NONE when there is no fullscreen render widget.
1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  int GetFullscreenWidgetRoutingID() const;
1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Invoked when visible SSL state (as defined by SSLStatus) changes.
1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  void DidChangeVisibleSSLState();
1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Invoked before a form repost warning is shown.
1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  void NotifyBeforeFormRepostWarningShow();
1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Informs the render view host and the BrowserPluginEmbedder, if present, of
1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // a Drag Source End.
1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  void DragSourceEndedAt(int client_x, int client_y, int screen_x,
1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int screen_y, WebKit::WebDragOperation operation);
1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Informs the render view host and the BrowserPluginEmbedder, if present, of
184d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  // a Drag Source Move.
185d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  void DragSourceMovedTo(int client_x, int client_y,
18690209caa686464cad70dd9d60b53c3d967eb57dareed@android.com                         int screen_x, int screen_y);
187d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com
188d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  FrameTreeNode* GetFrameTreeRootForTesting() {
189d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com    return frame_tree_root_.get();
190d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  }
191d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com
19290209caa686464cad70dd9d60b53c3d967eb57dareed@android.com  // WebContents ------------------------------------------------------
193d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual WebContentsDelegate* GetDelegate() OVERRIDE;
194d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE;
195d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual NavigationControllerImpl& GetController() OVERRIDE;
196d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual const NavigationControllerImpl& GetController() const OVERRIDE;
1978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual BrowserContext* GetBrowserContext() const OVERRIDE;
1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE;
1998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RenderViewHost* GetRenderViewHost() const OVERRIDE;
2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void GetRenderViewHostAtPosition(
2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int x,
2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int y,
2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const GetRenderViewHostCallback& callback) OVERRIDE;
2048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebContents* GetEmbedderWebContents() const OVERRIDE;
2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int GetEmbeddedInstanceID() const OVERRIDE;
2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int GetRoutingID() const OVERRIDE;
2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE;
2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebContentsView* GetView() const OVERRIDE;
2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE;
2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebUI* GetWebUI() const OVERRIDE;
2118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebUI* GetCommittedWebUI() const OVERRIDE;
2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SetUserAgentOverride(const std::string& override) OVERRIDE;
2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const std::string& GetUserAgentOverride() const OVERRIDE;
2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(OS_WIN) && defined(USE_AURA)
2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SetParentNativeViewAccessible(
2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      gfx::NativeViewAccessible accessible_parent) OVERRIDE;
2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const string16& GetTitle() const OVERRIDE;
2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int32 GetMaxPageID() OVERRIDE;
2208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int32 GetMaxPageIDForSiteInstance(
2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      SiteInstance* site_instance) OVERRIDE;
2228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual SiteInstance* GetSiteInstance() const OVERRIDE;
2238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE;
2248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsLoading() const OVERRIDE;
2258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsWaitingForResponse() const OVERRIDE;
2268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE;
2278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const string16& GetLoadStateHost() const OVERRIDE;
2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual uint64 GetUploadSize() const OVERRIDE;
2298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual uint64 GetUploadPosition() const OVERRIDE;
2308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const std::string& GetEncoding() const OVERRIDE;
2318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool DisplayedInsecureContent() const OVERRIDE;
2328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void IncrementCapturerCount() OVERRIDE;
2338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DecrementCapturerCount() OVERRIDE;
2348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsCrashed() const OVERRIDE;
2358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SetIsCrashed(base::TerminationStatus status,
2368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                            int error_code) OVERRIDE;
2378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE;
2388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsBeingDestroyed() const OVERRIDE;
2398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE;
2408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE;
241d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void WasShown() OVERRIDE;
2428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void WasHidden() OVERRIDE;
2438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool NeedToFireBeforeUnload() OVERRIDE;
2448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void Stop() OVERRIDE;
245d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual WebContents* Clone() OVERRIDE;
2468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE;
2478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool ShowingInterstitialPage() const OVERRIDE;
2488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual InterstitialPage* GetInterstitialPage() const OVERRIDE;
2498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsSavable() OVERRIDE;
2508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void OnSavePage() OVERRIDE;
251d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual bool SavePage(const base::FilePath& main_file,
2528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        const base::FilePath& dir_path,
2538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        SavePageType save_type) OVERRIDE;
2548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void GenerateMHTML(
2558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const base::FilePath& file,
2568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const base::Callback<void(const base::FilePath&, int64)>& callback)
2578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com          OVERRIDE;
2588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsActiveEntry(int32 page_id) OVERRIDE;
2598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const std::string& GetContentsMimeType() const OVERRIDE;
2618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool WillNotifyDisconnection() const OVERRIDE;
262d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE;
2638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void ResetOverrideEncoding() OVERRIDE;
2648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RendererPreferences* GetMutableRendererPrefs() OVERRIDE;
2658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE;
2668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE;
2678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void Close() OVERRIDE;
268d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void OnCloseStarted() OVERRIDE;
2698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SystemDragEnded() OVERRIDE;
2708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void UserGestureDone() OVERRIDE;
2718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SetClosedByUserGesture(bool value) OVERRIDE;
2728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool GetClosedByUserGesture() const OVERRIDE;
2738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual double GetZoomLevel() const OVERRIDE;
274d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual int GetZoomPercent(bool* enable_increment,
2758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                             bool* enable_decrement) const OVERRIDE;
2768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void ViewSource() OVERRIDE;
2778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void ViewFrameSource(const GURL& url,
278d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com                               const std::string& content_state) OVERRIDE;
2798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int GetMinimumZoomPercent() const OVERRIDE;
2808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int GetMaximumZoomPercent() const OVERRIDE;
2818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual gfx::Size GetPreferredSize() const OVERRIDE;
2828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int GetContentRestrictions() const OVERRIDE;
2838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE;
2848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool HasOpener() const OVERRIDE;
2858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidChooseColorInColorChooser(int color_chooser_id,
2868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                            SkColor color) OVERRIDE;
2878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidEndColorChooser(int color_chooser_id) OVERRIDE;
2888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual int DownloadImage(const GURL& url,
2898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                            bool is_favicon,
2908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                            int image_size,
2918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                            const ImageDownloadCallback& callback) OVERRIDE;
2928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
293d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  // Implementation of PageNavigator.
2948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE;
2958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // Implementation of IPC::Sender.
2978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool Send(IPC::Message* message) OVERRIDE;
2988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // RenderViewHostDelegate ----------------------------------------------------
3008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE;
3028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RenderViewHostDelegate::RendererManagement*
3038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      GetRendererManagementDelegate() OVERRIDE;
3048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool OnMessageReceived(RenderViewHost* render_view_host,
3058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 const IPC::Message& message) OVERRIDE;
3068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual const GURL& GetURL() const OVERRIDE;
3078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebContents* GetAsWebContents() OVERRIDE;
308d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
309d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
3108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
3118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RenderViewTerminated(RenderViewHost* render_view_host,
3128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    base::TerminationStatus status,
3138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    int error_code) OVERRIDE;
314d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
315d4577757874d1dda1a3bffa3f2347c251859c27ereed@android.com  virtual void DidStartProvisionalLoadForFrame(
3168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      RenderViewHost* render_view_host,
3178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int64 frame_id,
3188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int64 parent_frame_id,
3191fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      bool main_frame,
3201fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      const GURL& url) OVERRIDE;
3211fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com  virtual void DidRedirectProvisionalLoad(
3221fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      RenderViewHost* render_view_host,
3231fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      int32 page_id,
3241fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      const GURL& source_url,
3251fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      const GURL& target_url) OVERRIDE;
3261fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com  virtual void DidFailProvisionalLoadWithError(
3271fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      RenderViewHost* render_view_host,
3281fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params)
3291fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com          OVERRIDE;
3301fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com  virtual void DidNavigate(
3311fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      RenderViewHost* render_view_host,
3321fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
3338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void UpdateState(RenderViewHost* render_view_host,
3348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                           int32 page_id,
3358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                           const std::string& state) OVERRIDE;
3368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void UpdateTitle(RenderViewHost* render_view_host,
3378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                           int32 page_id,
3388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                           const string16& title,
3398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                           base::i18n::TextDirection title_direction) OVERRIDE;
3407ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org  virtual void UpdateEncoding(RenderViewHost* render_view_host,
3418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                              const std::string& encoding) OVERRIDE;
3428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
3431fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com  virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
3448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
3458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE;
3468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE;
3478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE;
3488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidCancelLoading() OVERRIDE;
3498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidChangeLoadProgress(double progress) OVERRIDE;
3508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DidDisownOpener(RenderViewHost* rvh) OVERRIDE;
3518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DocumentAvailableInMainFrame(
3528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      RenderViewHost* render_view_host) OVERRIDE;
3538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void DocumentOnLoadCompletedInMainFrame(
3541fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      RenderViewHost* render_view_host,
3558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int32 page_id) OVERRIDE;
3568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RequestOpenURL(RenderViewHost* rvh,
3578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                              const GURL& url,
3588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                              const Referrer& referrer,
3598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                              WindowOpenDisposition disposition,
3608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                              int64 source_frame_id,
3618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                              bool is_cross_site_redirect) OVERRIDE;
3628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RequestTransferURL(
3638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const GURL& url,
3648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const Referrer& referrer,
3658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      WindowOpenDisposition disposition,
3668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      int64 source_frame_id,
3678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const GlobalRequestID& transferred_global_request_id,
3681fcd51e6b2a210a37b9b9c2cfb82e1be7196e42areed@google.com      bool is_cross_site_redirect) OVERRIDE;
3698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
3708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RouteMessageEvent(
3718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      RenderViewHost* rvh,
3728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const ViewMsg_PostMessage_Params& params) OVERRIDE;
3738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RunJavaScriptMessage(RenderViewHost* rvh,
3748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    const string16& message,
3758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    const string16& default_prompt,
3768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    const GURL& frame_url,
3778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    JavaScriptMessageType type,
3788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    IPC::Message* reply_msg,
3798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    bool* did_suppress_message) OVERRIDE;
3808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh,
3818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                      const string16& message,
3828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                      bool is_reload,
3838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                      IPC::Message* reply_msg) OVERRIDE;
3848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool AddMessageToConsole(int32 level,
3858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                   const string16& message,
3868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                   int32 line_no,
3878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                   const string16& source_id) OVERRIDE;
3888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual RendererPreferences GetRendererPrefs(
3898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      BrowserContext* browser_context) const OVERRIDE;
3908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebPreferences GetWebkitPrefs() OVERRIDE;
3918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void OnUserGesture() OVERRIDE;
3928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void OnIgnoredUIEvent() OVERRIDE;
3938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RendererUnresponsive(RenderViewHost* render_view_host,
3948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    bool is_during_unload) OVERRIDE;
3958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
3968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void LoadStateChanged(const GURL& url,
3978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                const net::LoadStateWithParam& load_state,
3988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                uint64 upload_position,
3998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                uint64 upload_size) OVERRIDE;
4008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void WorkerCrashed() OVERRIDE;
4018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void Activate() OVERRIDE;
4028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void Deactivate() OVERRIDE;
4038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void LostCapture() OVERRIDE;
4048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void HandleMouseDown() OVERRIDE;
4058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void HandleMouseUp() OVERRIDE;
40663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void HandlePointerActivate() OVERRIDE;
40763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void HandleGestureBegin() OVERRIDE;
40863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void HandleGestureEnd() OVERRIDE;
40963a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void RunFileChooser(
41063a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      RenderViewHost* render_view_host,
41163a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const FileChooserParams& params) OVERRIDE;
4128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
4138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
41463a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
41563a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
41663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void RequestToLockMouse(bool user_gesture,
41763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com                                  bool last_unlocked_by_target) OVERRIDE;
41863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void LostMouseLock() OVERRIDE;
41963a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void CreateNewWindow(
42063a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      int route_id,
4218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      const ViewHostMsg_CreateWindow_Params& params,
42263a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      SessionStorageNamespace* session_storage_namespace) OVERRIDE;
42363a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void CreateNewWidget(int route_id,
42463a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com                               WebKit::WebPopupType popup_type) OVERRIDE;
42563a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE;
42663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void ShowCreatedWindow(int route_id,
42763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com                                 WindowOpenDisposition disposition,
42863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com                                 const gfx::Rect& initial_pos,
42963a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com                                 bool user_gesture) OVERRIDE;
43063a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void ShowCreatedWidget(int route_id,
43163a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com                                 const gfx::Rect& initial_pos) OVERRIDE;
43263a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE;
43363a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void ShowContextMenu(
43463a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const ContextMenuParams& params,
43563a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      ContextMenuSourceType type) OVERRIDE;
43663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void RequestMediaAccessPermission(
43763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const MediaStreamRequest& request,
43863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const MediaResponseCallback& callback) OVERRIDE;
4398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
44063a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  // RenderWidgetHostDelegate --------------------------------------------------
4418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
44263a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void RenderWidgetDeleted(
44363a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      RenderWidgetHostImpl* render_widget_host) OVERRIDE;
44463a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual bool PreHandleKeyboardEvent(
44563a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const NativeWebKeyboardEvent& event,
44663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      bool* is_keyboard_shortcut) OVERRIDE;
44763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void HandleKeyboardEvent(
44863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const NativeWebKeyboardEvent& event) OVERRIDE;
4498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool PreHandleWheelEvent(
45063a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      const WebKit::WebMouseWheelEvent& event) OVERRIDE;
45163a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com#if defined(OS_WIN) && defined(USE_AURA)
45263a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE;
45363a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com#endif
45463a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com
45563a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  // RenderViewHostManager::Delegate -------------------------------------------
45663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com
45763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual bool CreateRenderViewForRenderManager(
45863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      RenderViewHost* render_view_host, int opener_route_id) OVERRIDE;
45963a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void BeforeUnloadFiredFromRenderManager(
46063a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      bool proceed, const base::TimeTicks& proceed_time,
46163a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      bool* proceed_to_fire_unload) OVERRIDE;
46263a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void RenderViewGoneFromRenderManager(
46363a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      RenderViewHost* render_view_host) OVERRIDE;
46463a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE;
46563a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual void NotifySwappedFromRenderManager(
46663a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      RenderViewHost* old_render_view_host) OVERRIDE;
46763a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual int CreateOpenerRenderViewsForRenderManager(
46863a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com      SiteInstance* instance) OVERRIDE;
46963a6060fcdc16245ea3958e7fd88ae32c5e631a3reed@google.com  virtual NavigationControllerImpl&
4708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      GetControllerForRenderManager() OVERRIDE;
4718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE;
4728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual NavigationEntry*
4738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com      GetLastCommittedNavigationEntryForRenderManager() OVERRIDE;
4748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual bool FocusLocationBarByDefault() OVERRIDE;
4758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
4768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE;
4778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  // NotificationObserver ------------------------------------------------------
4798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com  virtual void Observe(int type,
4818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                       const NotificationSource& source,
482                       const NotificationDetails& details) OVERRIDE;
483
484
485 private:
486  friend class NavigationControllerImpl;
487  friend class WebContentsObserver;
488  friend class WebContents;  // To implement factory methods.
489
490  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
491  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
492  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
493  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
494                           CrossSiteCantPreemptAfterUnload);
495  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
496  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
497  FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
498  FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
499  FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
500
501  // So InterstitialPageImpl can access SetIsLoading.
502  friend class InterstitialPageImpl;
503
504  // TODO(brettw) TestWebContents shouldn't exist!
505  friend class TestWebContents;
506
507  // See WebContents::Create for a description of these parameters.
508  WebContentsImpl(BrowserContext* browser_context,
509                  WebContentsImpl* opener);
510
511  // Add and remove observers for page navigation notifications. Adding or
512  // removing multiple times has no effect. The order in which notifications
513  // are sent to observers is undefined. Clients must be sure to remove the
514  // observer before they go away.
515  void AddObserver(WebContentsObserver* observer);
516  void RemoveObserver(WebContentsObserver* observer);
517
518  // Clears this tab's opener if it has been closed.
519  void OnWebContentsDestroyed(WebContents* web_contents);
520
521  // Callback function when showing JS dialogs.
522  void OnDialogClosed(RenderViewHost* rvh,
523                      IPC::Message* reply_msg,
524                      bool success,
525                      const string16& user_input);
526
527  // Callback function when requesting permission to access the PPAPI broker.
528  // |result| is true if permission was granted.
529  void OnPpapiBrokerPermissionResult(int request_id, bool result);
530
531  // IPC message handlers.
532  void OnDidLoadResourceFromMemoryCache(const GURL& url,
533                                        const std::string& security_info,
534                                        const std::string& http_request,
535                                        const std::string& mime_type,
536                                        ResourceType::Type resource_type);
537  void OnDidDisplayInsecureContent();
538  void OnDidRunInsecureContent(const std::string& security_origin,
539                               const GURL& target_url);
540  void OnDocumentLoadedInFrame(int64 frame_id);
541  void OnDidFinishLoad(int64 frame_id,
542                       const GURL& url,
543                       bool is_main_frame);
544  void OnDidFailLoadWithError(int64 frame_id,
545                              const GURL& url,
546                              bool is_main_frame,
547                              int error_code,
548                              const string16& error_description);
549  void OnUpdateContentRestrictions(int restrictions);
550  void OnGoToEntryAtOffset(int offset);
551  void OnUpdateZoomLimits(int minimum_percent,
552                          int maximum_percent,
553                          bool remember);
554  void OnSaveURL(const GURL& url, const Referrer& referrer);
555  void OnEnumerateDirectory(int request_id, const base::FilePath& path);
556  void OnJSOutOfMemory();
557
558  void OnRegisterProtocolHandler(const std::string& protocol,
559                                 const GURL& url,
560                                 const string16& title,
561                                 bool user_gesture);
562  void OnFindReply(int request_id,
563                   int number_of_matches,
564                   const gfx::Rect& selection_rect,
565                   int active_match_ordinal,
566                   bool final_update);
567#if defined(OS_ANDROID)
568  void OnFindMatchRectsReply(int version,
569                             const std::vector<gfx::RectF>& rects,
570                             const gfx::RectF& active_rect);
571
572  void OnOpenDateTimeDialog(
573      const ViewHostMsg_DateTimeDialogValue_Params& value);
574#endif
575  void OnCrashedPlugin(const base::FilePath& plugin_path,
576                       base::ProcessId plugin_pid);
577  void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
578  void OnOpenColorChooser(int color_chooser_id, SkColor color);
579  void OnEndColorChooser(int color_chooser_id);
580  void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
581  void OnPepperPluginHung(int plugin_child_id,
582                          const base::FilePath& path,
583                          bool is_hung);
584  void OnWebUISend(const GURL& source_url,
585                   const std::string& name,
586                   const base::ListValue& args);
587  void OnRequestPpapiBrokerPermission(int request_id,
588                                      const GURL& url,
589                                      const base::FilePath& plugin_path);
590  void OnBrowserPluginMessage(const IPC::Message& message);
591  void OnDidDownloadImage(int id,
592                          const GURL& image_url,
593                          int requested_size,
594                          const std::vector<SkBitmap>& bitmaps);
595  void OnUpdateFaviconURL(int32 page_id,
596                          const std::vector<FaviconURL>& candidates);
597  void OnFrameAttached(int64 parent_frame_id,
598                       int64 frame_id,
599                       const std::string& frame_name);
600  void OnFrameDetached(int64 parent_frame_id, int64 frame_id);
601
602  // Changes the IsLoading state and notifies delegate as needed
603  // |details| is used to provide details on the load that just finished
604  // (but can be null if not applicable). Can be overridden.
605  void SetIsLoading(bool is_loading,
606                    LoadNotificationDetails* details);
607
608  // Called by derived classes to indicate that we're no longer waiting for a
609  // response. This won't actually update the throbber, but it will get picked
610  // up at the next animation step if the throbber is going.
611  void SetNotWaitingForResponse() { waiting_for_response_ = false; }
612
613  // Navigation helpers --------------------------------------------------------
614  //
615  // These functions are helpers for Navigate() and DidNavigate().
616
617  // Handles post-navigation tasks in DidNavigate AFTER the entry has been
618  // committed to the navigation controller. Note that the navigation entry is
619  // not provided since it may be invalid/changed after being committed. The
620  // current navigation entry is in the NavigationController at this point.
621  void DidNavigateMainFramePostCommit(
622      const LoadCommittedDetails& details,
623      const ViewHostMsg_FrameNavigate_Params& params);
624  void DidNavigateAnyFramePostCommit(
625      RenderViewHost* render_view_host,
626      const LoadCommittedDetails& details,
627      const ViewHostMsg_FrameNavigate_Params& params);
628
629  // If our controller was restored, update the max page ID associated with the
630  // given RenderViewHost to be larger than the number of restored entries.
631  // This is called in CreateRenderView before any navigations in the RenderView
632  // have begun, to prevent any races in updating RenderView::next_page_id.
633  void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh);
634
635  // Saves the given title to the navigation entry and does associated work. It
636  // will update history and the view for the new title, and also synthesize
637  // titles for file URLs that have none (so we require that the URL of the
638  // entry already be set).
639  //
640  // This is used as the backend for state updates, which include a new title,
641  // or the dedicated set title message. It returns true if the new title is
642  // different and was therefore updated.
643  bool UpdateTitleForEntry(NavigationEntryImpl* entry,
644                           const string16& title);
645
646  // Causes the WebContentsImpl to navigate in the right renderer to |entry|,
647  // which must be already part of the entries in the navigation controller.
648  // This does not change the NavigationController state.
649  bool NavigateToEntry(const NavigationEntryImpl& entry,
650                       NavigationController::ReloadType reload_type);
651
652  // Sets the history for this WebContentsImpl to |history_length| entries, and
653  // moves the current page_id to the last entry in the list if it's valid.
654  // This is mainly used when a prerendered page is swapped into the current
655  // tab. The method is virtual for testing.
656  virtual void SetHistoryLengthAndPrune(
657      const SiteInstance* site_instance,
658      int merge_history_length,
659      int32 minimum_page_id);
660
661  // Recursively creates swapped out RenderViews for this tab's opener chain
662  // (including this tab) in the given SiteInstance, allowing other tabs to send
663  // cross-process JavaScript calls to their opener(s).  Returns the route ID of
664  // this tab's RenderView for |instance|.
665  int CreateOpenerRenderViews(SiteInstance* instance);
666
667  // Helper for CreateNewWidget/CreateNewFullscreenWidget.
668  void CreateNewWidget(int route_id,
669                       bool is_fullscreen,
670                       WebKit::WebPopupType popup_type);
671
672  // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
673  void ShowCreatedWidget(int route_id,
674                         bool is_fullscreen,
675                         const gfx::Rect& initial_pos);
676
677  // Finds the new RenderWidgetHost and returns it. Note that this can only be
678  // called once as this call also removes it from the internal map.
679  RenderWidgetHostView* GetCreatedWidget(int route_id);
680
681  // Finds the new WebContentsImpl by route_id, initializes it for
682  // renderer-initiated creation, and returns it. Note that this can only be
683  // called once as this call also removes it from the internal map.
684  WebContentsImpl* GetCreatedWindow(int route_id);
685
686  // Returns the RenderWidgetHostView that is associated with a native window
687  // and can be used in showing created widgets.
688  // If this WebContents belongs to a browser plugin guest, there is no native
689  // window 'view' associated with this WebContents. This method returns the
690  // 'view' of the embedder instead.
691  RenderWidgetHostViewPort* GetRenderWidgetHostViewPort() const;
692
693  // Misc non-view stuff -------------------------------------------------------
694
695  // Helper functions for sending notifications.
696  void NotifySwapped(RenderViewHost* old_render_view_host);
697  void NotifyConnected();
698  void NotifyDisconnected();
699
700  void SetEncoding(const std::string& encoding);
701
702  // Save a URL to the local filesystem.
703  void SaveURL(const GURL& url,
704               const Referrer& referrer,
705               bool is_main_frame);
706
707  RenderViewHostImpl* GetRenderViewHostImpl();
708
709  FrameTreeNode* FindFrameTreeNodeByID(int64 frame_id);
710
711  // Removes browser plugin embedder if there is one.
712  void RemoveBrowserPluginEmbedder();
713
714  // Data for core operation ---------------------------------------------------
715
716  // Delegate for notifying our owner about stuff. Not owned by us.
717  WebContentsDelegate* delegate_;
718
719  // Handles the back/forward list and loading.
720  NavigationControllerImpl controller_;
721
722  // The corresponding view.
723  scoped_ptr<WebContentsViewPort> view_;
724
725  // The view of the RVHD. Usually this is our WebContentsView implementation,
726  // but if an embedder uses a different WebContentsView, they'll need to
727  // provide this.
728  RenderViewHostDelegateView* render_view_host_delegate_view_;
729
730  // Tracks created WebContentsImpl objects that have not been shown yet. They
731  // are identified by the route ID passed to CreateNewWindow.
732  typedef std::map<int, WebContentsImpl*> PendingContents;
733  PendingContents pending_contents_;
734
735  // These maps hold on to the widgets that we created on behalf of the renderer
736  // that haven't shown yet.
737  typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
738  PendingWidgetViews pending_widget_views_;
739
740  // A list of observers notified when page state changes. Weak references.
741  // This MUST be listed above render_manager_ since at destruction time the
742  // latter might cause RenderViewHost's destructor to call us and we might use
743  // the observer list then.
744  ObserverList<WebContentsObserver> observers_;
745
746  // The tab that opened this tab, if any.  Will be set to null if the opener
747  // is closed.
748  WebContentsImpl* opener_;
749
750#if defined(OS_WIN) && defined(USE_AURA)
751  gfx::NativeViewAccessible accessible_parent_;
752#endif
753
754  // Helper classes ------------------------------------------------------------
755
756  // Manages creation and swapping of render views.
757  RenderViewHostManager render_manager_;
758
759#if defined(ENABLE_JAVA_BRIDGE)
760  // Manages injecting Java objects into all RenderViewHosts associated with
761  // this WebContentsImpl.
762  scoped_ptr<JavaBridgeDispatcherHostManager>
763      java_bridge_dispatcher_host_manager_;
764#endif
765
766  // SavePackage, lazily created.
767  scoped_refptr<SavePackage> save_package_;
768
769  // Data for loading state ----------------------------------------------------
770
771  // Indicates whether we're currently loading a resource.
772  bool is_loading_;
773
774  // Indicates if the tab is considered crashed.
775  base::TerminationStatus crashed_status_;
776  int crashed_error_code_;
777
778  // Whether this WebContents is waiting for a first-response for the
779  // main resource of the page. This controls whether the throbber state is
780  // "waiting" or "loading."
781  bool waiting_for_response_;
782
783  // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
784  // to a given tab and SiteInstance, and must be valid for the lifetime of the
785  // WebContentsImpl.
786  std::map<int32, int32> max_page_ids_;
787
788  // System time at which the current load was started.
789  base::TimeTicks current_load_start_;
790
791  // The current load state and the URL associated with it.
792  net::LoadStateWithParam load_state_;
793  string16 load_state_host_;
794  // Upload progress, for displaying in the status bar.
795  // Set to zero when there is no significant upload happening.
796  uint64 upload_size_;
797  uint64 upload_position_;
798
799  // Data for current page -----------------------------------------------------
800
801  // When a title cannot be taken from any entry, this title will be used.
802  string16 page_title_when_no_navigation_entry_;
803
804  // When a navigation occurs, we record its contents MIME type. It can be
805  // used to check whether we can do something for some special contents.
806  std::string contents_mime_type_;
807
808  // Character encoding.
809  std::string encoding_;
810
811  // True if this is a secure page which displayed insecure content.
812  bool displayed_insecure_content_;
813
814  // The frame tree structure of the current page.
815  scoped_ptr<FrameTreeNode> frame_tree_root_;
816
817  // Data for misc internal state ----------------------------------------------
818
819  // When > 0, the WebContents is currently being captured (e.g., for
820  // screenshots or mirroring); and the underlying RenderWidgetHost should not
821  // be told it is hidden.
822  int capturer_count_;
823
824  // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
825  bool should_normally_be_visible_;
826
827  // See getter above.
828  bool is_being_destroyed_;
829
830  // Indicates whether we should notify about disconnection of this
831  // WebContentsImpl. This is used to ensure disconnection notifications only
832  // happen if a connection notification has happened and that they happen only
833  // once.
834  bool notify_disconnection_;
835
836  // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
837  // delegate of this WebContentsImpl is nulled before its destructor is called.
838  JavaScriptDialogManager* dialog_manager_;
839
840  // Set to true when there is an active "before unload" dialog.  When true,
841  // we've forced the throbber to start in Navigate, and we need to remember to
842  // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
843  bool is_showing_before_unload_dialog_;
844
845  // Settings that get passed to the renderer process.
846  RendererPreferences renderer_preferences_;
847
848  // The time that we started to create the new tab page.
849  base::TimeTicks new_tab_start_time_;
850
851  // The time that we started to close this WebContents.
852  base::TimeTicks close_start_time_;
853
854  // The time when onbeforeunload ended.
855  base::TimeTicks before_unload_end_time_;
856
857  // The time that this tab was last selected.
858  base::TimeTicks last_selected_time_;
859
860  // See description above setter.
861  bool closed_by_user_gesture_;
862
863  // Minimum/maximum zoom percent.
864  int minimum_zoom_percent_;
865  int maximum_zoom_percent_;
866  // If true, the default zoom limits have been overriden for this tab, in which
867  // case we don't want saved settings to apply to it and we don't want to
868  // remember it.
869  bool temporary_zoom_settings_;
870
871  // The intrinsic size of the page.
872  gfx::Size preferred_size_;
873
874  // Content restrictions, used to disable print/copy etc based on content's
875  // (full-page plugins for now only) permissions.
876  int content_restrictions_;
877
878#if defined(OS_ANDROID)
879  // Date time chooser opened by this tab.
880  // Only used in Android since all other platforms use a multi field UI.
881  scoped_ptr<DateTimeChooserAndroid> date_time_chooser_;
882#endif
883
884  // Color chooser that was opened by this tab.
885  ColorChooser* color_chooser_;
886
887  // Manages the embedder state for browser plugins, if this WebContents is an
888  // embedder; NULL otherwise.
889  scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
890  // Manages the guest state for browser plugin, if this WebContents is a guest;
891  // NULL otherwise.
892  scoped_ptr<BrowserPluginGuest> browser_plugin_guest_;
893
894  // This must be at the end, or else we might get notifications and use other
895  // member variables that are gone.
896  NotificationRegistrar registrar_;
897
898  // Used during IPC message dispatching so that the handlers can get a pointer
899  // to the RVH through which the message was received.
900  RenderViewHost* message_source_;
901
902  // All live RenderWidgetHostImpls that are created by this object and may
903  // outlive it.
904  std::set<RenderWidgetHostImpl*> created_widgets_;
905
906  // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
907  int fullscreen_widget_routing_id_;
908
909  // Maps the ids of pending image downloads to their callbacks
910  typedef std::map<int, ImageDownloadCallback> ImageDownloadMap;
911  ImageDownloadMap image_download_map_;
912
913  DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
914};
915
916}  // namespace content
917
918#endif  // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
919