Change most of the methods of WebContentsObserver to take a content::WebContents instead of a TabContents, and update all the dependent code.

BUG=98716
Review URL: http://codereview.chromium.org/9022023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115664 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc
index 4bdf618..2ceb38e 100644
--- a/chrome/browser/extensions/extension_context_menu_model.cc
+++ b/chrome/browser/extensions/extension_context_menu_model.cc
@@ -15,6 +15,7 @@
 #include "chrome/common/extensions/extension_constants.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
+#include "content/browser/tab_contents/tab_contents.h"
 #include "grit/chromium_strings.h"
 #include "grit/generated_resources.h"
 #include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/extensions/extension_cookies_helpers.cc b/chrome/browser/extensions/extension_cookies_helpers.cc
index ed3ac61..296ddbd 100644
--- a/chrome/browser/extensions/extension_cookies_helpers.cc
+++ b/chrome/browser/extensions/extension_cookies_helpers.cc
@@ -18,6 +18,7 @@
 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
 #include "chrome/common/extensions/extension.h"
 #include "chrome/common/url_constants.h"
+#include "content/browser/tab_contents/tab_contents.h"
 #include "googleurl/src/gurl.h"
 #include "net/base/cookie_util.h"
 
diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc
index 1926aaba..cd70e74 100644
--- a/chrome/browser/extensions/extension_tab_id_map.cc
+++ b/chrome/browser/extensions/extension_tab_id_map.cc
@@ -20,6 +20,7 @@
 #include "content/public/browser/notification_types.h"
 
 using content::BrowserThread;
+using content::WebContents;
 
 //
 // ExtensionTabIdMap::TabObserver
@@ -98,12 +99,12 @@
     case chrome::NOTIFICATION_RETARGETING: {
       RetargetingDetails* retargeting_details =
           content::Details<RetargetingDetails>(details).ptr();
-      TabContents* contents = retargeting_details->target_tab_contents;
+      WebContents* contents = retargeting_details->target_web_contents;
       TabContentsWrapper* tab =
           TabContentsWrapper::GetCurrentWrapperForContents(contents);
       if (!tab)
         break;
-      RenderViewHost* host = tab->tab_contents()->GetRenderViewHost();
+      RenderViewHost* host = contents->GetRenderViewHost();
       BrowserThread::PostTask(
           BrowserThread::IO, FROM_HERE,
           base::Bind(
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 4c1f7cbb..4ab20a64 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -16,6 +16,8 @@
 namespace keys = extension_tabs_module_constants;
 namespace errors = extension_manifest_errors;
 
+using content::WebContents;
+
 int ExtensionTabUtil::GetWindowId(const Browser* browser) {
   return browser->session_id().id();
 }
@@ -31,9 +33,9 @@
 }
 
 // TODO(sky): this function should really take a TabContentsWrapper.
-int ExtensionTabUtil::GetTabId(const TabContents* tab_contents) {
+int ExtensionTabUtil::GetTabId(const WebContents* web_contents) {
   const TabContentsWrapper* tab =
-      TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
+      TabContentsWrapper::GetCurrentWrapperForContents(web_contents);
   return tab ? tab->restore_tab_helper()->session_id().id() : -1;
 }
 
diff --git a/chrome/browser/extensions/extension_tab_util.h b/chrome/browser/extensions/extension_tab_util.h
index 5638cbd..385f6ad 100644
--- a/chrome/browser/extensions/extension_tab_util.h
+++ b/chrome/browser/extensions/extension_tab_util.h
@@ -19,12 +19,16 @@
 class ListValue;
 }
 
+namespace content {
+class WebContents;
+}
+
 // Provides various utility functions that help manipulate tabs.
 class ExtensionTabUtil {
  public:
   static int GetWindowId(const Browser* browser);
   static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model);
-  static int GetTabId(const TabContents* tab_contents);
+  static int GetTabId(const content::WebContents* web_contents);
   static bool GetTabIdFromArgument(const base::ListValue &args,
                                    int argument_index,
                                    int *tab_id, std::string* error_message);
diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc
index 4644376..eb647e3 100644
--- a/chrome/browser/extensions/extension_webnavigation_api.cc
+++ b/chrome/browser/extensions/extension_webnavigation_api.cc
@@ -19,6 +19,7 @@
 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
 #include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/url_constants.h"
+#include "content/browser/renderer_host/render_view_host.h"
 #include "content/browser/tab_contents/tab_contents.h"
 #include "content/public/browser/navigation_details.h"
 #include "content/public/browser/notification_service.h"
@@ -27,9 +28,12 @@
 
 namespace keys = extension_webnavigation_api_constants;
 
+using content::BrowserContext;
+using content::WebContents;
+
 namespace {
 
-typedef std::map<TabContents*, ExtensionWebNavigationTabObserver*>
+typedef std::map<WebContents*, ExtensionWebNavigationTabObserver*>
     TabObserverMap;
 static base::LazyInstance<TabObserverMap> g_tab_observer =
     LAZY_INSTANCE_INITIALIZER;
@@ -59,7 +63,7 @@
 }
 
 // Dispatches events to the extension message service.
-void DispatchEvent(content::BrowserContext* browser_context,
+void DispatchEvent(BrowserContext* browser_context,
                    const char* event_name,
                    const std::string& json_args) {
   Profile* profile = Profile::FromBrowserContext(browser_context);
@@ -70,14 +74,13 @@
 }
 
 // Constructs and dispatches an onBeforeNavigate event.
-void DispatchOnBeforeNavigate(TabContents* tab_contents,
+void DispatchOnBeforeNavigate(WebContents* web_contents,
                               int64 frame_id,
                               bool is_main_frame,
                               const GURL& validated_url) {
   ListValue args;
   DictionaryValue* dict = new DictionaryValue();
-  dict->SetInteger(keys::kTabIdKey,
-                   ExtensionTabUtil::GetTabId(tab_contents));
+  dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents));
   dict->SetString(keys::kUrlKey, validated_url.spec());
   dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
   dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
@@ -85,7 +88,7 @@
 
   std::string json_args;
   base::JSONWriter::Write(&args, false, &json_args);
-  DispatchEvent(tab_contents->GetBrowserContext(),
+  DispatchEvent(web_contents->GetBrowserContext(),
                 keys::kOnBeforeNavigate,
                 json_args);
 }
@@ -93,15 +96,14 @@
 // Constructs and dispatches an onCommitted or onReferenceFragmentUpdated
 // event.
 void DispatchOnCommitted(const char* event_name,
-                         TabContents* tab_contents,
+                         WebContents* web_contents,
                          int64 frame_id,
                          bool is_main_frame,
                          const GURL& url,
                          content::PageTransition transition_type) {
   ListValue args;
   DictionaryValue* dict = new DictionaryValue();
-  dict->SetInteger(keys::kTabIdKey,
-                   ExtensionTabUtil::GetTabId(tab_contents));
+  dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents));
   dict->SetString(keys::kUrlKey, url.spec());
   dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
   dict->SetString(
@@ -122,18 +124,18 @@
 
   std::string json_args;
   base::JSONWriter::Write(&args, false, &json_args);
-  DispatchEvent(tab_contents->GetBrowserContext(), event_name, json_args);
+  DispatchEvent(web_contents->GetBrowserContext(), event_name, json_args);
 }
 
 // Constructs and dispatches an onDOMContentLoaded event.
-void DispatchOnDOMContentLoaded(TabContents* tab_contents,
+void DispatchOnDOMContentLoaded(WebContents* web_contents,
                                 const GURL& url,
                                 bool is_main_frame,
                                 int64 frame_id) {
   ListValue args;
   DictionaryValue* dict = new DictionaryValue();
   dict->SetInteger(keys::kTabIdKey,
-                   ExtensionTabUtil::GetTabId(tab_contents));
+                   ExtensionTabUtil::GetTabId(web_contents));
   dict->SetString(keys::kUrlKey, url.spec());
   dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
   dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
@@ -141,20 +143,20 @@
 
   std::string json_args;
   base::JSONWriter::Write(&args, false, &json_args);
-  DispatchEvent(tab_contents->GetBrowserContext(),
+  DispatchEvent(web_contents->GetBrowserContext(),
                 keys::kOnDOMContentLoaded,
                 json_args);
 }
 
 // Constructs and dispatches an onCompleted event.
-void DispatchOnCompleted(TabContents* tab_contents,
+void DispatchOnCompleted(WebContents* web_contents,
                          const GURL& url,
                          bool is_main_frame,
                          int64 frame_id) {
   ListValue args;
   DictionaryValue* dict = new DictionaryValue();
   dict->SetInteger(keys::kTabIdKey,
-                   ExtensionTabUtil::GetTabId(tab_contents));
+                   ExtensionTabUtil::GetTabId(web_contents));
   dict->SetString(keys::kUrlKey, url.spec());
   dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
   dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
@@ -162,34 +164,34 @@
 
   std::string json_args;
   base::JSONWriter::Write(&args, false, &json_args);
-  DispatchEvent(tab_contents->GetBrowserContext(),
+  DispatchEvent(web_contents->GetBrowserContext(),
                 keys::kOnCompleted, json_args);
 }
 
 // Constructs and dispatches an onCreatedNavigationTarget event.
 void DispatchOnCreatedNavigationTarget(
-    TabContents* tab_contents,
-    content::BrowserContext* browser_context,
+    WebContents* web_contents,
+    BrowserContext* browser_context,
     int64 source_frame_id,
     bool source_frame_is_main_frame,
-    TabContents* target_tab_contents,
+    WebContents* target_web_contents,
     const GURL& target_url) {
   // Check that the tab is already inserted into a tab strip model. This code
   // path is exercised by ExtensionApiTest.WebNavigationRequestOpenTab.
   DCHECK(ExtensionTabUtil::GetTabById(
-      ExtensionTabUtil::GetTabId(target_tab_contents),
-      Profile::FromBrowserContext(target_tab_contents->GetBrowserContext()),
+      ExtensionTabUtil::GetTabId(target_web_contents),
+      Profile::FromBrowserContext(target_web_contents->GetBrowserContext()),
       false, NULL, NULL, NULL, NULL));
 
   ListValue args;
   DictionaryValue* dict = new DictionaryValue();
   dict->SetInteger(keys::kSourceTabIdKey,
-                   ExtensionTabUtil::GetTabId(tab_contents));
+                   ExtensionTabUtil::GetTabId(web_contents));
   dict->SetInteger(keys::kSourceFrameIdKey,
       GetFrameId(source_frame_is_main_frame, source_frame_id));
   dict->SetString(keys::kUrlKey, target_url.possibly_invalid_spec());
   dict->SetInteger(keys::kTabIdKey,
-                   ExtensionTabUtil::GetTabId(target_tab_contents));
+                   ExtensionTabUtil::GetTabId(target_web_contents));
   dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
   args.Append(dict);
 
@@ -200,15 +202,14 @@
 }
 
 // Constructs and dispatches an onErrorOccurred event.
-void DispatchOnErrorOccurred(TabContents* tab_contents,
+void DispatchOnErrorOccurred(WebContents* web_contents,
                              const GURL& url,
                              int64 frame_id,
                              bool is_main_frame,
                              int error_code) {
   ListValue args;
   DictionaryValue* dict = new DictionaryValue();
-  dict->SetInteger(keys::kTabIdKey,
-                   ExtensionTabUtil::GetTabId(tab_contents));
+  dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents));
   dict->SetString(keys::kUrlKey, url.spec());
   dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
   dict->SetString(keys::kErrorKey, net::ErrorToString(error_code));
@@ -217,7 +218,7 @@
 
   std::string json_args;
   base::JSONWriter::Write(&args, false, &json_args);
-  DispatchEvent(tab_contents->GetBrowserContext(),
+  DispatchEvent(web_contents->GetBrowserContext(),
                 keys::kOnErrorOccurred,
                 json_args);
 }
@@ -342,28 +343,28 @@
 
 // ExtensionWebNavigtionEventRouter -------------------------------------------
 
-ExtensionWebNavigationEventRouter::PendingTabContents::PendingTabContents()
-    : source_tab_contents(NULL),
+ExtensionWebNavigationEventRouter::PendingWebContents::PendingWebContents()
+    : source_web_contents(NULL),
       source_frame_id(0),
       source_frame_is_main_frame(false),
-      target_tab_contents(NULL),
+      target_web_contents(NULL),
       target_url() {
 }
 
-ExtensionWebNavigationEventRouter::PendingTabContents::PendingTabContents(
-    TabContents* source_tab_contents,
+ExtensionWebNavigationEventRouter::PendingWebContents::PendingWebContents(
+    WebContents* source_web_contents,
     int64 source_frame_id,
     bool source_frame_is_main_frame,
-    TabContents* target_tab_contents,
+    WebContents* target_web_contents,
     const GURL& target_url)
-    : source_tab_contents(source_tab_contents),
+    : source_web_contents(source_web_contents),
       source_frame_id(source_frame_id),
       source_frame_is_main_frame(source_frame_is_main_frame),
-      target_tab_contents(target_tab_contents),
+      target_web_contents(target_web_contents),
       target_url(target_url) {
 }
 
-ExtensionWebNavigationEventRouter::PendingTabContents::~PendingTabContents() {}
+ExtensionWebNavigationEventRouter::PendingWebContents::~PendingWebContents() {}
 
 ExtensionWebNavigationEventRouter::ExtensionWebNavigationEventRouter(
     Profile* profile) : profile_(profile) {}
@@ -412,10 +413,10 @@
   if (details->source_frame_id == 0)
     return;
   ExtensionWebNavigationTabObserver* tab_observer =
-      ExtensionWebNavigationTabObserver::Get(details->source_tab_contents);
+      ExtensionWebNavigationTabObserver::Get(details->source_web_contents);
   if (!tab_observer) {
-    CHECK(details->source_tab_contents->GetRenderViewType() !=
-          content::VIEW_TYPE_TAB_CONTENTS);
+    CHECK(details->source_web_contents->GetRenderViewHost()->delegate()->
+          GetRenderViewType() != content::VIEW_TYPE_TAB_CONTENTS);
     return;
   }
   const FrameNavigationState& frame_navigation_state =
@@ -424,54 +425,53 @@
   if (!frame_navigation_state.CanSendEvents(details->source_frame_id))
     return;
 
-  // If the TabContents was created as a response to an IPC from a renderer
+  // If the WebContents was created as a response to an IPC from a renderer
   // (and therefore doesn't yet have a wrapper), or if it isn't yet inserted
   // into a tab strip, we need to delay the extension event until the
-  // TabContents is fully initialized.
+  // WebContents is fully initialized.
   if ((TabContentsWrapper::GetCurrentWrapperForContents(
-       details->target_tab_contents) == NULL) ||
+       details->target_web_contents) == NULL) ||
       details->not_yet_in_tabstrip) {
-    pending_tab_contents_[details->target_tab_contents] =
-        PendingTabContents(
-            details->source_tab_contents,
+    pending_web_contents_[details->target_web_contents] =
+        PendingWebContents(
+            details->source_web_contents,
             details->source_frame_id,
             frame_navigation_state.IsMainFrame(details->source_frame_id),
-            details->target_tab_contents,
+            details->target_web_contents,
             details->target_url);
   } else {
     DispatchOnCreatedNavigationTarget(
-        details->source_tab_contents,
-        details->target_tab_contents->GetBrowserContext(),
+        details->source_web_contents,
+        details->target_web_contents->GetBrowserContext(),
         details->source_frame_id,
         frame_navigation_state.IsMainFrame(details->source_frame_id),
-        details->target_tab_contents,
+        details->target_web_contents,
         details->target_url);
   }
 }
 
-void ExtensionWebNavigationEventRouter::TabAdded(TabContents* tab_contents) {
-  std::map<TabContents*, PendingTabContents>::iterator iter =
-      pending_tab_contents_.find(tab_contents);
-  if (iter == pending_tab_contents_.end())
+void ExtensionWebNavigationEventRouter::TabAdded(WebContents* tab) {
+  std::map<WebContents*, PendingWebContents>::iterator iter =
+      pending_web_contents_.find(tab);
+  if (iter == pending_web_contents_.end())
     return;
 
   DispatchOnCreatedNavigationTarget(
-      iter->second.source_tab_contents,
-      iter->second.target_tab_contents->GetBrowserContext(),
+      iter->second.source_web_contents,
+      iter->second.target_web_contents->GetBrowserContext(),
       iter->second.source_frame_id,
       iter->second.source_frame_is_main_frame,
-      iter->second.target_tab_contents,
+      iter->second.target_web_contents,
       iter->second.target_url);
-  pending_tab_contents_.erase(iter);
+  pending_web_contents_.erase(iter);
 }
 
-void ExtensionWebNavigationEventRouter::TabDestroyed(
-    TabContents* tab_contents) {
-  pending_tab_contents_.erase(tab_contents);
-  for (std::map<TabContents*, PendingTabContents>::iterator i =
-           pending_tab_contents_.begin(); i != pending_tab_contents_.end(); ) {
-    if (i->second.source_tab_contents == tab_contents)
-      pending_tab_contents_.erase(i++);
+void ExtensionWebNavigationEventRouter::TabDestroyed(WebContents* tab) {
+  pending_web_contents_.erase(tab);
+  for (std::map<WebContents*, PendingWebContents>::iterator i =
+           pending_web_contents_.begin(); i != pending_web_contents_.end(); ) {
+    if (i->second.source_web_contents == tab)
+      pending_web_contents_.erase(i++);
     else
       ++i;
   }
@@ -480,17 +480,17 @@
 // ExtensionWebNavigationTabObserver ------------------------------------------
 
 ExtensionWebNavigationTabObserver::ExtensionWebNavigationTabObserver(
-    TabContents* tab_contents)
-    : content::WebContentsObserver(tab_contents) {
-  g_tab_observer.Get().insert(TabObserverMap::value_type(tab_contents, this));
+    WebContents* web_contents)
+    : WebContentsObserver(web_contents) {
+  g_tab_observer.Get().insert(TabObserverMap::value_type(web_contents, this));
 }
 
 ExtensionWebNavigationTabObserver::~ExtensionWebNavigationTabObserver() {}
 
 // static
 ExtensionWebNavigationTabObserver* ExtensionWebNavigationTabObserver::Get(
-    TabContents* tab_contents) {
-  TabObserverMap::iterator i = g_tab_observer.Get().find(tab_contents);
+    WebContents* web_contents) {
+  TabObserverMap::iterator i = g_tab_observer.Get().find(web_contents);
   return i == g_tab_observer.Get().end() ? NULL : i->second;
 }
 
@@ -598,7 +598,7 @@
 }
 
 void ExtensionWebNavigationTabObserver::DidOpenRequestedURL(
-    TabContents* new_contents,
+    WebContents* new_contents,
     const GURL& url,
     const content::Referrer& referrer,
     WindowOpenDisposition disposition,
@@ -626,8 +626,7 @@
       url);
 }
 
-void ExtensionWebNavigationTabObserver::TabContentsDestroyed(
-    TabContents* tab) {
+void ExtensionWebNavigationTabObserver::WebContentsDestroyed(WebContents* tab) {
   g_tab_observer.Get().erase(tab);
   for (FrameNavigationState::const_iterator frame = navigation_state_.begin();
        frame != navigation_state_.end(); ++frame) {
diff --git a/chrome/browser/extensions/extension_webnavigation_api.h b/chrome/browser/extensions/extension_webnavigation_api.h
index 43953c5..9d184f1 100644
--- a/chrome/browser/extensions/extension_webnavigation_api.h
+++ b/chrome/browser/extensions/extension_webnavigation_api.h
@@ -21,7 +21,6 @@
 #include "googleurl/src/gurl.h"
 
 struct RetargetingDetails;
-class TabContents;
 
 // Tracks the navigation state of all frames in a given tab currently known to
 // the webNavigation API. It is mainly used to track in which frames an error
@@ -117,11 +116,13 @@
 // Tab contents observer that forwards navigation events to the event router.
 class ExtensionWebNavigationTabObserver : public content::WebContentsObserver {
  public:
-  explicit ExtensionWebNavigationTabObserver(TabContents* tab_contents);
+  explicit ExtensionWebNavigationTabObserver(
+      content::WebContents* web_contents);
   virtual ~ExtensionWebNavigationTabObserver();
 
   // Returns the object for the given |tab_contents|.
-  static ExtensionWebNavigationTabObserver* Get(TabContents* tab_contents);
+  static ExtensionWebNavigationTabObserver* Get(
+      content::WebContents* web_contents);
 
   const FrameNavigationState& frame_navigation_state() const {
     return navigation_state_;
@@ -149,13 +150,13 @@
   virtual void DidFinishLoad(int64 frame_id,
                              const GURL& validated_url,
                              bool is_main_frame) OVERRIDE;
-  virtual void DidOpenRequestedURL(TabContents* new_contents,
+  virtual void DidOpenRequestedURL(content::WebContents* new_contents,
                                    const GURL& url,
                                    const content::Referrer& referrer,
                                    WindowOpenDisposition disposition,
                                    content::PageTransition transition,
                                    int64 source_frame_id) OVERRIDE;
-  virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE;
+  virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
 
  private:
   // True if the transition and target url correspond to a reference fragment
@@ -180,20 +181,20 @@
   void Init();
 
  private:
-  // Used to cache the information about newly created TabContents objects.
-  struct PendingTabContents {
-    PendingTabContents();
-    PendingTabContents(TabContents* source_tab_contents,
+  // Used to cache the information about newly created WebContents objects.
+  struct PendingWebContents{
+    PendingWebContents();
+    PendingWebContents(content::WebContents* source_web_contents,
                        int64 source_frame_id,
                        bool source_frame_is_main_frame,
-                       TabContents* target_tab_contents,
+                       content::WebContents* target_web_contents,
                        const GURL& target_url);
-    ~PendingTabContents();
+    ~PendingWebContents();
 
-    TabContents* source_tab_contents;
+    content::WebContents* source_web_contents;
     int64 source_frame_id;
     bool source_frame_is_main_frame;
-    TabContents* target_tab_contents;
+    content::WebContents* target_web_contents;
     GURL target_url;
   };
 
@@ -209,15 +210,15 @@
 
   // Handler for the NOTIFICATION_TAB_ADDED event. The method takes the details
   // of such an event and creates a JSON formated extension event from it.
-  void TabAdded(TabContents* tab_contents);
+  void TabAdded(content::WebContents* tab);
 
-  // Handler for NOTIFICATION_TAB_CONTENTS_DESTROYED. If |tab_contents| is
-  // in |pending_tab_contents_|, it is removed.
-  void TabDestroyed(TabContents* tab_contents);
+  // Handler for NOTIFICATION_TAB_CONTENTS_DESTROYED. If |tab| is in
+  // |pending_web_contents_|, it is removed.
+  void TabDestroyed(content::WebContents* tab);
 
-  // Mapping pointers to TabContents objects to information about how they got
+  // Mapping pointers to WebContents objects to information about how they got
   // created.
-  std::map<TabContents*, PendingTabContents> pending_tab_contents_;
+  std::map<content::WebContents*, PendingWebContents> pending_web_contents_;
 
   // Used for tracking registrations to navigation notifications.
   content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc
index 5fdc9ab..b58a652 100644
--- a/chrome/browser/extensions/webstore_inline_installer.cc
+++ b/chrome/browser/extensions/webstore_inline_installer.cc
@@ -26,6 +26,7 @@
 #include "net/url_request/url_request_status.h"
 
 using content::BrowserThread;
+using content::WebContents;
 
 const char kManifestKey[] = "manifest";
 const char kIconUrlKey[] = "icon_url";
@@ -144,12 +145,12 @@
   scoped_ptr<DictionaryValue> parsed_webstore_data_;
 };
 
-WebstoreInlineInstaller::WebstoreInlineInstaller(TabContents* tab_contents,
+WebstoreInlineInstaller::WebstoreInlineInstaller(WebContents* web_contents,
                                                  int install_id,
                                                  std::string webstore_item_id,
                                                  GURL requestor_url,
                                                  Delegate* delegate)
-    : content::WebContentsObserver(tab_contents),
+    : content::WebContentsObserver(web_contents),
       install_id_(install_id),
       id_(webstore_item_id),
       requestor_url_(requestor_url),
@@ -161,7 +162,7 @@
 }
 
 void WebstoreInlineInstaller::BeginInstall() {
-  AddRef(); // Balanced in CompleteInstall or TabContentsDestroyed.
+  AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed.
 
   if (!Extension::IdIsValid(id_)) {
     CompleteInstall(kInvalidWebstoreItemId);
@@ -189,8 +190,8 @@
 void WebstoreInlineInstaller::OnURLFetchComplete(
     const content::URLFetcher* source) {
   CHECK_EQ(webstore_data_url_fetcher_.get(), source);
-  // We shouldn't be getting UrlFetcher callbacks if the TabContents has gone
-  // away; we stop any in in-progress fetches in TabContentsDestroyed.
+  // We shouldn't be getting UrlFetcher callbacks if the WebContents has gone
+  // away; we stop any in in-progress fetches in WebContentsDestroyed.
   CHECK(tab_contents());
 
   if (!webstore_data_url_fetcher_->GetStatus().is_success() ||
@@ -403,7 +404,7 @@
   CompleteInstall(kUserCancelledError);
 }
 
-void WebstoreInlineInstaller::TabContentsDestroyed(TabContents* tab_contents) {
+void WebstoreInlineInstaller::WebContentsDestroyed(WebContents* web_contents) {
   // Abort any in-progress fetches.
   if (webstore_data_url_fetcher_.get()) {
     webstore_data_url_fetcher_.reset();
diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h
index c7c0595..96aedfb 100644
--- a/chrome/browser/extensions/webstore_inline_installer.h
+++ b/chrome/browser/extensions/webstore_inline_installer.h
@@ -19,14 +19,13 @@
 #include "googleurl/src/gurl.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 
-class TabContents;
 class SafeWebstoreResponseParser;
 
 // Manages inline installs requested by a page (downloads and parses metadata
 // from the webstore, shows the install UI, starts the download once the user
 // confirms).  Clients must implement the WebstoreInlineInstaller::Delegate
 // interface to be notified when the inline install completes (successfully or
-// not). The client will not be notified if the TabContents that this install
+// not). The client will not be notified if the WebContents that this install
 // request is attached to goes away.
 class WebstoreInlineInstaller
     : public base::RefCountedThreadSafe<WebstoreInlineInstaller>,
@@ -43,7 +42,7 @@
                                         const std::string& error) = 0;
   };
 
-  WebstoreInlineInstaller(TabContents* tab_contents,
+  WebstoreInlineInstaller(content::WebContents* web_contents,
                           int install_id,
                           std::string webstore_item_id,
                           GURL requestor_url,
@@ -91,7 +90,8 @@
   virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
 
   // content::WebContentsObserver interface implementation.
-  virtual void TabContentsDestroyed(TabContents* tab_contents) OVERRIDE;
+  virtual void WebContentsDestroyed(
+      content::WebContents* web_contents) OVERRIDE;
 
   // WebstoreInstaller::Delegate interface implementation.
   virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;