[go: nahoru, domu]

Move clients of BrowserContextKeyedService to using KeyedService (#3)

This CL moves the following clients of BCKS to using the KeyedService
component:

- //apps
- //chrome/browser/apps
- //chrome/browser/chromeos
- //chrome/browser/managed_mode

BUG=351704
TBR=yoz,jochen

Review URL: https://codereview.chromium.org/197733002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256756 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/apps/DEPS b/apps/DEPS
index ad5183e..4f3f455 100644
--- a/apps/DEPS
+++ b/apps/DEPS
@@ -4,6 +4,7 @@
   "+content/public/common",
   "+content/public/test",
   "+components/browser_context_keyed_service",
+  "+components/keyed_service",
   "+components/user_prefs/pref_registry_syncable.h",
   "+components/web_modal",
   "+extensions",
diff --git a/apps/app_lifetime_monitor.h b/apps/app_lifetime_monitor.h
index 45ab09aa..fe63514 100644
--- a/apps/app_lifetime_monitor.h
+++ b/apps/app_lifetime_monitor.h
@@ -10,7 +10,7 @@
 
 #include "apps/app_window_registry.h"
 #include "base/observer_list.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/keyed_service/core/keyed_service.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 
@@ -24,7 +24,7 @@
 
 // Observes startup of apps and their windows and notifies observers of these
 // events.
-class AppLifetimeMonitor : public BrowserContextKeyedService,
+class AppLifetimeMonitor : public KeyedService,
                            public content::NotificationObserver,
                            public AppWindowRegistry::Observer {
  public:
@@ -66,7 +66,7 @@
   virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE;
   virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE;
 
-  // BrowserContextKeyedService overrides:
+  // KeyedService overrides:
   virtual void Shutdown() OVERRIDE;
 
   void NotifyAppStart(const std::string& app_id);
diff --git a/apps/app_lifetime_monitor_factory.cc b/apps/app_lifetime_monitor_factory.cc
index b8a813a..e02297d 100644
--- a/apps/app_lifetime_monitor_factory.cc
+++ b/apps/app_lifetime_monitor_factory.cc
@@ -7,7 +7,7 @@
 #include "apps/app_lifetime_monitor.h"
 #include "apps/app_window_registry.h"
 #include "chrome/browser/profiles/profile.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "extensions/browser/extensions_browser_client.h"
 
 namespace apps {
@@ -31,7 +31,7 @@
 
 AppLifetimeMonitorFactory::~AppLifetimeMonitorFactory() {}
 
-BrowserContextKeyedService* AppLifetimeMonitorFactory::BuildServiceInstanceFor(
+KeyedService* AppLifetimeMonitorFactory::BuildServiceInstanceFor(
     content::BrowserContext* profile) const {
   return new AppLifetimeMonitor(static_cast<Profile*>(profile));
 }
diff --git a/apps/app_lifetime_monitor_factory.h b/apps/app_lifetime_monitor_factory.h
index c55ba716..9732b744 100644
--- a/apps/app_lifetime_monitor_factory.h
+++ b/apps/app_lifetime_monitor_factory.h
@@ -6,7 +6,7 @@
 #define APPS_APP_LIFETIME_MONITOR_FACTORY_H_
 
 #include "base/memory/singleton.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
 
 class Profile;
 
@@ -30,7 +30,7 @@
   virtual ~AppLifetimeMonitorFactory();
 
   // BrowserContextKeyedServiceFactory:
-  virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+  virtual KeyedService* BuildServiceInstanceFor(
       content::BrowserContext* profile) const OVERRIDE;
   virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
   virtual content::BrowserContext* GetBrowserContextToUse(
diff --git a/apps/app_load_service.h b/apps/app_load_service.h
index 518a30a..ec71a7e 100644
--- a/apps/app_load_service.h
+++ b/apps/app_load_service.h
@@ -10,7 +10,7 @@
 
 #include "base/command_line.h"
 #include "base/files/file_path.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/keyed_service/core/keyed_service.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 
@@ -24,7 +24,7 @@
 
 // Monitors apps being reloaded and performs app specific actions (like launch
 // or restart) on them. Also provides an interface to schedule these actions.
-class AppLoadService : public BrowserContextKeyedService,
+class AppLoadService : public KeyedService,
                        public content::NotificationObserver {
  public:
   enum PostReloadActionType {
diff --git a/apps/app_load_service_factory.cc b/apps/app_load_service_factory.cc
index 771db73..23ffd1e 100644
--- a/apps/app_load_service_factory.cc
+++ b/apps/app_load_service_factory.cc
@@ -7,7 +7,7 @@
 #include "apps/app_load_service.h"
 #include "apps/app_window_registry.h"
 #include "chrome/browser/profiles/profile.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "extensions/browser/extension_prefs_factory.h"
 #include "extensions/browser/extension_system_provider.h"
 #include "extensions/browser/extensions_browser_client.h"
@@ -37,7 +37,7 @@
 AppLoadServiceFactory::~AppLoadServiceFactory() {
 }
 
-BrowserContextKeyedService* AppLoadServiceFactory::BuildServiceInstanceFor(
+KeyedService* AppLoadServiceFactory::BuildServiceInstanceFor(
     content::BrowserContext* profile) const {
   return new AppLoadService(static_cast<Profile*>(profile));
 }
diff --git a/apps/app_load_service_factory.h b/apps/app_load_service_factory.h
index 453c4a3c..61b2110 100644
--- a/apps/app_load_service_factory.h
+++ b/apps/app_load_service_factory.h
@@ -6,7 +6,7 @@
 #define APPS_APP_LOAD_SERVICE_FACTORY_H_
 
 #include "base/memory/singleton.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
 
 class Profile;
 
@@ -27,7 +27,7 @@
   virtual ~AppLoadServiceFactory();
 
   // BrowserContextKeyedServiceFactory:
-  virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+  virtual KeyedService* BuildServiceInstanceFor(
       content::BrowserContext* context) const OVERRIDE;
   virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
   virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
diff --git a/apps/app_restore_service.h b/apps/app_restore_service.h
index 9dd88cf..33a407a 100644
--- a/apps/app_restore_service.h
+++ b/apps/app_restore_service.h
@@ -10,7 +10,7 @@
 
 #include "apps/app_lifetime_monitor.h"
 #include "apps/app_window_registry.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/keyed_service/core/keyed_service.h"
 
 namespace extensions {
 class Extension;
@@ -21,7 +21,7 @@
 namespace apps {
 
 // Tracks what apps need to be restarted when the browser restarts.
-class AppRestoreService : public BrowserContextKeyedService,
+class AppRestoreService : public KeyedService,
                           public AppLifetimeMonitor::Observer {
  public:
   // Returns true if apps should be restored on the current platform, given
@@ -50,7 +50,7 @@
   virtual void OnAppStop(Profile* profile, const std::string& app_id) OVERRIDE;
   virtual void OnChromeTerminating() OVERRIDE;
 
-  // BrowserContextKeyedService.
+  // KeyedService.
   virtual void Shutdown() OVERRIDE;
 
   void RecordAppStart(const std::string& extension_id);
diff --git a/apps/app_restore_service_factory.cc b/apps/app_restore_service_factory.cc
index a762e531..10dcd25 100644
--- a/apps/app_restore_service_factory.cc
+++ b/apps/app_restore_service_factory.cc
@@ -7,7 +7,7 @@
 #include "apps/app_lifetime_monitor_factory.h"
 #include "apps/app_restore_service.h"
 #include "chrome/browser/profiles/profile.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 
 namespace apps {
 
@@ -31,7 +31,7 @@
 AppRestoreServiceFactory::~AppRestoreServiceFactory() {
 }
 
-BrowserContextKeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor(
+KeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor(
     content::BrowserContext* profile) const {
   return new AppRestoreService(static_cast<Profile*>(profile));
 }
diff --git a/apps/app_restore_service_factory.h b/apps/app_restore_service_factory.h
index 1c0d4389..80f8fb0 100644
--- a/apps/app_restore_service_factory.h
+++ b/apps/app_restore_service_factory.h
@@ -6,7 +6,7 @@
 #define APPS_APP_RESTORE_SERVICE_FACTORY_H_
 
 #include "base/memory/singleton.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
 
 class Profile;
 
@@ -30,7 +30,7 @@
   virtual ~AppRestoreServiceFactory();
 
   // BrowserContextKeyedServiceFactory:
-  virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+  virtual KeyedService* BuildServiceInstanceFor(
       content::BrowserContext* profile) const OVERRIDE;
   virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
 };
diff --git a/apps/app_window_geometry_cache.cc b/apps/app_window_geometry_cache.cc
index deefc7a..22ad90c5 100644
--- a/apps/app_window_geometry_cache.cc
+++ b/apps/app_window_geometry_cache.cc
@@ -10,7 +10,7 @@
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/profiles/incognito_helpers.h"
 #include "chrome/browser/profiles/profile.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
 #include "extensions/browser/extension_prefs.h"
@@ -306,8 +306,7 @@
 
 AppWindowGeometryCache::Factory::~Factory() {}
 
-BrowserContextKeyedService*
-AppWindowGeometryCache::Factory::BuildServiceInstanceFor(
+KeyedService* AppWindowGeometryCache::Factory::BuildServiceInstanceFor(
     content::BrowserContext* context) const {
   Profile* profile = Profile::FromBrowserContext(context);
   return new AppWindowGeometryCache(profile,
diff --git a/apps/app_window_geometry_cache.h b/apps/app_window_geometry_cache.h
index 372be6d..1bc69fac 100644
--- a/apps/app_window_geometry_cache.h
+++ b/apps/app_window_geometry_cache.h
@@ -15,8 +15,8 @@
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "base/values.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/core/keyed_service.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "ui/base/ui_base_types.h"
@@ -33,7 +33,7 @@
 // A cache for persisted geometry of app windows, both to not have to wait
 // for IO when creating a new window, and to not cause IO on every window
 // geometry change.
-class AppWindowGeometryCache : public BrowserContextKeyedService,
+class AppWindowGeometryCache : public KeyedService,
                                public content::NotificationObserver {
  public:
   class Factory : public BrowserContextKeyedServiceFactory {
@@ -51,7 +51,7 @@
     virtual ~Factory();
 
     // BrowserContextKeyedServiceFactory
-    virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+    virtual KeyedService* BuildServiceInstanceFor(
         content::BrowserContext* context) const OVERRIDE;
     virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
     virtual content::BrowserContext* GetBrowserContextToUse(
@@ -91,7 +91,7 @@
                    gfx::Rect* screen_bounds,
                    ui::WindowShowState* state);
 
-  // BrowserContextKeyedService
+  // KeyedService
   virtual void Shutdown() OVERRIDE;
 
   void AddObserver(Observer* observer);
diff --git a/apps/app_window_registry.cc b/apps/app_window_registry.cc
index 42b9465..82d8293 100644
--- a/apps/app_window_registry.cc
+++ b/apps/app_window_registry.cc
@@ -6,7 +6,7 @@
 #include "apps/app_window_registry.h"
 #include "apps/apps_client.h"
 #include "apps/ui/native_app_window.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/devtools_agent_host.h"
 #include "content/public/browser/devtools_manager.h"
@@ -285,7 +285,7 @@
 
 AppWindowRegistry::Factory::~Factory() {}
 
-BrowserContextKeyedService* AppWindowRegistry::Factory::BuildServiceInstanceFor(
+KeyedService* AppWindowRegistry::Factory::BuildServiceInstanceFor(
     content::BrowserContext* context) const {
   return new AppWindowRegistry(context);
 }
diff --git a/apps/app_window_registry.h b/apps/app_window_registry.h
index 2a3dfa5a..5be2079 100644
--- a/apps/app_window_registry.h
+++ b/apps/app_window_registry.h
@@ -11,8 +11,8 @@
 #include "base/compiler_specific.h"
 #include "base/memory/singleton.h"
 #include "base/observer_list.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/core/keyed_service.h"
 #include "ui/gfx/native_widget_types.h"
 
 namespace content {
@@ -27,7 +27,7 @@
 
 // The AppWindowRegistry tracks the AppWindows for all platform apps for a
 // particular browser context.
-class AppWindowRegistry : public BrowserContextKeyedService {
+class AppWindowRegistry : public KeyedService {
  public:
   class Observer {
    public:
@@ -115,7 +115,7 @@
     virtual ~Factory();
 
     // BrowserContextKeyedServiceFactory
-    virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+    virtual KeyedService* BuildServiceInstanceFor(
         content::BrowserContext* context) const OVERRIDE;
     virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
     virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
diff --git a/apps/saved_files_service.h b/apps/saved_files_service.h
index 4c86a0c..aa7909b 100644
--- a/apps/saved_files_service.h
+++ b/apps/saved_files_service.h
@@ -13,7 +13,7 @@
 #include "base/files/file_path.h"
 #include "base/gtest_prod_util.h"
 #include "base/stl_util.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/keyed_service/core/keyed_service.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 
@@ -56,7 +56,7 @@
 
 // Tracks the files that apps have retained access to both while running and
 // when suspended.
-class SavedFilesService : public BrowserContextKeyedService,
+class SavedFilesService : public KeyedService,
                           public content::NotificationObserver {
  public:
   explicit SavedFilesService(Profile* profile);
diff --git a/apps/saved_files_service_factory.cc b/apps/saved_files_service_factory.cc
index c904770..94dcf31 100644
--- a/apps/saved_files_service_factory.cc
+++ b/apps/saved_files_service_factory.cc
@@ -6,7 +6,7 @@
 
 #include "apps/saved_files_service.h"
 #include "chrome/browser/profiles/profile.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 
 namespace apps {
 
@@ -28,7 +28,7 @@
 
 SavedFilesServiceFactory::~SavedFilesServiceFactory() {}
 
-BrowserContextKeyedService* SavedFilesServiceFactory::BuildServiceInstanceFor(
+KeyedService* SavedFilesServiceFactory::BuildServiceInstanceFor(
     content::BrowserContext* profile) const {
   return new SavedFilesService(static_cast<Profile*>(profile));
 }
diff --git a/apps/saved_files_service_factory.h b/apps/saved_files_service_factory.h
index 502010f..d8bc3ee 100644
--- a/apps/saved_files_service_factory.h
+++ b/apps/saved_files_service_factory.h
@@ -6,7 +6,7 @@
 #define APPS_SAVED_FILES_SERVICE_FACTORY_H_
 
 #include "base/memory/singleton.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
 
 class Profile;
 
@@ -26,7 +26,7 @@
   virtual ~SavedFilesServiceFactory();
   friend struct DefaultSingletonTraits<SavedFilesServiceFactory>;
 
-  virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+  virtual KeyedService* BuildServiceInstanceFor(
       content::BrowserContext* profile) const OVERRIDE;
 };
 
diff --git a/apps/shell/browser/shell_browser_main_parts.cc b/apps/shell/browser/shell_browser_main_parts.cc
index 559c3c9..e506e81a 100644
--- a/apps/shell/browser/shell_browser_main_parts.cc
+++ b/apps/shell/browser/shell_browser_main_parts.cc
@@ -15,7 +15,7 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/run_loop.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "content/public/common/result_codes.h"
 #include "content/shell/browser/shell_devtools_delegate.h"
 #include "content/shell/browser/shell_net_log.h"
@@ -41,7 +41,7 @@
 namespace apps {
 namespace {
 
-// Register additional BrowserContextKeyedService factories here. See
+// Register additional KeyedService factories here. See
 // ChromeBrowserMainExtraPartsProfiles for details.
 void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
   extensions::RendererStartupHelperFactory::GetInstance();
@@ -117,7 +117,7 @@
   AppsClient::Set(apps_client_.get());
 
   // Create our custom ExtensionSystem first because other
-  // BrowserContextKeyedServices depend on it.
+  // KeyedServices depend on it.
   // TODO(yoz): Move this after EnsureBrowserContextKeyedServiceFactoriesBuilt.
   CreateExtensionSystem();
 
diff --git a/apps/shell/browser/shell_browser_main_parts.h b/apps/shell/browser/shell_browser_main_parts.h
index fb40160e..653e90d 100644
--- a/apps/shell/browser/shell_browser_main_parts.h
+++ b/apps/shell/browser/shell_browser_main_parts.h
@@ -102,7 +102,7 @@
 
   scoped_ptr<content::ShellDevToolsDelegate> devtools_delegate_;
 
-  // Owned by the BrowserContextKeyedService system.
+  // Owned by the KeyedService system.
   extensions::ShellExtensionSystem* extension_system_;
 
   DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
diff --git a/apps/shell/browser/shell_extension_system.h b/apps/shell/browser/shell_extension_system.h
index 39004117..c45505d 100644
--- a/apps/shell/browser/shell_extension_system.h
+++ b/apps/shell/browser/shell_extension_system.h
@@ -43,7 +43,7 @@
   // Closes the running app.
   void CloseApp();
 
-  // BrowserContextKeyedService implementation:
+  // KeyedService implementation:
   virtual void Shutdown() OVERRIDE;
 
   // ExtensionSystem implementation:
diff --git a/apps/shell/browser/shell_extension_system_factory.cc b/apps/shell/browser/shell_extension_system_factory.cc
index 46fed8f7..42a5b9e 100644
--- a/apps/shell/browser/shell_extension_system_factory.cc
+++ b/apps/shell/browser/shell_extension_system_factory.cc
@@ -5,7 +5,7 @@
 #include "apps/shell/browser/shell_extension_system_factory.h"
 
 #include "apps/shell/browser/shell_extension_system.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "extensions/browser/extension_prefs_factory.h"
 #include "extensions/browser/extension_registry_factory.h"
 
@@ -33,9 +33,8 @@
 
 ShellExtensionSystemFactory::~ShellExtensionSystemFactory() {}
 
-BrowserContextKeyedService*
-ShellExtensionSystemFactory::BuildServiceInstanceFor(BrowserContext* context)
-    const {
+KeyedService* ShellExtensionSystemFactory::BuildServiceInstanceFor(
+    BrowserContext* context) const {
   return new ShellExtensionSystem(context);
 }
 
diff --git a/apps/shell/browser/shell_extension_system_factory.h b/apps/shell/browser/shell_extension_system_factory.h
index 2173fb5..b273a20 100644
--- a/apps/shell/browser/shell_extension_system_factory.h
+++ b/apps/shell/browser/shell_extension_system_factory.h
@@ -26,7 +26,7 @@
   virtual ~ShellExtensionSystemFactory();
 
   // BrowserContextKeyedServiceFactory implementation:
-  virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+  virtual KeyedService* BuildServiceInstanceFor(
       content::BrowserContext* context) const OVERRIDE;
   virtual content::BrowserContext* GetBrowserContextToUse(
       content::BrowserContext* context) const OVERRIDE;