Skip to content

Commit

Permalink
Move clients of BrowserContextKeyedService to using KeyedService (chr…
Browse files Browse the repository at this point in the history
…omium#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
  • Loading branch information
blundell@chromium.org committed Mar 13, 2014
1 parent cd61254 commit 12b7af3
Show file tree
Hide file tree
Showing 98 changed files with 230 additions and 252 deletions.
1 change: 1 addition & 0 deletions apps/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include_rules = [
"+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",
Expand Down
6 changes: 3 additions & 3 deletions apps/app_lifetime_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -24,7 +24,7 @@ namespace apps {

// 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:
Expand Down Expand Up @@ -66,7 +66,7 @@ class AppLifetimeMonitor : public BrowserContextKeyedService,
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);
Expand Down
4 changes: 2 additions & 2 deletions apps/app_lifetime_monitor_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -31,7 +31,7 @@ AppLifetimeMonitorFactory::AppLifetimeMonitorFactory()

AppLifetimeMonitorFactory::~AppLifetimeMonitorFactory() {}

BrowserContextKeyedService* AppLifetimeMonitorFactory::BuildServiceInstanceFor(
KeyedService* AppLifetimeMonitorFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
return new AppLifetimeMonitor(static_cast<Profile*>(profile));
}
Expand Down
4 changes: 2 additions & 2 deletions apps/app_lifetime_monitor_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -30,7 +30,7 @@ class AppLifetimeMonitorFactory : public BrowserContextKeyedServiceFactory {
virtual ~AppLifetimeMonitorFactory();

// BrowserContextKeyedServiceFactory:
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
virtual KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const OVERRIDE;
virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
virtual content::BrowserContext* GetBrowserContextToUse(
Expand Down
4 changes: 2 additions & 2 deletions apps/app_load_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -24,7 +24,7 @@ namespace apps {

// 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 {
Expand Down
4 changes: 2 additions & 2 deletions apps/app_load_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -37,7 +37,7 @@ AppLoadServiceFactory::AppLoadServiceFactory()
AppLoadServiceFactory::~AppLoadServiceFactory() {
}

BrowserContextKeyedService* AppLoadServiceFactory::BuildServiceInstanceFor(
KeyedService* AppLoadServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
return new AppLoadService(static_cast<Profile*>(profile));
}
Expand Down
4 changes: 2 additions & 2 deletions apps/app_load_service_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -27,7 +27,7 @@ class AppLoadServiceFactory : public BrowserContextKeyedServiceFactory {
virtual ~AppLoadServiceFactory();

// BrowserContextKeyedServiceFactory:
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
virtual KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const OVERRIDE;
virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
Expand Down
6 changes: 3 additions & 3 deletions apps/app_restore_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +21,7 @@ class Profile;
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
Expand Down Expand Up @@ -50,7 +50,7 @@ class AppRestoreService : public BrowserContextKeyedService,
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);
Expand Down
4 changes: 2 additions & 2 deletions apps/app_restore_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -31,7 +31,7 @@ AppRestoreServiceFactory::AppRestoreServiceFactory()
AppRestoreServiceFactory::~AppRestoreServiceFactory() {
}

BrowserContextKeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor(
KeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
return new AppRestoreService(static_cast<Profile*>(profile));
}
Expand Down
4 changes: 2 additions & 2 deletions apps/app_restore_service_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -30,7 +30,7 @@ class AppRestoreServiceFactory : public BrowserContextKeyedServiceFactory {
virtual ~AppRestoreServiceFactory();

// BrowserContextKeyedServiceFactory:
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
virtual KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const OVERRIDE;
virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
};
Expand Down
5 changes: 2 additions & 3 deletions apps/app_window_geometry_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -306,8 +306,7 @@ AppWindowGeometryCache::Factory::Factory()

AppWindowGeometryCache::Factory::~Factory() {}

BrowserContextKeyedService*
AppWindowGeometryCache::Factory::BuildServiceInstanceFor(
KeyedService* AppWindowGeometryCache::Factory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
return new AppWindowGeometryCache(profile,
Expand Down
10 changes: 5 additions & 5 deletions apps/app_window_geometry_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -33,7 +33,7 @@ namespace apps {
// 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 {
Expand All @@ -51,7 +51,7 @@ class AppWindowGeometryCache : public BrowserContextKeyedService,
virtual ~Factory();

// BrowserContextKeyedServiceFactory
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
virtual KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const OVERRIDE;
virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
virtual content::BrowserContext* GetBrowserContextToUse(
Expand Down Expand Up @@ -91,7 +91,7 @@ class AppWindowGeometryCache : public BrowserContextKeyedService,
gfx::Rect* screen_bounds,
ui::WindowShowState* state);

// BrowserContextKeyedService
// KeyedService
virtual void Shutdown() OVERRIDE;

void AddObserver(Observer* observer);
Expand Down
4 changes: 2 additions & 2 deletions apps/app_window_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -285,7 +285,7 @@ AppWindowRegistry::Factory::Factory()

AppWindowRegistry::Factory::~Factory() {}

BrowserContextKeyedService* AppWindowRegistry::Factory::BuildServiceInstanceFor(
KeyedService* AppWindowRegistry::Factory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new AppWindowRegistry(context);
}
Expand Down
8 changes: 4 additions & 4 deletions apps/app_window_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,7 +27,7 @@ class AppWindow;

// 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:
Expand Down Expand Up @@ -115,7 +115,7 @@ class AppWindowRegistry : public BrowserContextKeyedService {
virtual ~Factory();

// BrowserContextKeyedServiceFactory
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
virtual KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const OVERRIDE;
virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
Expand Down
4 changes: 2 additions & 2 deletions apps/saved_files_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -56,7 +56,7 @@ struct SavedFileEntry {

// 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);
Expand Down
4 changes: 2 additions & 2 deletions apps/saved_files_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -28,7 +28,7 @@ SavedFilesServiceFactory::SavedFilesServiceFactory()

SavedFilesServiceFactory::~SavedFilesServiceFactory() {}

BrowserContextKeyedService* SavedFilesServiceFactory::BuildServiceInstanceFor(
KeyedService* SavedFilesServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
return new SavedFilesService(static_cast<Profile*>(profile));
}
Expand Down
4 changes: 2 additions & 2 deletions apps/saved_files_service_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -26,7 +26,7 @@ class SavedFilesServiceFactory : public BrowserContextKeyedServiceFactory {
virtual ~SavedFilesServiceFactory();
friend struct DefaultSingletonTraits<SavedFilesServiceFactory>;

virtual BrowserContextKeyedService* BuildServiceInstanceFor(
virtual KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const OVERRIDE;
};

Expand Down
6 changes: 3 additions & 3 deletions apps/shell/browser/shell_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -41,7 +41,7 @@ using extensions::ShellExtensionSystem;
namespace apps {
namespace {

// Register additional BrowserContextKeyedService factories here. See
// Register additional KeyedService factories here. See
// ChromeBrowserMainExtraPartsProfiles for details.
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
extensions::RendererStartupHelperFactory::GetInstance();
Expand Down Expand Up @@ -117,7 +117,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
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();

Expand Down
2 changes: 1 addition & 1 deletion apps/shell/browser/shell_browser_main_parts.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ShellBrowserMainParts : public content::BrowserMainParts,

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);
Expand Down
2 changes: 1 addition & 1 deletion apps/shell/browser/shell_extension_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ShellExtensionSystem : public ExtensionSystem {
// Closes the running app.
void CloseApp();

// BrowserContextKeyedService implementation:
// KeyedService implementation:
virtual void Shutdown() OVERRIDE;

// ExtensionSystem implementation:
Expand Down
Loading

0 comments on commit 12b7af3

Please sign in to comment.