Remove extension.h #include from profile.h.

Touching extension.h now results in 202 files being compiled instead of 495 (when
building the chrome target). Required that the UnloadedExtensionReason enum be
moved to extension_constants.h.

[email protected]


Review URL: http://codereview.chromium.org/7633029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96686 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/automation/automation_extension_tracker.cc b/chrome/browser/automation/automation_extension_tracker.cc
index 9c75c7a..6ba03ab 100644
--- a/chrome/browser/automation/automation_extension_tracker.cc
+++ b/chrome/browser/automation/automation_extension_tracker.cc
@@ -7,6 +7,7 @@
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "content/common/notification_service.h"
 
 AutomationExtensionTracker::AutomationExtensionTracker(
@@ -35,7 +36,7 @@
   Profile* profile = Source<Profile>(source).ptr();
   if (profile) {
     ExtensionService* service = profile->GetExtensionService();
-    if (service && info->reason == UnloadedExtensionInfo::UNINSTALL) {
+    if (service && info->reason == extension_misc::UNLOAD_REASON_UNINSTALL) {
       // Remove this extension only if it is uninstalled, not just disabled.
       CloseResource(extension);
     }
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index 9ec28ec..bc3e606 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -24,6 +24,7 @@
 #include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "chrome/common/pref_names.h"
 #include "content/browser/renderer_host/render_view_host.h"
 #include "content/browser/site_instance.h"
@@ -292,13 +293,14 @@
     }
     case chrome::NOTIFICATION_EXTENSION_UNLOADED:
       switch (Details<UnloadedExtensionInfo>(details)->reason) {
-        case UnloadedExtensionInfo::DISABLE:  // Intentionally fall through.
-        case UnloadedExtensionInfo::UNINSTALL:
+        // Intentionally fall through.
+        case extension_misc::UNLOAD_REASON_DISABLE:
+        case extension_misc::UNLOAD_REASON_UNINSTALL:
           ShutdownAssociatedBackgroundContents(
               ASCIIToUTF16(
                   Details<UnloadedExtensionInfo>(details)->extension->id()));
           break;
-        case UnloadedExtensionInfo::UPDATE: {
+        case extension_misc::UNLOAD_REASON_UPDATE: {
           // If there is a manifest specified background page, then shut it down
           // here, since if the updated extension still has the background page,
           // then it will be loaded from LOADED callback. Otherwise, leave
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index d0b2903..7b56929 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -10,6 +10,7 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_list.h"
 #include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/extension.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/browser/renderer_host/render_view_host.h"
 #include "content/browser/tab_contents/tab_contents.h"
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index ae2d148..b6ca886 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -306,7 +306,7 @@
 
 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) {
   ExtensionService* service = browser()->profile()->GetExtensionService();
-  service->UnloadExtension(extension_id, UnloadedExtensionInfo::DISABLE);
+  service->UnloadExtension(extension_id, extension_misc::UNLOAD_REASON_DISABLE);
 }
 
 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) {
diff --git a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
index bdcdfbd4..6dbd444 100644
--- a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
+++ b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
@@ -162,8 +162,8 @@
   } else {
     DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type);
     UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr();
-    if (info->reason == UnloadedExtensionInfo::DISABLE ||
-        info->reason == UnloadedExtensionInfo::UNINSTALL)
+    if (info->reason == extension_misc::UNLOAD_REASON_DISABLE ||
+        info->reason == extension_misc::UNLOAD_REASON_UNINSTALL)
       extension = info->extension;
   }
   if (extension == extension_)
diff --git a/chrome/browser/extensions/extension_info_map.cc b/chrome/browser/extensions/extension_info_map.cc
index 4e16420..29462cc2 100644
--- a/chrome/browser/extensions/extension_info_map.cc
+++ b/chrome/browser/extensions/extension_info_map.cc
@@ -52,15 +52,15 @@
 }
 
 void ExtensionInfoMap::RemoveExtension(const std::string& extension_id,
-    const UnloadedExtensionInfo::Reason reason) {
+    const extension_misc::UnloadedExtensionReason reason) {
   CheckOnValidThread();
   const Extension* extension = extensions_.GetByID(extension_id);
   extra_data_.erase(extension_id);  // we don't care about disabled extra data
   if (extension) {
-    if (reason == UnloadedExtensionInfo::DISABLE)
+    if (reason == extension_misc::UNLOAD_REASON_DISABLE)
       disabled_extensions_.Insert(extension);
     extensions_.Remove(extension_id);
-  } else if (reason != UnloadedExtensionInfo::DISABLE) {
+  } else if (reason != extension_misc::UNLOAD_REASON_DISABLE) {
     // If the extension was uninstalled, make sure it's removed from the map of
     // disabled extensions.
     disabled_extensions_.Remove(extension_id);
diff --git a/chrome/browser/extensions/extension_info_map.h b/chrome/browser/extensions/extension_info_map.h
index 63a6346a..f8fe68efb 100644
--- a/chrome/browser/extensions/extension_info_map.h
+++ b/chrome/browser/extensions/extension_info_map.h
@@ -11,7 +11,7 @@
 #include "base/basictypes.h"
 #include "base/time.h"
 #include "base/memory/ref_counted.h"
-#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "chrome/common/extensions/extension_set.h"
 
 class Extension;
@@ -36,7 +36,7 @@
 
   // Callback for when an extension is unloaded.
   void RemoveExtension(const std::string& extension_id,
-                       const UnloadedExtensionInfo::Reason reason);
+                       const extension_misc::UnloadedExtensionReason reason);
 
   // Returns the time the extension was installed, or base::Time() if not found.
   base::Time GetInstallTime(const std::string& extension_id) const;
diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc
index 5df0bd1..8bba598 100644
--- a/chrome/browser/extensions/extension_info_map_unittest.cc
+++ b/chrome/browser/extensions/extension_info_map_unittest.cc
@@ -94,7 +94,8 @@
   EXPECT_TRUE(weak_extension1->HasOneRef());
 
   // Remove extension2, and the extension2 object should have the only ref.
-  info_map->RemoveExtension(extension2->id(), UnloadedExtensionInfo::UNINSTALL);
+  info_map->RemoveExtension(
+      extension2->id(), extension_misc::UNLOAD_REASON_UNINSTALL);
   EXPECT_TRUE(extension2->HasOneRef());
 
   // Delete the info map, and the extension3 object should have the only ref.
diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc
index ca8cdd78..a70ce42 100644
--- a/chrome/browser/extensions/extension_menu_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc
@@ -331,7 +331,8 @@
 
   // Notify that the extension was unloaded, and make sure the right item is
   // gone.
-  UnloadedExtensionInfo details(extension1, UnloadedExtensionInfo::DISABLE);
+  UnloadedExtensionInfo details(
+      extension1, extension_misc::UNLOAD_REASON_DISABLE);
   notifier->Notify(chrome::NOTIFICATION_EXTENSION_UNLOADED,
                    Source<Profile>(NULL),
                    Details<UnloadedExtensionInfo>(&details));
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index a4d04c93..8328edcb 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -869,7 +869,7 @@
 
   // Unload before doing more cleanup to ensure that nothing is hanging on to
   // any of these resources.
-  UnloadExtension(extension_id, UnloadedExtensionInfo::UNINSTALL);
+  UnloadExtension(extension_id, extension_misc::UNLOAD_REASON_UNINSTALL);
 
   extension_prefs_->OnExtensionUninstalled(extension_id, location,
                                            external_uninstall);
@@ -987,7 +987,7 @@
     terminated_extensions_.erase(iter);
   }
 
-  NotifyExtensionUnloaded(extension, UnloadedExtensionInfo::DISABLE);
+  NotifyExtensionUnloaded(extension, extension_misc::UNLOAD_REASON_DISABLE);
 }
 
 void ExtensionService::GrantPermissions(const Extension* extension) {
@@ -1125,7 +1125,7 @@
     LOG(ERROR) << "Failed to get extension id";
     return;
   }
-  UnloadExtension(id, UnloadedExtensionInfo::DISABLE);
+  UnloadExtension(id, extension_misc::UNLOAD_REASON_DISABLE);
 }
 
 void ExtensionService::LoadAllExtensions() {
@@ -1481,7 +1481,8 @@
 }
 
 void ExtensionService::NotifyExtensionUnloaded(
-    const Extension* extension, UnloadedExtensionInfo::Reason reason) {
+    const Extension* extension,
+    extension_misc::UnloadedExtensionReason reason) {
   UnloadedExtensionInfo details(extension, reason);
   NotificationService::current()->Notify(
       chrome::NOTIFICATION_EXTENSION_UNLOADED,
@@ -1568,7 +1569,7 @@
   // UnloadExtension will change the extensions_ list. So, we should
   // call it outside the iterator loop.
   for (unsigned int i = 0; i < to_be_removed.size(); ++i) {
-    UnloadExtension(to_be_removed[i], UnloadedExtensionInfo::DISABLE);
+    UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE);
   }
 }
 
@@ -1606,7 +1607,7 @@
   // UnloadExtension will change the extensions_ list. So, we should
   // call it outside the iterator loop.
   for (unsigned int i = 0; i < to_be_removed.size(); ++i)
-    UnloadExtension(to_be_removed[i], UnloadedExtensionInfo::DISABLE);
+    UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE);
 }
 
 void ExtensionService::CheckForUpdatesSoon() {
@@ -1750,7 +1751,8 @@
   // reload it to update UI.
   const Extension* enabled_extension = GetExtensionById(extension_id, false);
   if (enabled_extension) {
-    NotifyExtensionUnloaded(enabled_extension, UnloadedExtensionInfo::DISABLE);
+    NotifyExtensionUnloaded(
+        enabled_extension, extension_misc::UNLOAD_REASON_DISABLE);
     NotifyExtensionLoaded(enabled_extension);
   }
 }
@@ -1874,7 +1876,7 @@
 
 void ExtensionService::UnloadExtension(
     const std::string& extension_id,
-    UnloadedExtensionInfo::Reason reason) {
+    extension_misc::UnloadedExtensionReason reason) {
   // Make sure the extension gets deleted after we return from this function.
   scoped_refptr<const Extension> extension(
       GetExtensionByIdInternal(extension_id, true, true, false));
@@ -2117,7 +2119,7 @@
 
     // To upgrade an extension in place, unload the old one and
     // then load the new one.
-    UnloadExtension(old->id(), UnloadedExtensionInfo::UPDATE);
+    UnloadExtension(old->id(), extension_misc::UNLOAD_REASON_UPDATE);
     old = NULL;
   }
 
@@ -2268,7 +2270,7 @@
   if (terminated_extension_ids_.insert(extension->id()).second)
     terminated_extensions_.push_back(make_scoped_refptr(extension));
 
-  UnloadExtension(extension->id(), UnloadedExtensionInfo::DISABLE);
+  UnloadExtension(extension->id(), extension_misc::UNLOAD_REASON_DISABLE);
 }
 
 void ExtensionService::UntrackTerminatedExtension(const std::string& id) {
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 5327e7c..f3ce586 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -34,7 +34,7 @@
 #include "chrome/browser/extensions/pending_extension_manager.h"
 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
 #include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "content/browser/browser_thread.h"
 #include "content/common/notification_observer.h"
 #include "content/common/notification_registrar.h"
@@ -358,7 +358,7 @@
 
   // Unload the specified extension.
   void UnloadExtension(const std::string& extension_id,
-                       UnloadedExtensionInfo::Reason reason);
+                       extension_misc::UnloadedExtensionReason reason);
 
   // Unload all extensions. This is currently only called on shutdown, and
   // does not send notifications.
@@ -613,7 +613,7 @@
 
   // Handles sending notification that |extension| was unloaded.
   void NotifyExtensionUnloaded(const Extension* extension,
-                               UnloadedExtensionInfo::Reason reason);
+                               extension_misc::UnloadedExtensionReason reason);
 
   // Helper that updates the active extension list used for crash reporting.
   void UpdateActiveExtensionsInCrashReporter();
diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc
index 7de7e8e4..7dadf12 100644
--- a/chrome/browser/extensions/image_loading_tracker_unittest.cc
+++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc
@@ -162,7 +162,7 @@
 
   // Send out notification the extension was uninstalled.
   UnloadedExtensionInfo details(extension.get(),
-                                UnloadedExtensionInfo::UNINSTALL);
+                                extension_misc::UNLOAD_REASON_UNINSTALL);
   NotificationService::current()->Notify(
       chrome::NOTIFICATION_EXTENSION_UNLOADED,
       NotificationService::AllSources(),
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index 9d8064d..c0ee550 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -168,7 +168,7 @@
   void UnloadTestExtension() {
     ASSERT_FALSE(service_->extensions()->empty());
     service_->UnloadExtension(service_->extensions()->at(0)->id(),
-                              UnloadedExtensionInfo::DISABLE);
+                              extension_misc::UNLOAD_REASON_DISABLE);
   }
 
   scoped_refptr<UserScriptListener> listener_;
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index c7e111a..e7c28365 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -13,7 +13,7 @@
 #include "base/basictypes.h"
 #include "base/logging.h"
 #include "chrome/browser/net/preconnect.h" // TODO: remove this.
-#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "content/browser/browser_context.h"
 
 namespace base {
@@ -382,7 +382,7 @@
   // EXTENSION_UNLOADED notification have finished running.
   virtual void UnregisterExtensionWithRequestContexts(
       const std::string& extension_id,
-      const UnloadedExtensionInfo::Reason) {}
+      const extension_misc::UnloadedExtensionReason) {}
 
   // Returns the SSLConfigService for this profile.
   virtual net::SSLConfigService* GetSSLConfigService() = 0;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index a7f2ac7..d6a40ecc 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -993,7 +993,7 @@
 
 void ProfileImpl::UnregisterExtensionWithRequestContexts(
     const std::string& extension_id,
-    const UnloadedExtensionInfo::Reason reason) {
+    const extension_misc::UnloadedExtensionReason reason) {
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
       NewRunnableMethod(extension_info_map_.get(),
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index da1d672e..b37baa08 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -92,7 +92,7 @@
   virtual void RegisterExtensionWithRequestContexts(const Extension* extension);
   virtual void UnregisterExtensionWithRequestContexts(
       const std::string& extension_id,
-      const UnloadedExtensionInfo::Reason reason);
+      const extension_misc::UnloadedExtensionReason reason);
   virtual net::SSLConfigService* GetSSLConfigService();
   virtual HostContentSettingsMap* GetHostContentSettingsMap();
   virtual HostZoomMap* GetHostZoomMap();
diff --git a/chrome/browser/sync/glue/app_change_processor.cc b/chrome/browser/sync/glue/app_change_processor.cc
index f8e69a8b..e8f4009c 100644
--- a/chrome/browser/sync/glue/app_change_processor.cc
+++ b/chrome/browser/sync/glue/app_change_processor.cc
@@ -17,6 +17,7 @@
 #include "chrome/browser/sync/unrecoverable_error_handler.h"
 #include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "content/browser/browser_thread.h"
 #include "content/common/notification_details.h"
 #include "content/common/notification_source.h"
@@ -71,7 +72,7 @@
   if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
     const UnloadedExtensionInfo& info =
         *Details<UnloadedExtensionInfo>(details).ptr();
-    if (info.reason == UnloadedExtensionInfo::UNINSTALL) {
+    if (info.reason == extension_misc::UNLOAD_REASON_UNINSTALL) {
       VLOG(1) << "Removing server data for uninstalled extension " << id
               << " of type " << info.extension->GetType();
       RemoveServerData(traits_, id, share_handle());
diff --git a/chrome/browser/sync/glue/extension_change_processor.cc b/chrome/browser/sync/glue/extension_change_processor.cc
index 6d97dc4..71043a0b 100644
--- a/chrome/browser/sync/glue/extension_change_processor.cc
+++ b/chrome/browser/sync/glue/extension_change_processor.cc
@@ -17,6 +17,7 @@
 #include "chrome/browser/sync/unrecoverable_error_handler.h"
 #include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "content/browser/browser_thread.h"
 #include "content/common/notification_details.h"
 #include "content/common/notification_source.h"
@@ -71,7 +72,7 @@
   if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
     const UnloadedExtensionInfo& info =
         *Details<UnloadedExtensionInfo>(details).ptr();
-    if (info.reason == UnloadedExtensionInfo::UNINSTALL) {
+    if (info.reason == extension_misc::UNLOAD_REASON_UNINSTALL) {
       VLOG(1) << "Removing server data for uninstalled extension " << id
               << " of type " << info.extension->GetType();
       RemoveServerData(traits_, id, share_handle());
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper_synced_tab_delegate.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper_synced_tab_delegate.cc
index 2c728073..124b7e0 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper_synced_tab_delegate.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper_synced_tab_delegate.cc
@@ -9,6 +9,7 @@
 #include "chrome/browser/extensions/extension_tab_helper.h"
 #include "chrome/browser/sessions/restore_tab_helper.h"
 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/extensions/extension.h"
 
 
 TabContentsWrapperSyncedTabDelegate::TabContentsWrapperSyncedTabDelegate(