diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-05 10:21:02 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-05 10:21:02 +0000 |
commit | 4bf3bed0a6c27a4df48fb4fd6fcf0ae6082895a0 (patch) | |
tree | d251d2f21fa175b96f756d3e9176d4dafd076b1d /chrome/browser/extensions/api | |
parent | 4620763147961c9a7587b7c27b161c0c8136bceb (diff) | |
download | chromium_src-4bf3bed0a6c27a4df48fb4fd6fcf0ae6082895a0.zip chromium_src-4bf3bed0a6c27a4df48fb4fd6fcf0ae6082895a0.tar.gz chromium_src-4bf3bed0a6c27a4df48fb4fd6fcf0ae6082895a0.tar.bz2 |
Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get.
Move it to extensions/browser. (Not extensions/browser/api, since it's now being used not just by API implementations.)
This change is purely mechanical (some lines are more affected by clang-format than others).
BUG=309909
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/178193030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api')
119 files changed, 640 insertions, 754 deletions
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc index d23de53..c6c748c 100644 --- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc +++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc @@ -28,16 +28,18 @@ using api::activity_log_private::ActivityResultSet; using api::activity_log_private::ExtensionActivity; using api::activity_log_private::Filter; -static base::LazyInstance<ProfileKeyedAPIFactory<ActivityLogAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<ActivityLogAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<ActivityLogAPI>* ActivityLogAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<ActivityLogAPI>* +ActivityLogAPI::GetFactoryInstance() { return g_factory.Pointer(); } -template<> -void ProfileKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies() { +template <> +void +BrowserContextKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies() { DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); DependsOn(ActivityLog::GetFactoryInstance()); } diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h index e0bbb35..513d015 100644 --- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h +++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h @@ -12,8 +12,8 @@ #include "base/synchronization/lock.h" #include "chrome/browser/extensions/activity_log/activity_actions.h" #include "chrome/browser/extensions/activity_log/activity_log.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace extensions { @@ -21,15 +21,15 @@ namespace extensions { class ActivityLog; // Handles interactions between the Activity Log API and implementation. -class ActivityLogAPI : public ProfileKeyedAPI, +class ActivityLogAPI : public BrowserContextKeyedAPI, public extensions::ActivityLog::Observer, public EventRouter::Observer { public: explicit ActivityLogAPI(content::BrowserContext* context); virtual ~ActivityLogAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ActivityLogAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<ActivityLogAPI>* GetFactoryInstance(); virtual void Shutdown() OVERRIDE; @@ -37,7 +37,7 @@ class ActivityLogAPI : public ProfileKeyedAPI, static bool IsExtensionWhitelisted(const std::string& extension_id); private: - friend class ProfileKeyedAPIFactory<ActivityLogAPI>; + friend class BrowserContextKeyedAPIFactory<ActivityLogAPI>; static const char* service_name() { return "ActivityLogPrivateAPI"; } // ActivityLog::Observer @@ -56,8 +56,9 @@ class ActivityLogAPI : public ProfileKeyedAPI, DISALLOW_COPY_AND_ASSIGN(ActivityLogAPI); }; -template<> -void ProfileKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies(); +template <> +void + BrowserContextKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies(); // The implementation of activityLogPrivate.getExtensionActivities class ActivityLogPrivateGetExtensionActivitiesFunction diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.cc b/chrome/browser/extensions/api/alarms/alarm_manager.cc index 9e00751..c3d8ac5 100644 --- a/chrome/browser/extensions/api/alarms/alarm_manager.cc +++ b/chrome/browser/extensions/api/alarms/alarm_manager.cc @@ -216,17 +216,18 @@ void AlarmManager::SetClockForTesting(base::Clock* clock) { clock_.reset(clock); } -static base::LazyInstance<ProfileKeyedAPIFactory<AlarmManager> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<AlarmManager> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<AlarmManager>* AlarmManager::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<AlarmManager>* +AlarmManager::GetFactoryInstance() { return g_factory.Pointer(); } // static AlarmManager* AlarmManager::Get(Profile* profile) { - return ProfileKeyedAPIFactory<AlarmManager>::GetForProfile(profile); + return BrowserContextKeyedAPIFactory<AlarmManager>::Get(profile); } void AlarmManager::RemoveAlarmIterator(const AlarmIterator& iter) { diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.h b/chrome/browser/extensions/api/alarms/alarm_manager.h index d4d5057..04515f1 100644 --- a/chrome/browser/extensions/api/alarms/alarm_manager.h +++ b/chrome/browser/extensions/api/alarms/alarm_manager.h @@ -13,10 +13,10 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/common/extensions/api/alarms.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" class Profile; @@ -55,10 +55,9 @@ struct Alarm { // Manages the currently pending alarms for every extension in a profile. // There is one manager per virtual Profile. -class AlarmManager - : public ProfileKeyedAPI, - public content::NotificationObserver, - public base::SupportsWeakPtr<AlarmManager> { +class AlarmManager : public BrowserContextKeyedAPI, + public content::NotificationObserver, + public base::SupportsWeakPtr<AlarmManager> { public: typedef std::vector<Alarm> AlarmList; @@ -112,8 +111,8 @@ class AlarmManager // Replaces AlarmManager's owned clock with |clock| and takes ownership of it. void SetClockForTesting(base::Clock* clock); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<AlarmManager>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<AlarmManager>* GetFactoryInstance(); // Convenience method to get the AlarmManager for a profile. static AlarmManager* Get(Profile* profile); @@ -130,7 +129,7 @@ class AlarmManager DifferentMinimumGranularities); FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, RepeatingAlarmsScheduledPredictably); - friend class ProfileKeyedAPIFactory<AlarmManager>; + friend class BrowserContextKeyedAPIFactory<AlarmManager>; typedef std::string ExtensionId; typedef std::map<ExtensionId, AlarmList> AlarmMap; @@ -209,7 +208,7 @@ class AlarmManager const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "AlarmManager"; } diff --git a/chrome/browser/extensions/api/api_resource_manager.h b/chrome/browser/extensions/api/api_resource_manager.h index 31c2f1f..3a115ca 100644 --- a/chrome/browser/extensions/api/api_resource_manager.h +++ b/chrome/browser/extensions/api/api_resource_manager.h @@ -13,13 +13,13 @@ #include "base/memory/ref_counted.h" #include "base/threading/non_thread_safe.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/extension_host.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/common/extension.h" namespace extensions { @@ -59,18 +59,18 @@ namespace extensions { // // In the cc file: // -// static base::LazyInstance<ProfileKeyedAPIFactory< +// static base::LazyInstance<BrowserContextKeyedAPIFactory< // ApiResourceManager<Resource> > > // g_factory = LAZY_INSTANCE_INITIALIZER; // // // template <> -// ProfileKeyedAPIFactory<ApiResourceManager<Resource> >* +// BrowserContextKeyedAPIFactory<ApiResourceManager<Resource> >* // ApiResourceManager<Resource>::GetFactoryInstance() { // return g_factory.Pointer(); // } template <class T> -class ApiResourceManager : public ProfileKeyedAPI, +class ApiResourceManager : public BrowserContextKeyedAPI, public base::NonThreadSafe, public content::NotificationObserver { public: @@ -106,13 +106,13 @@ class ApiResourceManager : public ProfileKeyedAPI, data_->InititateCleanup(); } - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ApiResourceManager<T> >* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<ApiResourceManager<T> >* + GetFactoryInstance(); // Convenience method to get the ApiResourceManager for a profile. static ApiResourceManager<T>* Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<ApiResourceManager<T> >::GetForProfile( - context); + return BrowserContextKeyedAPIFactory<ApiResourceManager<T> >::Get(context); } // Takes ownership. @@ -158,8 +158,8 @@ class ApiResourceManager : public ProfileKeyedAPI, friend class api::TCPServerSocketEventDispatcher; friend class api::TCPSocketEventDispatcher; friend class api::UDPSocketEventDispatcher; - friend class ProfileKeyedAPIFactory<ApiResourceManager<T> >; - // ProfileKeyedAPI implementation. + friend class BrowserContextKeyedAPIFactory<ApiResourceManager<T> >; + // BrowserContextKeyedAPI implementation. static const char* service_name() { return T::service_name(); } diff --git a/chrome/browser/extensions/api/audio/audio_api.cc b/chrome/browser/extensions/api/audio/audio_api.cc index ba4c058..ce252e6 100644 --- a/chrome/browser/extensions/api/audio/audio_api.cc +++ b/chrome/browser/extensions/api/audio/audio_api.cc @@ -15,11 +15,11 @@ namespace extensions { namespace audio = api::audio; -static base::LazyInstance<ProfileKeyedAPIFactory<AudioAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<AudioAPI> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<AudioAPI>* AudioAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<AudioAPI>* AudioAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -51,7 +51,7 @@ void AudioAPI::OnDeviceChanged() { bool AudioGetInfoFunction::RunImpl() { AudioService* service = - AudioAPI::GetFactoryInstance()->GetForProfile(GetProfile())->GetService(); + AudioAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); DCHECK(service); service->StartGetInfo(base::Bind(&AudioGetInfoFunction::OnGetInfoCompleted, this)); @@ -74,7 +74,7 @@ bool AudioSetActiveDevicesFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(params.get()); AudioService* service = - AudioAPI::GetFactoryInstance()->GetForProfile(GetProfile())->GetService(); + AudioAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); DCHECK(service); service->SetActiveDevices(params->ids); @@ -87,7 +87,7 @@ bool AudioSetPropertiesFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(params.get()); AudioService* service = - AudioAPI::GetFactoryInstance()->GetForProfile(GetProfile())->GetService(); + AudioAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); DCHECK(service); int volume_value = params->properties.volume.get() ? diff --git a/chrome/browser/extensions/api/audio/audio_api.h b/chrome/browser/extensions/api/audio/audio_api.h index 5db9213..a612f8b 100644 --- a/chrome/browser/extensions/api/audio/audio_api.h +++ b/chrome/browser/extensions/api/audio/audio_api.h @@ -6,31 +6,30 @@ #define CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_ #include "chrome/browser/extensions/api/audio/audio_service.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" namespace extensions { class AudioService; -class AudioAPI : public ProfileKeyedAPI, - public AudioService::Observer { +class AudioAPI : public BrowserContextKeyedAPI, public AudioService::Observer { public: explicit AudioAPI(content::BrowserContext* context); virtual ~AudioAPI(); AudioService* GetService() const; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<AudioAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<AudioAPI>* GetFactoryInstance(); // AudioService::Observer implementation. virtual void OnDeviceChanged() OVERRIDE; private: - friend class ProfileKeyedAPIFactory<AudioAPI>; + friend class BrowserContextKeyedAPIFactory<AudioAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "AudioAPI"; } diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc index b727950..1121318f 100644 --- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc +++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc @@ -61,9 +61,7 @@ base::ListValue* GetAPIPermissions(const Extension* ext) { } bool IsTestMode(Profile* profile) { - return AutotestPrivateAPI::GetFactoryInstance() - ->GetForProfile(profile) - ->test_mode(); + return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode(); } } // namespace @@ -227,18 +225,18 @@ bool AutotestPrivateSimulateAsanMemoryBugFunction::RunImpl() { return true; } -static base::LazyInstance<ProfileKeyedAPIFactory<AutotestPrivateAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<AutotestPrivateAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<AutotestPrivateAPI>* +BrowserContextKeyedAPIFactory<AutotestPrivateAPI>* AutotestPrivateAPI::GetFactoryInstance() { return g_factory.Pointer(); } template <> BrowserContextKeyedService* -ProfileKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( +BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( content::BrowserContext* context) const { return new AutotestPrivateAPI(); } diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.h b/chrome/browser/extensions/api/autotest_private/autotest_private_api.h index 4baeae2..8175246 100644 --- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.h +++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.h @@ -8,8 +8,8 @@ #include <string> #include "base/compiler_specific.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" namespace extensions { @@ -87,21 +87,22 @@ class AutotestPrivateSimulateAsanMemoryBugFunction void SetAutotestPrivateTest(); // The profile-keyed service that manages the autotestPrivate extension API. -class AutotestPrivateAPI : public ProfileKeyedAPI { +class AutotestPrivateAPI : public BrowserContextKeyedAPI { public: - static ProfileKeyedAPIFactory<AutotestPrivateAPI>* GetFactoryInstance(); + static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>* + GetFactoryInstance(); // TODO(achuith): Replace these with a mock object for system calls. bool test_mode() const { return test_mode_; } void set_test_mode(bool test_mode) { test_mode_ = test_mode; } private: - friend class ProfileKeyedAPIFactory<AutotestPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<AutotestPrivateAPI>; AutotestPrivateAPI(); virtual ~AutotestPrivateAPI(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "AutotestPrivateAPI"; } static const bool kServiceIsNULLWhileTesting = true; static const bool kServiceRedirectedInIncognito = true; @@ -111,7 +112,7 @@ class AutotestPrivateAPI : public ProfileKeyedAPI { template <> BrowserContextKeyedService* - ProfileKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( + BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( content::BrowserContext* context) const; } // namespace extensions diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_apitest.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_apitest.cc index fbd5420..ba8f3ad 100644 --- a/chrome/browser/extensions/api/autotest_private/autotest_private_apitest.cc +++ b/chrome/browser/extensions/api/autotest_private/autotest_private_apitest.cc @@ -9,7 +9,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AutotestPrivate) { // Turn on testing mode so we don't kill the browser. extensions::AutotestPrivateAPI::GetFactoryInstance() - ->GetForProfile(browser()->profile()) + ->Get(browser()->profile()) ->set_test_mode(true); ASSERT_TRUE(RunComponentExtensionTest("autotest_private")) << message_; } diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc index ac0b774..6b2b8db 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc @@ -78,17 +78,18 @@ namespace Write = extensions::api::bluetooth::Write; namespace extensions { -static base::LazyInstance<ProfileKeyedAPIFactory<BluetoothAPI> > g_factory = - LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<BluetoothAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<BluetoothAPI>* BluetoothAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<BluetoothAPI>* +BluetoothAPI::GetFactoryInstance() { return g_factory.Pointer(); } // static BluetoothAPI* BluetoothAPI::Get(BrowserContext* context) { - return GetFactoryInstance()->GetForProfile(context); + return GetFactoryInstance()->Get(context); } BluetoothAPI::BluetoothAPI(BrowserContext* context) diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h b/chrome/browser/extensions/api/bluetooth/bluetooth_api.h index 552b7dc..a4b7b21 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.h @@ -10,10 +10,10 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_profile.h" #include "extensions/browser/api/async_api_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_function.h" @@ -35,12 +35,13 @@ namespace extensions { class ExtensionBluetoothEventRouter; // The profile-keyed service that manages the bluetooth extension API. -class BluetoothAPI : public ProfileKeyedAPI, public EventRouter::Observer { +class BluetoothAPI : public BrowserContextKeyedAPI, + public EventRouter::Observer { public: // Convenience method to get the BluetoothAPI for a profile. static BluetoothAPI* Get(content::BrowserContext* context); - static ProfileKeyedAPIFactory<BluetoothAPI>* GetFactoryInstance(); + static BrowserContextKeyedAPIFactory<BluetoothAPI>* GetFactoryInstance(); explicit BluetoothAPI(content::BrowserContext* context); virtual ~BluetoothAPI(); @@ -55,9 +56,9 @@ class BluetoothAPI : public ProfileKeyedAPI, public EventRouter::Observer { virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<BluetoothAPI>; + friend class BrowserContextKeyedAPIFactory<BluetoothAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "BluetoothAPI"; } static const bool kServiceRedirectedInIncognito = true; static const bool kServiceIsNULLWhileTesting = true; diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index c0f80d4..314c4bb 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -323,11 +323,12 @@ void BookmarksAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<BookmarksAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<BookmarksAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<BookmarksAPI>* BookmarksAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<BookmarksAPI>* +BookmarksAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h index 4fbfdfa..7191028 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h @@ -12,8 +12,8 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "ui/shell_dialogs/select_file_dialog.h" @@ -72,7 +72,7 @@ class BookmarkEventRouter : public BookmarkModelObserver { DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter); }; -class BookmarksAPI : public ProfileKeyedAPI, +class BookmarksAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: explicit BookmarksAPI(content::BrowserContext* context); @@ -81,19 +81,19 @@ class BookmarksAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<BookmarksAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<BookmarksAPI>* GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded( const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<BookmarksAPI>; + friend class BrowserContextKeyedAPIFactory<BookmarksAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "BookmarksAPI"; } diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc index 13c6920..85a7af9 100644 --- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc +++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc @@ -51,11 +51,12 @@ BrailleDisplayPrivateAPI::~BrailleDisplayPrivateAPI() { void BrailleDisplayPrivateAPI::Shutdown() { } -static base::LazyInstance<ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<BrailleDisplayPrivateAPI> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>* +BrowserContextKeyedAPIFactory<BrailleDisplayPrivateAPI>* BrailleDisplayPrivateAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h index 9690e68..3fe1ba28 100644 --- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h +++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h @@ -7,9 +7,9 @@ #include "base/scoped_observer.h" #include "chrome/browser/extensions/api/braille_display_private/braille_controller.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/common/extensions/api/braille_display_private.h" #include "extensions/browser/api/async_api_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" class Profile; @@ -22,10 +22,9 @@ class BrailleDisplayPrivateAPIUserTest; } // namespace api // Implementation of the chrome.brailleDisplayPrivate API. -class BrailleDisplayPrivateAPI - : public ProfileKeyedAPI, - api::braille_display_private::BrailleObserver, - EventRouter::Observer { +class BrailleDisplayPrivateAPI : public BrowserContextKeyedAPI, + api::braille_display_private::BrailleObserver, + EventRouter::Observer { public: explicit BrailleDisplayPrivateAPI(content::BrowserContext* context); virtual ~BrailleDisplayPrivateAPI(); @@ -33,8 +32,9 @@ class BrailleDisplayPrivateAPI // ProfileKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<BrailleDisplayPrivateAPI>* + GetFactoryInstance(); // BrailleObserver implementation. virtual void OnDisplayStateChanged( @@ -48,7 +48,7 @@ class BrailleDisplayPrivateAPI private: - friend class ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<BrailleDisplayPrivateAPI>; friend class api::braille_display_private::BrailleDisplayPrivateAPIUserTest; class EventDelegate { @@ -71,7 +71,7 @@ class BrailleDisplayPrivateAPI BrailleObserver> scoped_observer_; scoped_ptr<EventDelegate> event_delegate_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "BrailleDisplayPrivateAPI"; } diff --git a/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc b/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc index d6bc303..b662a15 100644 --- a/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc +++ b/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc @@ -50,14 +50,15 @@ CastChannelAPI::CastChannelAPI(content::BrowserContext* context) // static CastChannelAPI* CastChannelAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<CastChannelAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<CastChannelAPI>::Get(context); } -static base::LazyInstance<ProfileKeyedAPIFactory<CastChannelAPI> > g_factory = - LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<CastChannelAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<CastChannelAPI>* CastChannelAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<CastChannelAPI>* +CastChannelAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/cast_channel/cast_channel_api.h b/chrome/browser/extensions/api/cast_channel/cast_channel_api.h index 313c556..8ed6ff1 100644 --- a/chrome/browser/extensions/api/cast_channel/cast_channel_api.h +++ b/chrome/browser/extensions/api/cast_channel/cast_channel_api.h @@ -10,9 +10,9 @@ #include "base/threading/thread_checker.h" #include "chrome/browser/extensions/api/api_resource_manager.h" #include "chrome/browser/extensions/api/cast_channel/cast_socket.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/common/extensions/api/cast_channel.h" #include "extensions/browser/api/async_api_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class GURL; class CastChannelAPITest; @@ -25,7 +25,7 @@ namespace extensions { namespace cast_channel = api::cast_channel; -class CastChannelAPI : public ProfileKeyedAPI, +class CastChannelAPI : public BrowserContextKeyedAPI, public cast_channel::CastSocket::Delegate { public: @@ -33,8 +33,8 @@ class CastChannelAPI : public ProfileKeyedAPI, static CastChannelAPI* Get(content::BrowserContext* context); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<CastChannelAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<CastChannelAPI>* GetFactoryInstance(); // Returns a new CastSocket that connects to |url| and is to be owned by // |extension_id|. @@ -46,7 +46,7 @@ class CastChannelAPI : public ProfileKeyedAPI, void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test); private: - friend class ProfileKeyedAPIFactory<CastChannelAPI>; + friend class BrowserContextKeyedAPIFactory<CastChannelAPI>; friend class ::CastChannelAPITest; virtual ~CastChannelAPI(); @@ -57,7 +57,7 @@ class CastChannelAPI : public ProfileKeyedAPI, virtual void OnMessage(const cast_channel::CastSocket* socket, const cast_channel::MessageInfo& message) OVERRIDE; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "CastChannelAPI"; } diff --git a/chrome/browser/extensions/api/cast_channel/cast_socket.cc b/chrome/browser/extensions/api/cast_channel/cast_socket.cc index 842efae..3a7883a 100644 --- a/chrome/browser/extensions/api/cast_channel/cast_socket.cc +++ b/chrome/browser/extensions/api/cast_channel/cast_socket.cc @@ -48,13 +48,14 @@ const int kTcpKeepAliveDelaySecs = 10; namespace extensions { -static base::LazyInstance< - ProfileKeyedAPIFactory<ApiResourceManager<api::cast_channel::CastSocket> > > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory< + ApiResourceManager<api::cast_channel::CastSocket> > > g_factory = + LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<api::cast_channel::CastSocket> >* +BrowserContextKeyedAPIFactory< + ApiResourceManager<api::cast_channel::CastSocket> >* ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index a4344c7..b7c0590 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -155,17 +155,18 @@ CommandService::CommandService(content::BrowserContext* context) CommandService::~CommandService() { } -static base::LazyInstance<ProfileKeyedAPIFactory<CommandService> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<CommandService> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<CommandService>* CommandService::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<CommandService>* +CommandService::GetFactoryInstance() { return g_factory.Pointer(); } // static CommandService* CommandService::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<CommandService>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<CommandService>::Get(context); } // static @@ -598,7 +599,8 @@ bool CommandService::GetExtensionActionCommand( } template <> -void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { +void +BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); } diff --git a/chrome/browser/extensions/api/commands/command_service.h b/chrome/browser/extensions/api/commands/command_service.h index 41c288f..e3e2e95 100644 --- a/chrome/browser/extensions/api/commands/command_service.h +++ b/chrome/browser/extensions/api/commands/command_service.h @@ -8,12 +8,12 @@ #include <string> #include "base/basictypes.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/common/extensions/command.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/common/extension.h" class Profile; @@ -39,7 +39,7 @@ namespace extensions { // This service keeps track of preferences related to extension commands // (assigning initial keybindings on install and removing them on deletion // and answers questions related to which commands are active. -class CommandService : public ProfileKeyedAPI, +class CommandService : public BrowserContextKeyedAPI, public content::NotificationObserver { public: // An enum specifying whether to fetch all extension commands or only active @@ -72,8 +72,8 @@ class CommandService : public ProfileKeyedAPI, explicit CommandService(content::BrowserContext* context); virtual ~CommandService(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<CommandService>* GetFactoryInstance(); // Convenience method to get the CommandService for a profile. static CommandService* Get(content::BrowserContext* context); @@ -172,9 +172,9 @@ class CommandService : public ProfileKeyedAPI, const content::NotificationDetails& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<CommandService>; + friend class BrowserContextKeyedAPIFactory<CommandService>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "CommandService"; } @@ -203,7 +203,8 @@ class CommandService : public ProfileKeyedAPI, }; template <> -void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies(); +void + BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies(); } // namespace extensions diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc index 4eb83b4..2255a09 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc @@ -574,11 +574,11 @@ void CookiesAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<CookiesAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<CookiesAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/cookies/cookies_api.h b/chrome/browser/extensions/api/cookies/cookies_api.h index 433ca34..35a9f20 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.h +++ b/chrome/browser/extensions/api/cookies/cookies_api.h @@ -13,12 +13,12 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/net/chrome_cookie_notification_details.h" #include "chrome/common/extensions/api/cookies.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "net/cookies/canonical_cookie.h" #include "url/gurl.h" @@ -193,7 +193,7 @@ class CookiesGetAllCookieStoresFunction : public CookiesFunction { virtual bool RunImpl() OVERRIDE; }; -class CookiesAPI : public ProfileKeyedAPI, +class CookiesAPI : public BrowserContextKeyedAPI, public extensions::EventRouter::Observer { public: explicit CookiesAPI(content::BrowserContext* context); @@ -202,19 +202,19 @@ class CookiesAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<CookiesAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<CookiesAPI>* GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded(const extensions::EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<CookiesAPI>; + friend class BrowserContextKeyedAPIFactory<CookiesAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "CookiesAPI"; } diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.cc b/chrome/browser/extensions/api/declarative/rules_registry_service.cc index 58d76b0..908e1cc2 100644 --- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc +++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc @@ -122,11 +122,11 @@ void RulesRegistryService::Shutdown() { scoped_refptr<WebRequestRulesRegistry>(NULL))); } -static base::LazyInstance<ProfileKeyedAPIFactory<RulesRegistryService> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<RulesRegistryService> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<RulesRegistryService>* +BrowserContextKeyedAPIFactory<RulesRegistryService>* RulesRegistryService::GetFactoryInstance() { return g_factory.Pointer(); } @@ -134,7 +134,7 @@ RulesRegistryService::GetFactoryInstance() { // static RulesRegistryService* RulesRegistryService::Get( content::BrowserContext* context) { - return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<RulesRegistryService>::Get(context); } void RulesRegistryService::RegisterRulesRegistry( diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.h b/chrome/browser/extensions/api/declarative/rules_registry_service.h index 6a27eaf..ae23372 100644 --- a/chrome/browser/extensions/api/declarative/rules_registry_service.h +++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h @@ -13,10 +13,10 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_vector.h" #include "chrome/browser/extensions/api/declarative/rules_registry.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class Profile; @@ -35,7 +35,7 @@ namespace extensions { // This class owns all RulesRegistries implementations of an ExtensionService. // This class lives on the UI thread. -class RulesRegistryService : public ProfileKeyedAPI, +class RulesRegistryService : public BrowserContextKeyedAPI, public content::NotificationObserver { public: typedef RulesRegistry::WebViewKey WebViewKey; @@ -60,8 +60,9 @@ class RulesRegistryService : public ProfileKeyedAPI, // created by us so that the RulesRegistries can be released. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<RulesRegistryService>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<RulesRegistryService>* + GetFactoryInstance(); // Convenience method to get the RulesRegistryService for a profile. static RulesRegistryService* Get(content::BrowserContext* context); @@ -92,7 +93,7 @@ class RulesRegistryService : public ProfileKeyedAPI, void SimulateExtensionUninstalled(const std::string& extension_id); private: - friend class ProfileKeyedAPIFactory<RulesRegistryService>; + friend class BrowserContextKeyedAPIFactory<RulesRegistryService>; // Maps <event name, webview key> to RuleRegistries that handle these // events. @@ -112,7 +113,7 @@ class RulesRegistryService : public ProfileKeyedAPI, void (RulesRegistry::*notification_callback)(const std::string&), const std::string& extension_id); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "RulesRegistryService"; } diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 7716404..98c8b29 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -150,11 +150,11 @@ namespace Inspect = api::developer_private::Inspect; namespace PackDirectory = api::developer_private::PackDirectory; namespace Reload = api::developer_private::Reload; -static base::LazyInstance<ProfileKeyedAPIFactory<DeveloperPrivateAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<DeveloperPrivateAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<DeveloperPrivateAPI>* +BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>* DeveloperPrivateAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -162,7 +162,7 @@ DeveloperPrivateAPI::GetFactoryInstance() { // static DeveloperPrivateAPI* DeveloperPrivateAPI::Get( content::BrowserContext* context) { - return GetFactoryInstance()->GetForProfile(context); + return GetFactoryInstance()->Get(context); } DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context) diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h index eb31f19..71e5c11 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.h +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h @@ -10,7 +10,6 @@ #include "base/files/file.h" #include "chrome/browser/extensions/api/developer_private/entry_picker.h" #include "chrome/browser/extensions/api/file_system/file_system_api.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/extensions/error_console/error_console.h" #include "chrome/browser/extensions/extension_install_prompt.h" @@ -20,6 +19,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_view_host.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "webkit/browser/fileapi/file_system_context.h" @@ -91,10 +91,11 @@ class DeveloperPrivateEventRouter : public content::NotificationObserver, }; // The profile-keyed service that manages the DeveloperPrivate API. -class DeveloperPrivateAPI : public ProfileKeyedAPI, +class DeveloperPrivateAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: - static ProfileKeyedAPIFactory<DeveloperPrivateAPI>* GetFactoryInstance(); + static BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>* + GetFactoryInstance(); // Convenience method to get the DeveloperPrivateAPI for a profile. static DeveloperPrivateAPI* Get(content::BrowserContext* context); @@ -116,9 +117,9 @@ class DeveloperPrivateAPI : public ProfileKeyedAPI, virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<DeveloperPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "DeveloperPrivateAPI"; } static const bool kServiceRedirectedInIncognito = true; static const bool kServiceIsNULLWhileTesting = true; diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc index a34dc7e..573b124 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc +++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc @@ -216,7 +216,7 @@ scoped_ptr<base::DictionaryValue> DefaultsToValue(ExtensionAction* action) { // ExtensionActionAPI // -static base::LazyInstance<ProfileKeyedAPIFactory<ExtensionActionAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<ExtensionActionAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; ExtensionActionAPI::ExtensionActionAPI(content::BrowserContext* context) { @@ -253,14 +253,14 @@ ExtensionActionAPI::~ExtensionActionAPI() { } // static -ProfileKeyedAPIFactory<ExtensionActionAPI>* +BrowserContextKeyedAPIFactory<ExtensionActionAPI>* ExtensionActionAPI::GetFactoryInstance() { return g_factory.Pointer(); } // static ExtensionActionAPI* ExtensionActionAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<ExtensionActionAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<ExtensionActionAPI>::Get(context); } // static diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.h b/chrome/browser/extensions/api/extension_action/extension_action_api.h index 4ab4773..dc1b2f0 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_api.h +++ b/chrome/browser/extensions/api/extension_action/extension_action_api.h @@ -8,11 +8,11 @@ #include <string> #include "base/memory/weak_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/extensions/extension_action.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" namespace base { class DictionaryValue; @@ -27,7 +27,7 @@ namespace extensions { class ExtensionPrefs; class TabHelper; -class ExtensionActionAPI : public ProfileKeyedAPI { +class ExtensionActionAPI : public BrowserContextKeyedAPI { public: explicit ExtensionActionAPI(content::BrowserContext* context); virtual ~ExtensionActionAPI(); @@ -53,11 +53,12 @@ class ExtensionActionAPI : public ProfileKeyedAPI { const ExtensionAction& browser_action, content::WebContents* web_contents); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ExtensionActionAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<ExtensionActionAPI>* + GetFactoryInstance(); private: - friend class ProfileKeyedAPIFactory<ExtensionActionAPI>; + friend class BrowserContextKeyedAPIFactory<ExtensionActionAPI>; // The DispatchEvent methods forward events to the |profile|'s event router. static void DispatchEventToExtension(content::BrowserContext* context, @@ -81,7 +82,7 @@ class ExtensionActionAPI : public ProfileKeyedAPI { const ExtensionAction& extension_action, content::WebContents* web_contents); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "ExtensionActionAPI"; } DISALLOW_COPY_AND_ASSIGN(ExtensionActionAPI); diff --git a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc index 1c3fb0c8..99bde53 100644 --- a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc +++ b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc @@ -73,7 +73,7 @@ class FeedbackTest : public ExtensionBrowserTest { private: void InvokeFeedbackUI() { extensions::FeedbackPrivateAPI* api = - extensions::FeedbackPrivateAPI::GetFactoryInstance()->GetForProfile( + extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get( browser()->profile()); api->RequestFeedback("Test description", "Test tag", diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc index 36e57d1..bbbb789 100644 --- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc +++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc @@ -42,12 +42,12 @@ using feedback_private::FeedbackInfo; char kFeedbackExtensionId[] = "gfdkimpbcpahaombhbimeihdjnejgicl"; -static base::LazyInstance<ProfileKeyedAPIFactory<FeedbackPrivateAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<FeedbackPrivateAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<FeedbackPrivateAPI>* - FeedbackPrivateAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>* +FeedbackPrivateAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -138,9 +138,8 @@ bool FeedbackPrivateGetStringsFunction::RunImpl() { bool FeedbackPrivateGetUserEmailFunction::RunImpl() { // TODO(rkc): Remove logging once crbug.com/284662 is closed. LOG(WARNING) << "FEEDBACK_DEBUG: User e-mail requested."; - FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->GetService(); + FeedbackService* service = + FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); DCHECK(service); SetResult(new base::StringValue(service->GetUserEmail())); return true; @@ -149,9 +148,8 @@ bool FeedbackPrivateGetUserEmailFunction::RunImpl() { bool FeedbackPrivateGetSystemInformationFunction::RunImpl() { // TODO(rkc): Remove logging once crbug.com/284662 is closed. LOG(WARNING) << "FEEDBACK_DEBUG: System information requested."; - FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->GetService(); + FeedbackService* service = + FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); DCHECK(service); service->GetSystemInformation( base::Bind( @@ -218,9 +216,8 @@ bool FeedbackPrivateSendFeedbackFunction::RunImpl() { } feedback_data->SetAndCompressSystemInfo(sys_logs.Pass()); - FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->GetService(); + FeedbackService* service = + FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); DCHECK(service); if (feedback_info.send_histograms) { diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.h b/chrome/browser/extensions/api/feedback_private/feedback_private_api.h index a33a4a1..830e675 100644 --- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.h +++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.h @@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/common/extensions/api/feedback_private.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "ui/gfx/rect.h" namespace extensions { @@ -18,7 +18,7 @@ class FeedbackService; using extensions::api::feedback_private::SystemInformation; -class FeedbackPrivateAPI : public ProfileKeyedAPI { +class FeedbackPrivateAPI : public BrowserContextKeyedAPI { public: explicit FeedbackPrivateAPI(content::BrowserContext* context); virtual ~FeedbackPrivateAPI(); @@ -28,13 +28,14 @@ class FeedbackPrivateAPI : public ProfileKeyedAPI { const std::string& category_tag, const GURL& page_url); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<FeedbackPrivateAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>* + GetFactoryInstance(); private: - friend class ProfileKeyedAPIFactory<FeedbackPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "FeedbackPrivateAPI"; } diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc index 7be24c81..befb3b3 100644 --- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc @@ -211,11 +211,12 @@ FontSettingsAPI::FontSettingsAPI(content::BrowserContext* context) FontSettingsAPI::~FontSettingsAPI() { } -static base::LazyInstance<ProfileKeyedAPIFactory<FontSettingsAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<FontSettingsAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<FontSettingsAPI>* FontSettingsAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<FontSettingsAPI>* +FontSettingsAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.h b/chrome/browser/extensions/api/font_settings/font_settings_api.h index dfa0dc5..0f65f18 100644 --- a/chrome/browser/extensions/api/font_settings/font_settings_api.h +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h @@ -13,8 +13,8 @@ #include "base/memory/scoped_ptr.h" #include "base/prefs/pref_change_registrar.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" class Profile; @@ -74,18 +74,18 @@ class FontSettingsEventRouter { // The profile-keyed service that manages the font_settings extension API. // This is not an EventRouter::Observer (and does not lazily initialize) because // doing so caused a regression in perf tests. See crbug.com/163466. -class FontSettingsAPI : public ProfileKeyedAPI { +class FontSettingsAPI : public BrowserContextKeyedAPI { public: explicit FontSettingsAPI(content::BrowserContext* context); virtual ~FontSettingsAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<FontSettingsAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<FontSettingsAPI>* GetFactoryInstance(); private: - friend class ProfileKeyedAPIFactory<FontSettingsAPI>; + friend class BrowserContextKeyedAPIFactory<FontSettingsAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "FontSettingsAPI"; } diff --git a/chrome/browser/extensions/api/hid/hid_connection_resource.cc b/chrome/browser/extensions/api/hid/hid_connection_resource.cc index 9fb1ec2..7c92ec8 100644 --- a/chrome/browser/extensions/api/hid/hid_connection_resource.cc +++ b/chrome/browser/extensions/api/hid/hid_connection_resource.cc @@ -15,12 +15,12 @@ namespace extensions { static base::LazyInstance< - ProfileKeyedAPIFactory<ApiResourceManager<HidConnectionResource> > > + BrowserContextKeyedAPIFactory<ApiResourceManager<HidConnectionResource> > > g_factory = LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<HidConnectionResource> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<HidConnectionResource> >* ApiResourceManager<HidConnectionResource>::GetFactoryInstance() { return &g_factory.Get(); } diff --git a/chrome/browser/extensions/api/hid/hid_device_manager.cc b/chrome/browser/extensions/api/hid/hid_device_manager.cc index 016f3fb..fa64170 100644 --- a/chrome/browser/extensions/api/hid/hid_device_manager.cc +++ b/chrome/browser/extensions/api/hid/hid_device_manager.cc @@ -20,10 +20,10 @@ HidDeviceManager::HidDeviceManager(content::BrowserContext* context) HidDeviceManager::~HidDeviceManager() {} // static -ProfileKeyedAPIFactory<HidDeviceManager>* +BrowserContextKeyedAPIFactory<HidDeviceManager>* HidDeviceManager::GetFactoryInstance() { - static base::LazyInstance<ProfileKeyedAPIFactory<HidDeviceManager> > factory = - LAZY_INSTANCE_INITIALIZER; + static base::LazyInstance<BrowserContextKeyedAPIFactory<HidDeviceManager> > + factory = LAZY_INSTANCE_INITIALIZER; return &factory.Get(); } diff --git a/chrome/browser/extensions/api/hid/hid_device_manager.h b/chrome/browser/extensions/api/hid/hid_device_manager.h index 7050844..84a6e30 100644 --- a/chrome/browser/extensions/api/hid/hid_device_manager.h +++ b/chrome/browser/extensions/api/hid/hid_device_manager.h @@ -12,24 +12,24 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/hid.h" #include "device/hid/hid_device_info.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" namespace extensions { -class HidDeviceManager : public ProfileKeyedAPI { +class HidDeviceManager : public BrowserContextKeyedAPI { public: explicit HidDeviceManager(content::BrowserContext* context); virtual ~HidDeviceManager(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<HidDeviceManager>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<HidDeviceManager>* GetFactoryInstance(); // Convenience method to get the HidDeviceManager for a profile. static HidDeviceManager* Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<HidDeviceManager>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<HidDeviceManager>::Get(context); } scoped_ptr<base::ListValue> GetApiDevices(uint16_t vendor_id, @@ -38,7 +38,7 @@ class HidDeviceManager : public ProfileKeyedAPI { bool GetDeviceInfo(int resource_id, device::HidDeviceInfo* device_info); private: - friend class ProfileKeyedAPIFactory<HidDeviceManager>; + friend class BrowserContextKeyedAPIFactory<HidDeviceManager>; static const char* service_name() { return "HidDeviceManager"; } diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc index f7c2226..9ef4b25 100644 --- a/chrome/browser/extensions/api/history/history_api.cc +++ b/chrome/browser/extensions/api/history/history_api.cc @@ -216,16 +216,16 @@ void HistoryAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<HistoryAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<HistoryAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<HistoryAPI>* HistoryAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<HistoryAPI>* HistoryAPI::GetFactoryInstance() { return g_factory.Pointer(); } -template<> -void ProfileKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() { +template <> +void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() { DependsOn(ActivityLog::GetFactoryInstance()); } diff --git a/chrome/browser/extensions/api/history/history_api.h b/chrome/browser/extensions/api/history/history_api.h index ca59871..1a73b24 100644 --- a/chrome/browser/extensions/api/history/history_api.h +++ b/chrome/browser/extensions/api/history/history_api.h @@ -10,12 +10,12 @@ #include "base/compiler_specific.h" #include "base/task/cancelable_task_tracker.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/history/history_service.h" #include "chrome/common/extensions/api/history.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace base { @@ -53,8 +53,7 @@ class HistoryEventRouter : public content::NotificationObserver { DISALLOW_COPY_AND_ASSIGN(HistoryEventRouter); }; -class HistoryAPI : public ProfileKeyedAPI, - public EventRouter::Observer { +class HistoryAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: explicit HistoryAPI(content::BrowserContext* context); virtual ~HistoryAPI(); @@ -62,18 +61,18 @@ class HistoryAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<HistoryAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<HistoryAPI>* GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<HistoryAPI>; + friend class BrowserContextKeyedAPIFactory<HistoryAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "HistoryAPI"; } @@ -83,8 +82,8 @@ class HistoryAPI : public ProfileKeyedAPI, scoped_ptr<HistoryEventRouter> history_event_router_; }; -template<> -void ProfileKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies(); +template <> +void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies(); // Base class for history function APIs. class HistoryFunction : public ChromeAsyncExtensionFunction { diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc index 657405e..a6ea917 100644 --- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc +++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc @@ -19,8 +19,8 @@ namespace OnEnabledChanged = api::hotword_private::OnEnabledChanged; static base::LazyInstance< - ProfileKeyedAPIFactory<HotwordPrivateEventService> > g_factory = - LAZY_INSTANCE_INITIALIZER; + BrowserContextKeyedAPIFactory<HotwordPrivateEventService> > g_factory = + LAZY_INSTANCE_INITIALIZER; HotwordPrivateEventService::HotwordPrivateEventService( content::BrowserContext* context) @@ -39,7 +39,7 @@ void HotwordPrivateEventService::Shutdown() { } // static -ProfileKeyedAPIFactory<HotwordPrivateEventService>* +BrowserContextKeyedAPIFactory<HotwordPrivateEventService>* HotwordPrivateEventService::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.h b/chrome/browser/extensions/api/hotword_private/hotword_private_api.h index 00201be..31ec13f 100644 --- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.h +++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.h @@ -7,9 +7,9 @@ #include "base/prefs/pref_change_registrar.h" #include "base/values.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/common/extensions/api/hotword_private.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class Profile; @@ -17,21 +17,21 @@ namespace extensions { // Listens for changes in disable/enabled state and forwards as an extension // event. -class HotwordPrivateEventService : public ProfileKeyedAPI { +class HotwordPrivateEventService : public BrowserContextKeyedAPI { public: explicit HotwordPrivateEventService(content::BrowserContext* context); virtual ~HotwordPrivateEventService(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. virtual void Shutdown() OVERRIDE; - static ProfileKeyedAPIFactory<HotwordPrivateEventService>* + static BrowserContextKeyedAPIFactory<HotwordPrivateEventService>* GetFactoryInstance(); static const char* service_name(); void OnEnabledChanged(const std::string& pref_name); private: - friend class ProfileKeyedAPIFactory<HotwordPrivateEventService>; + friend class BrowserContextKeyedAPIFactory<HotwordPrivateEventService>; void SignalEvent(); diff --git a/chrome/browser/extensions/api/i18n/i18n_api.h b/chrome/browser/extensions/api/i18n/i18n_api.h index 79b4992..068d9f8 100644 --- a/chrome/browser/extensions/api/i18n/i18n_api.h +++ b/chrome/browser/extensions/api/i18n/i18n_api.h @@ -5,8 +5,8 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class Profile; diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc index bc535aa..d555cbc 100644 --- a/chrome/browser/extensions/api/identity/identity_api.cc +++ b/chrome/browser/extensions/api/identity/identity_api.cc @@ -162,8 +162,7 @@ void IdentityGetAuthTokenFunction::CompleteFunctionWithError( void IdentityGetAuthTokenFunction::StartSigninFlow() { // All cached tokens are invalid because the user is not signed in. IdentityAPI* id_api = - extensions::IdentityAPI::GetFactoryInstance()->GetForProfile( - GetProfile()); + extensions::IdentityAPI::GetFactoryInstance()->Get(GetProfile()); id_api->EraseAllCachedTokens(); // Display a login prompt. If the subsequent mint fails, don't display the // login prompt again. @@ -178,8 +177,7 @@ void IdentityGetAuthTokenFunction::StartMintTokenFlow( // Flows are serialized to prevent excessive traffic to GAIA, and // to consolidate UI pop-ups. IdentityAPI* id_api = - extensions::IdentityAPI::GetFactoryInstance()->GetForProfile( - GetProfile()); + extensions::IdentityAPI::GetFactoryInstance()->Get(GetProfile()); if (!should_prompt_for_scopes_) { // Caller requested no interaction. @@ -207,7 +205,7 @@ void IdentityGetAuthTokenFunction::CompleteMintTokenFlow() { oauth2_info.scopes.end()); extensions::IdentityAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) + ->Get(GetProfile()) ->mint_queue() ->RequestComplete(type, *token_key_, this); } @@ -215,8 +213,7 @@ void IdentityGetAuthTokenFunction::CompleteMintTokenFlow() { void IdentityGetAuthTokenFunction::StartMintToken( IdentityMintRequestQueue::MintType type) { const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension()); - IdentityAPI* id_api = - IdentityAPI::GetFactoryInstance()->GetForProfile(GetProfile()); + IdentityAPI* id_api = IdentityAPI::GetFactoryInstance()->Get(GetProfile()); IdentityTokenCacheValue cache_entry = id_api->GetCachedToken(*token_key_); IdentityTokenCacheValue::CacheValueStatus cache_status = cache_entry.status(); @@ -278,9 +275,8 @@ void IdentityGetAuthTokenFunction::OnMintTokenSuccess( const std::string& access_token, int time_to_live) { IdentityTokenCacheValue token(access_token, base::TimeDelta::FromSeconds(time_to_live)); - IdentityAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->SetCachedToken(*token_key_, token); + IdentityAPI::GetFactoryInstance()->Get(GetProfile())->SetCachedToken( + *token_key_, token); CompleteMintTokenFlow(); CompleteFunctionWithResult(access_token); @@ -295,7 +291,7 @@ void IdentityGetAuthTokenFunction::OnMintTokenFailure( case GoogleServiceAuthError::ACCOUNT_DELETED: case GoogleServiceAuthError::ACCOUNT_DISABLED: extensions::IdentityAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) + ->Get(GetProfile()) ->ReportAuthError(error); if (should_prompt_for_signin_) { // Display a login prompt and try again (once). @@ -314,10 +310,8 @@ void IdentityGetAuthTokenFunction::OnMintTokenFailure( void IdentityGetAuthTokenFunction::OnIssueAdviceSuccess( const IssueAdviceInfo& issue_advice) { - IdentityAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->SetCachedToken(*token_key_, - IdentityTokenCacheValue(issue_advice)); + IdentityAPI::GetFactoryInstance()->Get(GetProfile())->SetCachedToken( + *token_key_, IdentityTokenCacheValue(issue_advice)); CompleteMintTokenFlow(); should_prompt_for_signin_ = false; @@ -381,9 +375,8 @@ void IdentityGetAuthTokenFunction::OnGaiaFlowCompleted( if (!expiration.empty() && base::StringToInt(expiration, &time_to_live)) { IdentityTokenCacheValue token_value( access_token, base::TimeDelta::FromSeconds(time_to_live)); - IdentityAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->SetCachedToken(*token_key_, token_value); + IdentityAPI::GetFactoryInstance()->Get(GetProfile())->SetCachedToken( + *token_key_, token_value); } CompleteMintTokenFlow(); @@ -531,9 +524,8 @@ bool IdentityRemoveCachedAuthTokenFunction::RunImpl() { scoped_ptr<identity::RemoveCachedAuthToken::Params> params( identity::RemoveCachedAuthToken::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - IdentityAPI::GetFactoryInstance() - ->GetForProfile(GetProfile()) - ->EraseCachedToken(GetExtension()->id(), params->details.token); + IdentityAPI::GetFactoryInstance()->Get(GetProfile())->EraseCachedToken( + GetExtension()->id(), params->details.token); return true; } @@ -728,11 +720,11 @@ void IdentityAPI::Shutdown() { account_tracker_.Shutdown(); } -static base::LazyInstance<ProfileKeyedAPIFactory<IdentityAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<IdentityAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -756,7 +748,7 @@ void IdentityAPI::OnAccountSignInChanged(const AccountIds& ids, } template <> -void ProfileKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies() { +void BrowserContextKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies() { DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); } diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h index 461b8bf..44691bd 100644 --- a/chrome/browser/extensions/api/identity/identity_api.h +++ b/chrome/browser/extensions/api/identity/identity_api.h @@ -19,9 +19,9 @@ #include "chrome/browser/extensions/api/identity/identity_mint_queue.h" #include "chrome/browser/extensions/api/identity/identity_signin_flow.h" #include "chrome/browser/extensions/api/identity/web_auth_flow.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/signin/signin_global_error.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "google_apis/gaia/oauth2_mint_token_flow.h" #include "google_apis/gaia/oauth2_token_service.h" @@ -245,7 +245,7 @@ class IdentityTokenCacheValue { base::Time expiration_time_; }; -class IdentityAPI : public ProfileKeyedAPI, +class IdentityAPI : public BrowserContextKeyedAPI, public AccountTracker::Observer { public: typedef std::map<ExtensionTokenKey, IdentityTokenCacheValue> CachedTokens; @@ -269,9 +269,9 @@ class IdentityAPI : public ProfileKeyedAPI, void ReportAuthError(const GoogleServiceAuthError& error); GoogleServiceAuthError GetAuthStatusForTest() const; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. virtual void Shutdown() OVERRIDE; - static ProfileKeyedAPIFactory<IdentityAPI>* GetFactoryInstance(); + static BrowserContextKeyedAPIFactory<IdentityAPI>* GetFactoryInstance(); // AccountTracker::Observer implementation: virtual void OnAccountAdded(const AccountIds& ids) OVERRIDE; @@ -280,9 +280,9 @@ class IdentityAPI : public ProfileKeyedAPI, OVERRIDE; private: - friend class ProfileKeyedAPIFactory<IdentityAPI>; + friend class BrowserContextKeyedAPIFactory<IdentityAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "IdentityAPI"; } @@ -295,7 +295,7 @@ class IdentityAPI : public ProfileKeyedAPI, }; template <> -void ProfileKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies(); +void BrowserContextKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies(); } // namespace extensions diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index 2d7a39b..8173d34 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -373,8 +373,7 @@ class GetAuthTokenFunctionTest : public AsyncExtensionBrowserTest { } IdentityAPI* id_api() { - return IdentityAPI::GetFactoryInstance()->GetForProfile( - browser()->profile()); + return IdentityAPI::GetFactoryInstance()->Get(browser()->profile()); } const std::string GetPrimaryAccountId() { @@ -1056,8 +1055,7 @@ class RemoveCachedAuthTokenFunctionTest : public ExtensionBrowserTest { } IdentityAPI* id_api() { - return IdentityAPI::GetFactoryInstance()->GetForProfile( - browser()->profile()); + return IdentityAPI::GetFactoryInstance()->Get(browser()->profile()); } void SetCachedToken(IdentityTokenCacheValue& token_data) { diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc index e2d8b33..2de8d19 100644 --- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc +++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc @@ -239,14 +239,14 @@ void OperationManager::Observe(int type, } OperationManager* OperationManager::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<OperationManager>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<OperationManager>::Get(context); } -static base::LazyInstance<ProfileKeyedAPIFactory<OperationManager> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<OperationManager> > g_factory = LAZY_INSTANCE_INITIALIZER; -ProfileKeyedAPIFactory<OperationManager>* - OperationManager::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<OperationManager>* +OperationManager::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager.h b/chrome/browser/extensions/api/image_writer_private/operation_manager.h index 4bd4d30..b255a98 100644 --- a/chrome/browser/extensions/api/image_writer_private/operation_manager.h +++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.h @@ -14,10 +14,10 @@ #include "base/timer/timer.h" #include "chrome/browser/extensions/api/image_writer_private/image_writer_private_api.h" #include "chrome/browser/extensions/api/image_writer_private/operation.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/common/extensions/api/image_writer_private.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "url/gurl.h" namespace image_writer_api = extensions::api::image_writer_private; @@ -35,10 +35,9 @@ class Operation; // Manages image writer operations for the current profile. Including clean-up // and message routing. -class OperationManager - : public ProfileKeyedAPI, - public content::NotificationObserver, - public base::SupportsWeakPtr<OperationManager> { +class OperationManager : public BrowserContextKeyedAPI, + public content::NotificationObserver, + public base::SupportsWeakPtr<OperationManager> { public: typedef std::string ExtensionId; @@ -82,9 +81,8 @@ class OperationManager int progress, const std::string& error_message); - // ProfileKeyedAPI - static ProfileKeyedAPIFactory<OperationManager>* - GetFactoryInstance(); + // BrowserContextKeyedAPI + static BrowserContextKeyedAPIFactory<OperationManager>* GetFactoryInstance(); static OperationManager* Get(content::BrowserContext* context); Profile* profile() { return profile_; } @@ -103,7 +101,7 @@ class OperationManager Operation* GetOperation(const ExtensionId& extension_id); void DeleteOperation(const ExtensionId& extension_id); - friend class ProfileKeyedAPIFactory<OperationManager>; + friend class BrowserContextKeyedAPIFactory<OperationManager>; typedef std::map<ExtensionId, scoped_refptr<Operation> > OperationMap; Profile* profile_; diff --git a/chrome/browser/extensions/api/input/input.cc b/chrome/browser/extensions/api/input/input.cc index d0a8ab5..3b81372 100644 --- a/chrome/browser/extensions/api/input/input.cc +++ b/chrome/browser/extensions/api/input/input.cc @@ -159,11 +159,11 @@ InputAPI::InputAPI(content::BrowserContext* context) {} InputAPI::~InputAPI() { } -static base::LazyInstance<ProfileKeyedAPIFactory<InputAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/input/input.h b/chrome/browser/extensions/api/input/input.h index 8e3fa1ad..fd980ea 100644 --- a/chrome/browser/extensions/api/input/input.h +++ b/chrome/browser/extensions/api/input/input.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_EXTENSIONS_API_INPUT_INPUT_H_ #include "base/compiler_specific.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" namespace content { @@ -109,18 +109,18 @@ class VirtualKeyboardPrivateGetKeyboardConfigFunction virtual bool RunImpl() OVERRIDE; }; -class InputAPI : public ProfileKeyedAPI { +class InputAPI : public BrowserContextKeyedAPI { public: explicit InputAPI(content::BrowserContext* context); virtual ~InputAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<InputAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<InputAPI>* GetFactoryInstance(); private: - friend class ProfileKeyedAPIFactory<InputAPI>; + friend class BrowserContextKeyedAPIFactory<InputAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "InputAPI"; } diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc index c9243ed..b5ada22 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc @@ -791,11 +791,11 @@ InputImeAPI::InputImeAPI(content::BrowserContext* context) InputImeAPI::~InputImeAPI() { } -static base::LazyInstance<ProfileKeyedAPIFactory<InputImeAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<InputImeAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chrome/browser/extensions/api/input_ime/input_ime_api.h index 6b2acaf..ad6282d 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.h +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.h @@ -12,10 +12,10 @@ #include "base/memory/singleton.h" #include "base/values.h" #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" #include "extensions/common/extension.h" @@ -213,14 +213,14 @@ class InputImeHideInputViewFunction : public AsyncExtensionFunction { virtual bool RunImpl() OVERRIDE; }; -class InputImeAPI : public ProfileKeyedAPI, +class InputImeAPI : public BrowserContextKeyedAPI, public content::NotificationObserver { public: explicit InputImeAPI(content::BrowserContext* context); virtual ~InputImeAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<InputImeAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<InputImeAPI>* GetFactoryInstance(); // content::NotificationObserver implementation. virtual void Observe(int type, @@ -228,10 +228,10 @@ class InputImeAPI : public ProfileKeyedAPI, const content::NotificationDetails& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<InputImeAPI>; + friend class BrowserContextKeyedAPIFactory<InputImeAPI>; InputImeEventRouter* input_ime_event_router(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "InputImeAPI"; } diff --git a/chrome/browser/extensions/api/location/location_manager.cc b/chrome/browser/extensions/api/location/location_manager.cc index d9dedaa..ad5ebe2 100644 --- a/chrome/browser/extensions/api/location/location_manager.cc +++ b/chrome/browser/extensions/api/location/location_manager.cc @@ -430,17 +430,18 @@ void LocationManager::Observe(int type, } } -static base::LazyInstance<ProfileKeyedAPIFactory<LocationManager> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<LocationManager> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<LocationManager>* LocationManager::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<LocationManager>* +LocationManager::GetFactoryInstance() { return g_factory.Pointer(); } // static LocationManager* LocationManager::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<LocationManager>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<LocationManager>::Get(context); } } // namespace extensions diff --git a/chrome/browser/extensions/api/location/location_manager.h b/chrome/browser/extensions/api/location/location_manager.h index c121cc3..db23a9a 100644 --- a/chrome/browser/extensions/api/location/location_manager.h +++ b/chrome/browser/extensions/api/location/location_manager.h @@ -9,9 +9,9 @@ #include <string> #include "base/memory/weak_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class Profile; @@ -34,10 +34,9 @@ struct Coordinates; // Profile's manager of all location watch requests created by chrome.location // API. Lives in the UI thread. -class LocationManager - : public ProfileKeyedAPI, - public content::NotificationObserver, - public base::SupportsWeakPtr<LocationManager> { +class LocationManager : public BrowserContextKeyedAPI, + public content::NotificationObserver, + public base::SupportsWeakPtr<LocationManager> { public: explicit LocationManager(content::BrowserContext* context); virtual ~LocationManager(); @@ -55,15 +54,15 @@ class LocationManager void RemoveLocationRequest(const std::string& extension_id, const std::string& name); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<LocationManager>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<LocationManager>* GetFactoryInstance(); // Convenience method to get the LocationManager for a profile. static LocationManager* Get(content::BrowserContext* context); private: friend class LocationRequest; - friend class ProfileKeyedAPIFactory<LocationManager>; + friend class BrowserContextKeyedAPIFactory<LocationManager>; typedef std::string ExtensionId; typedef scoped_refptr<LocationRequest> LocationRequestPointer; @@ -86,7 +85,7 @@ class LocationManager const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "LocationManager"; } // Profile for this location manager. diff --git a/chrome/browser/extensions/api/log_private/log_private_api.h b/chrome/browser/extensions/api/log_private/log_private_api.h index 6c37804..4b948aa 100644 --- a/chrome/browser/extensions/api/log_private/log_private_api.h +++ b/chrome/browser/extensions/api/log_private/log_private_api.h @@ -10,12 +10,12 @@ #include "chrome/browser/extensions/api/log_private/filter_handler.h" #include "chrome/browser/extensions/api/log_private/log_parser.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/feedback/system_logs/about_system_logs_fetcher.h" #include "chrome/common/extensions/api/log_private.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "net/base/net_log.h" class Profile; @@ -26,7 +26,7 @@ class BrowserContext; namespace extensions { -class LogPrivateAPI : public ProfileKeyedAPI, +class LogPrivateAPI : public BrowserContextKeyedAPI, public content::NotificationObserver, public net::NetLog::ThreadSafeObserver { public: @@ -39,8 +39,8 @@ class LogPrivateAPI : public ProfileKeyedAPI, void StartNetInternalsWatch(const std::string& extension_id); void StopNetInternalsWatch(const std::string& extension_id); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<LogPrivateAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<LogPrivateAPI>* GetFactoryInstance(); // content::NotificationObserver implementation. virtual void Observe(int type, @@ -48,7 +48,7 @@ class LogPrivateAPI : public ProfileKeyedAPI, const content::NotificationDetails& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<LogPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<LogPrivateAPI>; // ChromeNetLog::ThreadSafeObserver implementation: virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; @@ -60,7 +60,7 @@ class LogPrivateAPI : public ProfileKeyedAPI, void MaybeStopNetInternalLogging(); void StopNetInternalLogging(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "LogPrivateAPI"; } diff --git a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc index 22a2fc3..f067428 100644 --- a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc +++ b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc @@ -68,7 +68,7 @@ void CollectLogInfo( // static LogPrivateAPI* LogPrivateAPI::Get(content::BrowserContext* context) { - return GetFactoryInstance()->GetForProfile(context); + return GetFactoryInstance()->Get(context); } LogPrivateAPI::LogPrivateAPI(content::BrowserContext* context) @@ -95,11 +95,11 @@ void LogPrivateAPI::StopNetInternalsWatch(const std::string& extension_id) { MaybeStopNetInternalLogging(); } -static base::LazyInstance<ProfileKeyedAPIFactory<LogPrivateAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<LogPrivateAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<LogPrivateAPI>* +BrowserContextKeyedAPIFactory<LogPrivateAPI>* LogPrivateAPI::GetFactoryInstance() { return &g_factory.Get(); } diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 8c6aaa6..158bf6f 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -728,11 +728,12 @@ void ManagementAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<ManagementAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<ManagementAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<ManagementAPI>* +ManagementAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/management/management_api.h b/chrome/browser/extensions/api/management/management_api.h index afb61cb..bef6e56 100644 --- a/chrome/browser/extensions/api/management/management_api.h +++ b/chrome/browser/extensions/api/management/management_api.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ #include "base/compiler_specific.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/extensions/extension_install_prompt.h" #include "chrome/browser/extensions/extension_uninstall_dialog.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" class ExtensionService; @@ -190,7 +190,7 @@ class ManagementEventRouter : public content::NotificationObserver { DISALLOW_COPY_AND_ASSIGN(ManagementEventRouter); }; -class ManagementAPI : public ProfileKeyedAPI, +class ManagementAPI : public BrowserContextKeyedAPI, public extensions::EventRouter::Observer { public: explicit ManagementAPI(content::BrowserContext* context); @@ -199,19 +199,19 @@ class ManagementAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ManagementAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<ManagementAPI>* GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded(const extensions::EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<ManagementAPI>; + friend class BrowserContextKeyedAPIFactory<ManagementAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "ManagementAPI"; } diff --git a/chrome/browser/extensions/api/mdns/mdns_api.cc b/chrome/browser/extensions/api/mdns/mdns_api.cc index b8361cc..b67e4a5 100644 --- a/chrome/browser/extensions/api/mdns/mdns_api.cc +++ b/chrome/browser/extensions/api/mdns/mdns_api.cc @@ -44,14 +44,14 @@ MDnsAPI::~MDnsAPI() { // static MDnsAPI* MDnsAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<MDnsAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<MDnsAPI>::Get(context); } -static base::LazyInstance<ProfileKeyedAPIFactory<MDnsAPI> > g_factory = +static base::LazyInstance<BrowserContextKeyedAPIFactory<MDnsAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/mdns/mdns_api.h b/chrome/browser/extensions/api/mdns/mdns_api.h index ba8f34f..c58fcb5 100644 --- a/chrome/browser/extensions/api/mdns/mdns_api.h +++ b/chrome/browser/extensions/api/mdns/mdns_api.h @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" #include "chrome/browser/extensions/api/mdns/dns_sd_registry.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace content { @@ -26,7 +26,7 @@ class DnsSdRegistry; // register listeners for the chrome.mdns extension API. It will use a registry // class to start the mDNS listener process (if necessary) and observe new // service events to dispatch them to registered extensions. -class MDnsAPI : public ProfileKeyedAPI, +class MDnsAPI : public BrowserContextKeyedAPI, public EventRouter::Observer, public DnsSdRegistry::DnsSdObserver { public: @@ -35,8 +35,8 @@ class MDnsAPI : public ProfileKeyedAPI, static MDnsAPI* Get(content::BrowserContext* context); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<MDnsAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<MDnsAPI>* GetFactoryInstance(); // Used to mock out the DnsSdRegistry for testing. void SetDnsSdRegistryForTesting(scoped_ptr<DnsSdRegistry> registry); @@ -46,7 +46,7 @@ class MDnsAPI : public ProfileKeyedAPI, virtual DnsSdRegistry* dns_sd_registry(); private: - friend class ProfileKeyedAPIFactory<MDnsAPI>; + friend class BrowserContextKeyedAPIFactory<MDnsAPI>; // EventRouter::Observer: virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; @@ -57,7 +57,7 @@ class MDnsAPI : public ProfileKeyedAPI, const std::string& service_type, const DnsSdRegistry::DnsSdServiceList& services) OVERRIDE; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "MDnsAPI"; } diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc index 1d21421..7d07dec 100644 --- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc +++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc @@ -277,11 +277,12 @@ void MediaGalleriesEventRouter::Shutdown() { media_scan_manager()->CancelScansForProfile(profile_); } -static base::LazyInstance<ProfileKeyedAPIFactory<MediaGalleriesEventRouter> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<MediaGalleriesEventRouter>* +BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>* MediaGalleriesEventRouter::GetFactoryInstance() { return g_factory.Pointer(); } @@ -292,8 +293,7 @@ MediaGalleriesEventRouter* MediaGalleriesEventRouter::Get( DCHECK(media_file_system_registry() ->GetPreferences(Profile::FromBrowserContext(context)) ->IsInitialized()); - return ProfileKeyedAPIFactory<MediaGalleriesEventRouter>::GetForProfile( - context); + return BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>::Get(context); } bool MediaGalleriesEventRouter::ExtensionHasScanProgressListener( diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h index 86d2924..fea564e9 100644 --- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h +++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h @@ -14,12 +14,12 @@ #include "base/callback_forward.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/media_galleries/media_file_system_registry.h" #include "chrome/browser/media_galleries/media_scan_manager_observer.h" #include "chrome/common/extensions/api/media_galleries.h" #include "components/storage_monitor/media_storage_util.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" namespace MediaGalleries = extensions::api::media_galleries; @@ -39,15 +39,15 @@ class Extension; // The profile-keyed service that manages the media galleries extension API. // Created at the same time as the Profile. This is also the event router. -class MediaGalleriesEventRouter : public ProfileKeyedAPI, +class MediaGalleriesEventRouter : public BrowserContextKeyedAPI, public MediaScanManagerObserver { public: // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<MediaGalleriesEventRouter>* - GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>* + GetFactoryInstance(); // Convenience method to get the MediaGalleriesAPI for a profile. static MediaGalleriesEventRouter* Get(content::BrowserContext* context); @@ -64,7 +64,7 @@ class MediaGalleriesEventRouter : public ProfileKeyedAPI, virtual void OnScanError(const std::string& extension_id) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<MediaGalleriesEventRouter>; + friend class BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>; void DispatchEventToExtension(const std::string& extension_id, const std::string& event_name, @@ -73,7 +73,7 @@ class MediaGalleriesEventRouter : public ProfileKeyedAPI, explicit MediaGalleriesEventRouter(content::BrowserContext* context); virtual ~MediaGalleriesEventRouter(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "MediaGalleriesAPI"; } diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc index b8fd72a..2102334 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc @@ -105,20 +105,20 @@ void MediaGalleriesPrivateAPI::Shutdown() { base::Bind(&HandleProfileShutdownOnFileThread, profile_)); } -static base::LazyInstance<ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>* - MediaGalleriesPrivateAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>* +MediaGalleriesPrivateAPI::GetFactoryInstance() { return g_factory.Pointer(); } // static MediaGalleriesPrivateAPI* MediaGalleriesPrivateAPI::Get( content::BrowserContext* context) { - return ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>::GetForProfile( - context); + return BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>::Get(context); } void MediaGalleriesPrivateAPI::OnListenerAdded( diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h index 0606980..cb7cd0e 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h @@ -11,10 +11,10 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/media_galleries/media_galleries_preferences.h" #include "chrome/common/extensions/api/media_galleries_private.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" class Profile; @@ -29,7 +29,7 @@ class MediaGalleriesPrivateEventRouter; // The profile-keyed service that manages the media galleries private extension // API. Created at the same time as the Profile. -class MediaGalleriesPrivateAPI : public ProfileKeyedAPI, +class MediaGalleriesPrivateAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: explicit MediaGalleriesPrivateAPI(content::BrowserContext* context); @@ -38,8 +38,9 @@ class MediaGalleriesPrivateAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>* + GetFactoryInstance(); // Convenience method to get the MediaGalleriesPrivateAPI for a profile. static MediaGalleriesPrivateAPI* Get(content::BrowserContext* context); @@ -51,11 +52,11 @@ class MediaGalleriesPrivateAPI : public ProfileKeyedAPI, GalleryWatchStateTracker* GetGalleryWatchStateTracker(); private: - friend class ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>; void MaybeInitializeEventRouterAndTracker(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "MediaGalleriesPrivateAPI"; } diff --git a/chrome/browser/extensions/api/messaging/incognito_connectability.cc b/chrome/browser/extensions/api/messaging/incognito_connectability.cc index 194c66c..c8d59ee 100644 --- a/chrome/browser/extensions/api/messaging/incognito_connectability.cc +++ b/chrome/browser/extensions/api/messaging/incognito_connectability.cc @@ -53,8 +53,7 @@ IncognitoConnectability::~IncognitoConnectability() { // static IncognitoConnectability* IncognitoConnectability::Get( content::BrowserContext* context) { - return ProfileKeyedAPIFactory<IncognitoConnectability>::GetForProfile( - context); + return BrowserContextKeyedAPIFactory<IncognitoConnectability>::Get(context); } bool IncognitoConnectability::Query(const Extension* extension, @@ -115,11 +114,12 @@ bool IncognitoConnectability::IsInMap(const Extension* extension, return it != map.end() && it->second.count(origin) > 0; } -static base::LazyInstance<ProfileKeyedAPIFactory<IncognitoConnectability> > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<IncognitoConnectability>* +BrowserContextKeyedAPIFactory<IncognitoConnectability>* IncognitoConnectability::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/messaging/incognito_connectability.h b/chrome/browser/extensions/api/messaging/incognito_connectability.h index 5d7da9a..02e8e25 100644 --- a/chrome/browser/extensions/api/messaging/incognito_connectability.h +++ b/chrome/browser/extensions/api/messaging/incognito_connectability.h @@ -7,7 +7,7 @@ #include <set> -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "url/gurl.h" namespace content { @@ -26,7 +26,7 @@ class Extension; // able to send messages to them, with user constent. For apps, it's essential // we have this functionality because there is no way for them to be enabled in // incognito. -class IncognitoConnectability : public ProfileKeyedAPI { +class IncognitoConnectability : public BrowserContextKeyedAPI { public: // While in scope, immediately either accepts or denies the alerts that show // up, and counts the number of times it was invoked. @@ -61,7 +61,7 @@ class IncognitoConnectability : public ProfileKeyedAPI { const GURL& url); private: - friend class ProfileKeyedAPIFactory<IncognitoConnectability>; + friend class BrowserContextKeyedAPIFactory<IncognitoConnectability>; explicit IncognitoConnectability(content::BrowserContext* context); virtual ~IncognitoConnectability(); @@ -73,8 +73,9 @@ class IncognitoConnectability : public ProfileKeyedAPI { const GURL& origin, const ExtensionToOriginsMap& map); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<IncognitoConnectability>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<IncognitoConnectability>* + GetFactoryInstance(); static const char* service_name() { return "Messaging.IncognitoConnectability"; } diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc index df2742c..182c3c7 100644 --- a/chrome/browser/extensions/api/messaging/message_service.cc +++ b/chrome/browser/extensions/api/messaging/message_service.cc @@ -177,17 +177,18 @@ MessageService::~MessageService() { channels_.clear(); } -static base::LazyInstance<ProfileKeyedAPIFactory<MessageService> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<MessageService> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<MessageService>* MessageService::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<MessageService>* +MessageService::GetFactoryInstance() { return g_factory.Pointer(); } // static MessageService* MessageService::Get(BrowserContext* context) { - return ProfileKeyedAPIFactory<MessageService>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<MessageService>::Get(context); } void MessageService::OpenChannelToExtension( diff --git a/chrome/browser/extensions/api/messaging/message_service.h b/chrome/browser/extensions/api/messaging/message_service.h index 3f51469..d5693f2 100644 --- a/chrome/browser/extensions/api/messaging/message_service.h +++ b/chrome/browser/extensions/api/messaging/message_service.h @@ -15,10 +15,10 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/extensions/api/messaging/message_property_provider.h" #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/common/extensions/api/messaging/message.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class GURL; class Profile; @@ -59,7 +59,7 @@ class LazyBackgroundTaskQueue; // port: an IPC::Message::Process interface and an optional routing_id (in the // case that the port is a tab). The Process is usually either a // RenderProcessHost or a RenderViewHost. -class MessageService : public ProfileKeyedAPI, +class MessageService : public BrowserContextKeyedAPI, public content::NotificationObserver, public NativeMessageProcessHost::Client { public: @@ -112,8 +112,8 @@ class MessageService : public ProfileKeyedAPI, explicit MessageService(content::BrowserContext* context); virtual ~MessageService(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<MessageService>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<MessageService>* GetFactoryInstance(); // Convenience method to get the MessageService for a browser context. static MessageService* Get(content::BrowserContext* context); @@ -160,7 +160,7 @@ class MessageService : public ProfileKeyedAPI, private: friend class MockMessageService; - friend class ProfileKeyedAPIFactory<MessageService>; + friend class BrowserContextKeyedAPIFactory<MessageService>; struct OpenChannelParams; // A map of channel ID to its channel object. @@ -250,7 +250,7 @@ class MessageService : public ProfileKeyedAPI, int port_id, const std::string& error_message); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "MessageService"; } diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index dc098ab..082f96b 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -204,17 +204,17 @@ void OmniboxAPI::Shutdown() { OmniboxAPI::~OmniboxAPI() { } -static base::LazyInstance<ProfileKeyedAPIFactory<OmniboxAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<OmniboxAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<OmniboxAPI>* OmniboxAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<OmniboxAPI>* OmniboxAPI::GetFactoryInstance() { return g_factory.Pointer(); } // static OmniboxAPI* OmniboxAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<OmniboxAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<OmniboxAPI>::Get(context); } void OmniboxAPI::Observe(int type, @@ -279,7 +279,7 @@ void OmniboxAPI::OnTemplateURLsLoaded() { } template <> -void ProfileKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies() { +void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies() { DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); DependsOn(ExtensionPrefsFactory::GetInstance()); DependsOn(TemplateURLServiceFactory::GetInstance()); diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.h b/chrome/browser/extensions/api/omnibox/omnibox_api.h index 5bb0641..391ce9b 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.h +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.h @@ -12,13 +12,13 @@ #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/extensions/extension_icon_manager.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/common/extensions/api/omnibox.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "ui/base/window_open_disposition.h" class Profile; @@ -83,14 +83,14 @@ class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction { virtual bool RunImpl() OVERRIDE; }; -class OmniboxAPI : public ProfileKeyedAPI, +class OmniboxAPI : public BrowserContextKeyedAPI, public content::NotificationObserver { public: explicit OmniboxAPI(content::BrowserContext* context); virtual ~OmniboxAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); // Convenience method to get the OmniboxAPI for a profile. static OmniboxAPI* Get(content::BrowserContext* context); @@ -111,13 +111,13 @@ class OmniboxAPI : public ProfileKeyedAPI, gfx::Image GetOmniboxPopupIcon(const std::string& extension_id); private: - friend class ProfileKeyedAPIFactory<OmniboxAPI>; + friend class BrowserContextKeyedAPIFactory<OmniboxAPI>; typedef std::set<const Extension*> PendingExtensions; void OnTemplateURLsLoaded(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "OmniboxAPI"; } @@ -143,7 +143,7 @@ class OmniboxAPI : public ProfileKeyedAPI, }; template <> -void ProfileKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies(); +void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies(); class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { public: diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc index b153dfd..6ca34e6 100644 --- a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc +++ b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc @@ -72,8 +72,9 @@ class PreferenceWhitelist { base::LazyInstance<PreferenceWhitelist> preference_whitelist = LAZY_INSTANCE_INITIALIZER; -static base::LazyInstance<ProfileKeyedAPIFactory<ChromeDirectSettingAPI> > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI> > g_factory = + LAZY_INSTANCE_INITIALIZER; ChromeDirectSettingAPI::ChromeDirectSettingAPI(content::BrowserContext* context) : profile_(Profile::FromBrowserContext(context)) { @@ -85,9 +86,9 @@ ChromeDirectSettingAPI::~ChromeDirectSettingAPI() {} // BrowserContextKeyedService implementation. void ChromeDirectSettingAPI::Shutdown() {} -// ProfileKeyedAPI implementation. -ProfileKeyedAPIFactory<ChromeDirectSettingAPI>* - ChromeDirectSettingAPI::GetFactoryInstance() { +// BrowserContextKeyedAPI implementation. +BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>* +ChromeDirectSettingAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -110,10 +111,10 @@ bool ChromeDirectSettingAPI::IsPreferenceOnWhitelist( ChromeDirectSettingAPI* ChromeDirectSettingAPI::Get( content::BrowserContext* context) { - return ProfileKeyedAPIFactory<ChromeDirectSettingAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>::Get(context); } -// ProfileKeyedAPI implementation. +// BrowserContextKeyedAPI implementation. const char* ChromeDirectSettingAPI::service_name() { return "ChromeDirectSettingAPI"; } diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h index 44076c2..e4d517e 100644 --- a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h +++ b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__ #include "base/prefs/pref_change_registrar.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" class Profile; @@ -18,7 +18,7 @@ class BrowserContext; namespace extensions { namespace chromedirectsetting { -class ChromeDirectSettingAPI : public ProfileKeyedAPI, +class ChromeDirectSettingAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: explicit ChromeDirectSettingAPI(content::BrowserContext* context); @@ -28,8 +28,9 @@ class ChromeDirectSettingAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ChromeDirectSettingAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>* + GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; @@ -41,9 +42,9 @@ class ChromeDirectSettingAPI : public ProfileKeyedAPI, static ChromeDirectSettingAPI* Get(content::BrowserContext* context); private: - friend class ProfileKeyedAPIFactory<ChromeDirectSettingAPI>; + friend class BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name(); void OnPrefChanged(PrefService* pref_service, const std::string& pref_key); diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc index 93f1c97..b72bbb3 100644 --- a/chrome/browser/extensions/api/preference/preference_api.cc +++ b/chrome/browser/extensions/api/preference/preference_api.cc @@ -400,17 +400,18 @@ void PreferenceAPI::Shutdown() { extension_prefs()->content_settings_store()->RemoveObserver(this); } -static base::LazyInstance<ProfileKeyedAPIFactory<PreferenceAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<PreferenceAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<PreferenceAPI>* PreferenceAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<PreferenceAPI>* +PreferenceAPI::GetFactoryInstance() { return g_factory.Pointer(); } // static PreferenceAPI* PreferenceAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<PreferenceAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<PreferenceAPI>::Get(context); } void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) { @@ -530,7 +531,8 @@ ExtensionPrefValueMap* PreferenceAPI::extension_pref_value_map() { } template <> -void ProfileKeyedAPIFactory<PreferenceAPI>::DeclareFactoryDependencies() { +void +BrowserContextKeyedAPIFactory<PreferenceAPI>::DeclareFactoryDependencies() { DependsOn(ExtensionPrefsFactory::GetInstance()); DependsOn(ExtensionPrefValueMapFactory::GetInstance()); DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); diff --git a/chrome/browser/extensions/api/preference/preference_api.h b/chrome/browser/extensions/api/preference/preference_api.h index 0a5f583..5baf397 100644 --- a/chrome/browser/extensions/api/preference/preference_api.h +++ b/chrome/browser/extensions/api/preference/preference_api.h @@ -9,9 +9,9 @@ #include "base/prefs/pref_change_registrar.h" #include "chrome/browser/extensions/api/content_settings/content_settings_store.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "content/public/browser/notification_observer.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_prefs_scope.h" @@ -89,7 +89,7 @@ class PreferenceAPIBase { }; class PreferenceAPI : public PreferenceAPIBase, - public ProfileKeyedAPI, + public BrowserContextKeyedAPI, public EventRouter::Observer, public ContentSettingsStore::Observer { public: @@ -99,8 +99,8 @@ class PreferenceAPI : public PreferenceAPIBase, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); // Convenience method to get the PreferenceAPI for a profile. static PreferenceAPI* Get(content::BrowserContext* context); @@ -122,7 +122,7 @@ class PreferenceAPI : public PreferenceAPIBase, ExtensionPrefValueMap* value_map); private: - friend class ProfileKeyedAPIFactory<PreferenceAPI>; + friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; // ContentSettingsStore::Observer implementation. virtual void OnContentSettingChanged(const std::string& extension_id, @@ -137,7 +137,7 @@ class PreferenceAPI : public PreferenceAPIBase, Profile* profile_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "PreferenceAPI"; } diff --git a/chrome/browser/extensions/api/processes/processes_api.cc b/chrome/browser/extensions/api/processes/processes_api.cc index c450f03..6e385ce 100644 --- a/chrome/browser/extensions/api/processes/processes_api.cc +++ b/chrome/browser/extensions/api/processes/processes_api.cc @@ -508,17 +508,18 @@ void ProcessesAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<ProcessesAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<ProcessesAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<ProcessesAPI>* ProcessesAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<ProcessesAPI>* +ProcessesAPI::GetFactoryInstance() { return g_factory.Pointer(); } // static ProcessesAPI* ProcessesAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<ProcessesAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<ProcessesAPI>::Get(context); } ProcessesEventRouter* ProcessesAPI::processes_event_router() { diff --git a/chrome/browser/extensions/api/processes/processes_api.h b/chrome/browser/extensions/api/processes/processes_api.h index 0bc67b4..d7859d0 100644 --- a/chrome/browser/extensions/api/processes/processes_api.h +++ b/chrome/browser/extensions/api/processes/processes_api.h @@ -9,13 +9,13 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/task_manager/task_manager.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_widget_host.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace base { @@ -94,7 +94,7 @@ class ProcessesEventRouter : public TaskManagerModelObserver, }; // The profile-keyed service that manages the processes extension API. -class ProcessesAPI : public ProfileKeyedAPI, +class ProcessesAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: explicit ProcessesAPI(content::BrowserContext* context); @@ -103,8 +103,8 @@ class ProcessesAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ProcessesAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<ProcessesAPI>* GetFactoryInstance(); // Convenience method to get the ProcessesAPI for a profile. static ProcessesAPI* Get(content::BrowserContext* context); @@ -116,11 +116,11 @@ class ProcessesAPI : public ProfileKeyedAPI, virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<ProcessesAPI>; + friend class BrowserContextKeyedAPIFactory<ProcessesAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "ProcessesAPI"; } diff --git a/chrome/browser/extensions/api/profile_keyed_api_factory.h b/chrome/browser/extensions/api/profile_keyed_api_factory.h deleted file mode 100644 index 2a03de0..0000000 --- a/chrome/browser/extensions/api/profile_keyed_api_factory.h +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ -#define CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ - -#include "components/browser_context_keyed_service/browser_context_dependency_manager.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 "extensions/browser/extension_system_provider.h" -#include "extensions/browser/extensions_browser_client.h" - -namespace extensions { - -template <typename T> -class ProfileKeyedAPIFactory; - -// Instantiations of ProfileKeyedAPIFactory should use this base class -// and also define a static const char* service_name() function (used in the -// BrowserContextKeyedBaseFactory constructor). These fields should -// be accessible to the ProfileKeyedAPIFactory for the service. -class ProfileKeyedAPI : public BrowserContextKeyedService { - protected: - // Defaults for flags that control ProfileKeyedAPIFactory behavior. - // These can be overridden by subclasses to change that behavior. - // See BrowserContextKeyedBaseFactory for usage. - - // These flags affect what instance is returned when GetForProfile is called - // on an incognito profile. By default, it returns NULL. If - // kServiceRedirectedInIncognito is true, it returns the instance for the - // corresponding regular profile. If kServiceHasOwnInstanceInIncognito - // is true, it returns a separate instance. - static const bool kServiceRedirectedInIncognito = false; - static const bool kServiceHasOwnInstanceInIncognito = false; - - // If set to false, don't start the service at BrowserContext creation time. - // (The default differs from the BrowserContextKeyedBaseFactory default, - // because historically, ProfileKeyedAPIs often do tasks at startup.) - static const bool kServiceIsCreatedWithBrowserContext = true; - - // If set to true, GetForProfile returns NULL for TestingBrowserContexts. - static const bool kServiceIsNULLWhileTesting = false; - - // Users of this factory template must define a GetFactoryInstance() - // and manage their own instances (typically using LazyInstance or - // Singleton), because those cannot be included in more than one - // translation unit (and thus cannot be initialized in a header file). - // - // In the header file, declare GetFactoryInstance(), e.g.: - // class ProcessesAPI { - // ... - // public: - // static ProfileKeyedAPIFactory<ProcessesAPI>* GetFactoryInstance(); - // }; - // - // In the cc file, provide the implementation, e.g.: - // static base::LazyInstance<ProfileKeyedAPIFactory<ProcessesAPI> > - // g_factory = LAZY_INSTANCE_INITIALIZER; - // - // // static - // ProfileKeyedAPIFactory<ProcessesAPI>* - // ProcessesAPI::GetFactoryInstance() { - // return g_factory.Pointer(); - // } -}; - -// A template for factories for BrowserContextKeyedServices that manage -// extension APIs. T is a BrowserContextKeyedService that uses this factory -// template instead of its own separate factory definition to manage its -// per-profile instances. -template <typename T> -class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory { - public: - // TODO(yoz): Rename to Get(). - static T* GetForProfile(content::BrowserContext* context) { - return static_cast<T*>( - T::GetFactoryInstance()->GetServiceForBrowserContext(context, true)); - } - - // Declare dependencies on other factories. - // By default, ExtensionSystemFactory is the only dependency; however, - // specializations can override this. Declare your specialization in - // your header file after the ProfileKeyedAPI class definition. - // Then in the cc file (or inline in the header), define it, e.g.: - // template <> - // ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { - // DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); - // DependsOn(ProfileSyncServiceFactory::GetInstance()); - // } - void DeclareFactoryDependencies() { - DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); - } - - ProfileKeyedAPIFactory() - : BrowserContextKeyedServiceFactory( - T::service_name(), - BrowserContextDependencyManager::GetInstance()) { - DeclareFactoryDependencies(); - } - - virtual ~ProfileKeyedAPIFactory() { - } - - private: - // BrowserContextKeyedServiceFactory implementation. - virtual BrowserContextKeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE { - return new T(context); - } - - // BrowserContextKeyedBaseFactory implementation. - // These can be effectively overridden with template specializations. - virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE { - if (T::kServiceRedirectedInIncognito) - return ExtensionsBrowserClient::Get()->GetOriginalContext(context); - - if (T::kServiceHasOwnInstanceInIncognito) - return context; - - return BrowserContextKeyedServiceFactory::GetBrowserContextToUse(context); - } - - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE { - return T::kServiceIsCreatedWithBrowserContext; - } - - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE { - return T::kServiceIsNULLWhileTesting; - } - - DISALLOW_COPY_AND_ASSIGN(ProfileKeyedAPIFactory); -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc b/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc index cab7362..f3862a9 100644 --- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc +++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc @@ -296,7 +296,7 @@ PushMessagingAPI::~PushMessagingAPI() { // static PushMessagingAPI* PushMessagingAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<PushMessagingAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<PushMessagingAPI>::Get(context); } void PushMessagingAPI::Shutdown() { @@ -304,11 +304,11 @@ void PushMessagingAPI::Shutdown() { handler_.reset(); } -static base::LazyInstance<ProfileKeyedAPIFactory<PushMessagingAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<PushMessagingAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<PushMessagingAPI>* +BrowserContextKeyedAPIFactory<PushMessagingAPI>* PushMessagingAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -364,7 +364,8 @@ void PushMessagingAPI::SetMapperForTest( } template <> -void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { +void +BrowserContextKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); DependsOn(invalidation::InvalidationServiceFactory::GetInstance()); } diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h index 632a572..59f8f69 100644 --- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h +++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h @@ -11,13 +11,13 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetcher.h" #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler_delegate.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/ui/webui/signin/login_ui_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_token_service.h" @@ -111,7 +111,7 @@ class PushMessagingGetChannelIdFunction DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction); }; -class PushMessagingAPI : public ProfileKeyedAPI, +class PushMessagingAPI : public BrowserContextKeyedAPI, public content::NotificationObserver { public: explicit PushMessagingAPI(content::BrowserContext* context); @@ -123,8 +123,8 @@ class PushMessagingAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<PushMessagingAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<PushMessagingAPI>* GetFactoryInstance(); // For testing purposes. PushMessagingEventRouter* GetEventRouterForTest() const { @@ -136,9 +136,9 @@ class PushMessagingAPI : public ProfileKeyedAPI, void SetMapperForTest(scoped_ptr<PushMessagingInvalidationMapper> mapper); private: - friend class ProfileKeyedAPIFactory<PushMessagingAPI>; + friend class BrowserContextKeyedAPIFactory<PushMessagingAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "PushMessagingAPI"; } @@ -162,7 +162,8 @@ class PushMessagingAPI : public ProfileKeyedAPI, }; template <> -void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies(); +void BrowserContextKeyedAPIFactory< + PushMessagingAPI>::DeclareFactoryDependencies(); } // namespace extensions diff --git a/chrome/browser/extensions/api/runtime/runtime_api.cc b/chrome/browser/extensions/api/runtime/runtime_api.cc index 562a76d..465295a 100644 --- a/chrome/browser/extensions/api/runtime/runtime_api.cc +++ b/chrome/browser/extensions/api/runtime/runtime_api.cc @@ -139,11 +139,11 @@ std::string GetUninstallURL(ExtensionPrefs* prefs, /////////////////////////////////////////////////////////////////////////////// -static base::LazyInstance<ProfileKeyedAPIFactory<RuntimeAPI> > g_factory = - LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<RuntimeAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/runtime/runtime_api.h b/chrome/browser/extensions/api/runtime/runtime_api.h index 41695fe..6e65e1b 100644 --- a/chrome/browser/extensions/api/runtime/runtime_api.h +++ b/chrome/browser/extensions/api/runtime/runtime_api.h @@ -7,11 +7,11 @@ #include <string> -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/common/extensions/api/runtime.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/update_observer.h" class Profile; @@ -31,11 +31,11 @@ class ExtensionHost; // Runtime API dispatches onStartup, onInstalled, and similar events to // extensions. There is one instance shared between a browser context and // its related incognito instance. -class RuntimeAPI : public ProfileKeyedAPI, +class RuntimeAPI : public BrowserContextKeyedAPI, public content::NotificationObserver, public extensions::UpdateObserver { public: - static ProfileKeyedAPIFactory<RuntimeAPI>* GetFactoryInstance(); + static BrowserContextKeyedAPIFactory<RuntimeAPI>* GetFactoryInstance(); explicit RuntimeAPI(content::BrowserContext* context); virtual ~RuntimeAPI(); @@ -46,14 +46,14 @@ class RuntimeAPI : public ProfileKeyedAPI, const content::NotificationDetails& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<RuntimeAPI>; + friend class BrowserContextKeyedAPIFactory<RuntimeAPI>; void OnExtensionsReady(); void OnExtensionLoaded(const Extension* extension); void OnExtensionInstalled(const Extension* extension); void OnExtensionUninstalled(const Extension* extension); - // ProfileKeyedAPI implementation: + // BrowserContextKeyedAPI implementation: static const char* service_name() { return "RuntimeAPI"; } static const bool kServiceRedirectedInIncognito = true; static const bool kServiceIsNULLWhileTesting = true; diff --git a/chrome/browser/extensions/api/serial/serial_connection.cc b/chrome/browser/extensions/api/serial/serial_connection.cc index 5004210..05ec47d 100644 --- a/chrome/browser/extensions/api/serial/serial_connection.cc +++ b/chrome/browser/extensions/api/serial/serial_connection.cc @@ -21,13 +21,13 @@ const int kDefaultBufferSize = 4096; } -static base::LazyInstance<ProfileKeyedAPIFactory< - ApiResourceManager<SerialConnection> > > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ApiResourceManager<SerialConnection> > > + g_factory = LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<SerialConnection> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<SerialConnection> >* ApiResourceManager<SerialConnection>::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc b/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc index 91dae3d..06bbf8b 100644 --- a/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc +++ b/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc @@ -25,19 +25,19 @@ bool ShouldPauseOnReceiveError(serial::ReceiveError error) { } // namespace -static base::LazyInstance<ProfileKeyedAPIFactory<SerialEventDispatcher> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<SerialEventDispatcher> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<SerialEventDispatcher>* - SerialEventDispatcher::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<SerialEventDispatcher>* +SerialEventDispatcher::GetFactoryInstance() { return g_factory.Pointer(); } // static SerialEventDispatcher* SerialEventDispatcher::Get( content::BrowserContext* context) { - return ProfileKeyedAPIFactory<SerialEventDispatcher>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<SerialEventDispatcher>::Get(context); } SerialEventDispatcher::SerialEventDispatcher(content::BrowserContext* context) diff --git a/chrome/browser/extensions/api/serial/serial_event_dispatcher.h b/chrome/browser/extensions/api/serial/serial_event_dispatcher.h index 34fd314..83b8938 100644 --- a/chrome/browser/extensions/api/serial/serial_event_dispatcher.h +++ b/chrome/browser/extensions/api/serial/serial_event_dispatcher.h @@ -18,7 +18,7 @@ class SerialConnection; namespace api { // Per-profile dispatcher for events on serial connections. -class SerialEventDispatcher : public ProfileKeyedAPI { +class SerialEventDispatcher : public BrowserContextKeyedAPI { public: explicit SerialEventDispatcher(content::BrowserContext* context); virtual ~SerialEventDispatcher(); @@ -28,14 +28,15 @@ class SerialEventDispatcher : public ProfileKeyedAPI { static SerialEventDispatcher* Get(content::BrowserContext* context); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SerialEventDispatcher>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<SerialEventDispatcher>* + GetFactoryInstance(); private: typedef ApiResourceManager<SerialConnection>::ApiResourceData ConnectionData; - friend class ProfileKeyedAPIFactory<SerialEventDispatcher>; + friend class BrowserContextKeyedAPIFactory<SerialEventDispatcher>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char *service_name() { return "SerialEventDispatcher"; } diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc index 89e8545..09e4c3a 100644 --- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc +++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc @@ -24,7 +24,7 @@ namespace extensions { namespace { -base::LazyInstance<ProfileKeyedAPIFactory<SettingsOverridesAPI> > +base::LazyInstance<BrowserContextKeyedAPIFactory<SettingsOverridesAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; const char kManyStartupPagesWarning[] = "* specifies more than 1 startup URL. " @@ -85,8 +85,8 @@ SettingsOverridesAPI::SettingsOverridesAPI(content::BrowserContext* context) SettingsOverridesAPI::~SettingsOverridesAPI() { } -ProfileKeyedAPIFactory<SettingsOverridesAPI>* - SettingsOverridesAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* +SettingsOverridesAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -221,8 +221,8 @@ void SettingsOverridesAPI::RegisterSearchProvider( } template <> -void ProfileKeyedAPIFactory<SettingsOverridesAPI>:: - DeclareFactoryDependencies() { +void BrowserContextKeyedAPIFactory< + SettingsOverridesAPI>::DeclareFactoryDependencies() { DependsOn(ExtensionPrefsFactory::GetInstance()); DependsOn(PreferenceAPI::GetFactoryInstance()); DependsOn(TemplateURLServiceFactory::GetInstance()); diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h index c4b65e7..b5259ed 100644 --- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h +++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h @@ -9,26 +9,27 @@ #include <string> #include "base/basictypes.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/search_engines/template_url_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class TemplateURL; namespace extensions { -class SettingsOverridesAPI : public ProfileKeyedAPI, +class SettingsOverridesAPI : public BrowserContextKeyedAPI, public content::NotificationObserver { public: explicit SettingsOverridesAPI(content::BrowserContext* context); virtual ~SettingsOverridesAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SettingsOverridesAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* + GetFactoryInstance(); private: - friend class ProfileKeyedAPIFactory<SettingsOverridesAPI>; + friend class BrowserContextKeyedAPIFactory<SettingsOverridesAPI>; typedef std::set<scoped_refptr<const Extension> > PendingExtensions; @@ -48,7 +49,7 @@ class SettingsOverridesAPI : public ProfileKeyedAPI, void OnTemplateURLsLoaded(); void RegisterSearchProvider(const Extension* extension) const; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "SettingsOverridesAPI"; } Profile* profile_; @@ -65,7 +66,8 @@ class SettingsOverridesAPI : public ProfileKeyedAPI, }; template <> -void ProfileKeyedAPIFactory<SettingsOverridesAPI>::DeclareFactoryDependencies(); +void BrowserContextKeyedAPIFactory< + SettingsOverridesAPI>::DeclareFactoryDependencies(); } // namespace extensions diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc index c44298a..e6593b4 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc @@ -92,12 +92,13 @@ void SignedInDevicesChangeObserver::OnDeviceInfoChange() { extension_id_, event.Pass()); } -static base::LazyInstance<ProfileKeyedAPIFactory<SignedInDevicesManager> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<SignedInDevicesManager> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<SignedInDevicesManager>* - SignedInDevicesManager::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<SignedInDevicesManager>* +SignedInDevicesManager::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h index 3bac1af9..291347a 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h @@ -9,8 +9,8 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_vector.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/sync/glue/synced_device_tracker.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" class Profile; @@ -23,7 +23,7 @@ class NotificationRegistrar; } // namespace content namespace extensions { -class ProfileKeyedAPI; +class BrowserContextKeyedAPI; struct EventListenerInfo; @@ -53,18 +53,18 @@ class SignedInDevicesChangeObserver content::NotificationRegistrar registrar_; }; -class SignedInDevicesManager - : public ProfileKeyedAPI, - public content::NotificationObserver, - public EventRouter::Observer { +class SignedInDevicesManager : public BrowserContextKeyedAPI, + public content::NotificationObserver, + public EventRouter::Observer { public: // Default constructor used for testing. SignedInDevicesManager(); explicit SignedInDevicesManager(content::BrowserContext* context); virtual ~SignedInDevicesManager(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SignedInDevicesManager>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<SignedInDevicesManager>* + GetFactoryInstance(); // NotificationObserver: virtual void Observe(int type, @@ -76,9 +76,9 @@ class SignedInDevicesManager virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<SignedInDevicesManager>; + friend class BrowserContextKeyedAPIFactory<SignedInDevicesManager>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "SignedInDevicesManager"; } diff --git a/chrome/browser/extensions/api/socket/socket.cc b/chrome/browser/extensions/api/socket/socket.cc index b9238ae..6d989f5 100644 --- a/chrome/browser/extensions/api/socket/socket.cc +++ b/chrome/browser/extensions/api/socket/socket.cc @@ -17,12 +17,13 @@ namespace extensions { const char kSocketTypeNotSupported[] = "Socket type does not support this API"; -static base::LazyInstance<ProfileKeyedAPIFactory<ApiResourceManager<Socket> > > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ApiResourceManager<Socket> > > g_factory = + LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<Socket> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<Socket> >* ApiResourceManager<Socket>::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/socket/tcp_socket.cc b/chrome/browser/extensions/api/socket/tcp_socket.cc index 057a43a..9a6bd35 100644 --- a/chrome/browser/extensions/api/socket/tcp_socket.cc +++ b/chrome/browser/extensions/api/socket/tcp_socket.cc @@ -17,24 +17,24 @@ const char kTCPSocketTypeInvalidError[] = "Cannot call both connect and listen on the same socket."; const char kSocketListenError[] = "Could not listen on the specified port."; -static base::LazyInstance<ProfileKeyedAPIFactory< - ApiResourceManager<ResumableTCPSocket> > > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableTCPSocket> > > + g_factory = LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<ResumableTCPSocket> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableTCPSocket> >* ApiResourceManager<ResumableTCPSocket>::GetFactoryInstance() { return g_factory.Pointer(); } -static base::LazyInstance<ProfileKeyedAPIFactory< - ApiResourceManager<ResumableTCPServerSocket> > > - g_server_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory< + ApiResourceManager<ResumableTCPServerSocket> > > g_server_factory = + LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<ResumableTCPServerSocket> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableTCPServerSocket> >* ApiResourceManager<ResumableTCPServerSocket>::GetFactoryInstance() { return g_server_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/socket/udp_socket.cc b/chrome/browser/extensions/api/socket/udp_socket.cc index 8580544..ed1e2b9 100644 --- a/chrome/browser/extensions/api/socket/udp_socket.cc +++ b/chrome/browser/extensions/api/socket/udp_socket.cc @@ -14,13 +14,13 @@ namespace extensions { -static base::LazyInstance<ProfileKeyedAPIFactory< - ApiResourceManager<ResumableUDPSocket> > > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableUDPSocket> > > + g_factory = LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<ResumableUDPSocket> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableUDPSocket> >* ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc b/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc index 41361bb..f9d4a48 100644 --- a/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc +++ b/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc @@ -19,12 +19,13 @@ namespace api { using content::BrowserThread; -static base::LazyInstance<ProfileKeyedAPIFactory<TCPSocketEventDispatcher> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<TCPSocketEventDispatcher>* - TCPSocketEventDispatcher::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher>* +TCPSocketEventDispatcher::GetFactoryInstance() { return g_factory.Pointer(); } @@ -33,8 +34,7 @@ TCPSocketEventDispatcher* TCPSocketEventDispatcher::Get( content::BrowserContext* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return ProfileKeyedAPIFactory<TCPSocketEventDispatcher>::GetForProfile( - context); + return BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher>::Get(context); } TCPSocketEventDispatcher::TCPSocketEventDispatcher( diff --git a/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.h b/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.h index 12f3fb6..013a94c 100644 --- a/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.h +++ b/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.h @@ -23,7 +23,7 @@ namespace api { // Dispatch events related to "sockets.tcp" sockets from callback on native // socket instances. There is one instance per profile. class TCPSocketEventDispatcher - : public ProfileKeyedAPI, + : public BrowserContextKeyedAPI, public base::SupportsWeakPtr<TCPSocketEventDispatcher> { public: explicit TCPSocketEventDispatcher(content::BrowserContext* context); @@ -35,16 +35,17 @@ class TCPSocketEventDispatcher // Socket is active again, start receiving data from it. void OnSocketResume(const std::string& extension_id, int socket_id); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<TCPSocketEventDispatcher>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher>* + GetFactoryInstance(); // Convenience method to get the SocketEventDispatcher for a profile. static TCPSocketEventDispatcher* Get(content::BrowserContext* context); private: typedef ApiResourceManager<ResumableTCPSocket>::ApiResourceData SocketData; - friend class ProfileKeyedAPIFactory<TCPSocketEventDispatcher>; - // ProfileKeyedAPI implementation. + friend class BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher>; + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "TCPSocketEventDispatcher"; } diff --git a/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc b/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc index 0140403..924d99e 100644 --- a/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc +++ b/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc @@ -15,13 +15,13 @@ namespace api { using content::BrowserThread; -static - base::LazyInstance<ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher> > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher>* - TCPServerSocketEventDispatcher::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher>* +TCPServerSocketEventDispatcher::GetFactoryInstance() { return g_factory.Pointer(); } @@ -30,7 +30,7 @@ TCPServerSocketEventDispatcher* TCPServerSocketEventDispatcher::Get( content::BrowserContext* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher>::GetForProfile( + return BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher>::Get( context); } diff --git a/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h b/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h index ba4d63d..a8011b4 100644 --- a/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h +++ b/chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h @@ -24,7 +24,7 @@ namespace api { // Dispatch events related to "sockets.tcp" sockets from callback on native // socket instances. There is one instance per profile. class TCPServerSocketEventDispatcher - : public ProfileKeyedAPI, + : public BrowserContextKeyedAPI, public base::SupportsWeakPtr<TCPServerSocketEventDispatcher> { public: explicit TCPServerSocketEventDispatcher(content::BrowserContext* context); @@ -36,8 +36,8 @@ class TCPServerSocketEventDispatcher // Server socket is active again, start accepting connections from it. void OnServerSocketResume(const std::string& extension_id, int socket_id); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher>* + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher>* GetFactoryInstance(); // Convenience method to get the SocketEventDispatcher for a profile. @@ -48,8 +48,8 @@ class TCPServerSocketEventDispatcher ServerSocketData; typedef ApiResourceManager<ResumableTCPSocket>::ApiResourceData ClientSocketData; - friend class ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher>; - // ProfileKeyedAPI implementation. + friend class BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher>; + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "TCPServerSocketEventDispatcher"; } diff --git a/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc b/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc index 1ff0591..ae105e6 100644 --- a/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc +++ b/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc @@ -15,12 +15,13 @@ namespace api { using content::BrowserThread; -static base::LazyInstance<ProfileKeyedAPIFactory<UDPSocketEventDispatcher> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<UDPSocketEventDispatcher>* - UDPSocketEventDispatcher::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>* +UDPSocketEventDispatcher::GetFactoryInstance() { return g_factory.Pointer(); } @@ -29,8 +30,7 @@ UDPSocketEventDispatcher* UDPSocketEventDispatcher::Get( content::BrowserContext* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return ProfileKeyedAPIFactory<UDPSocketEventDispatcher>::GetForProfile( - context); + return BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>::Get(context); } UDPSocketEventDispatcher::UDPSocketEventDispatcher( diff --git a/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.h b/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.h index 463ecef..996ffb1 100644 --- a/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.h +++ b/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.h @@ -23,7 +23,7 @@ namespace api { // Dispatch events related to "sockets.udp" sockets from callback on native // socket instances. There is one instance per profile. class UDPSocketEventDispatcher - : public ProfileKeyedAPI, + : public BrowserContextKeyedAPI, public base::SupportsWeakPtr<UDPSocketEventDispatcher> { public: explicit UDPSocketEventDispatcher(content::BrowserContext* context); @@ -35,16 +35,17 @@ class UDPSocketEventDispatcher // Socket is active again, start receiving data from it. void OnSocketResume(const std::string& extension_id, int socket_id); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<UDPSocketEventDispatcher>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>* + GetFactoryInstance(); // Convenience method to get the SocketEventDispatcher for a profile. static UDPSocketEventDispatcher* Get(content::BrowserContext* context); private: typedef ApiResourceManager<ResumableUDPSocket>::ApiResourceData SocketData; - friend class ProfileKeyedAPIFactory<UDPSocketEventDispatcher>; - // ProfileKeyedAPI implementation. + friend class BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>; + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "UDPSocketEventDispatcher"; } diff --git a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc index 7f182f5..b592484 100644 --- a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc +++ b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc @@ -51,11 +51,12 @@ SpellcheckAPI::SpellcheckAPI(content::BrowserContext* context) { SpellcheckAPI::~SpellcheckAPI() { } -static base::LazyInstance<ProfileKeyedAPIFactory<SpellcheckAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<SpellcheckAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<SpellcheckAPI>* SpellcheckAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<SpellcheckAPI>* +SpellcheckAPI::GetFactoryInstance() { return g_factory.Pointer(); } @@ -98,7 +99,8 @@ void SpellcheckAPI::Observe(int type, } template <> -void ProfileKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { +void +BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { DependsOn(SpellcheckServiceFactory::GetInstance()); } diff --git a/chrome/browser/extensions/api/spellcheck/spellcheck_api.h b/chrome/browser/extensions/api/spellcheck/spellcheck_api.h index 0d9f5b7..c75378a 100644 --- a/chrome/browser/extensions/api/spellcheck/spellcheck_api.h +++ b/chrome/browser/extensions/api/spellcheck/spellcheck_api.h @@ -5,32 +5,32 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_ -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class Profile; namespace extensions { -class SpellcheckAPI : public ProfileKeyedAPI, +class SpellcheckAPI : public BrowserContextKeyedAPI, public content::NotificationObserver { public: explicit SpellcheckAPI(content::BrowserContext* context); virtual ~SpellcheckAPI(); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SpellcheckAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<SpellcheckAPI>* GetFactoryInstance(); private: - friend class ProfileKeyedAPIFactory<SpellcheckAPI>; + friend class BrowserContextKeyedAPIFactory<SpellcheckAPI>; // content::NotificationDelegate implementation. virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "SpellcheckAPI"; } @@ -41,7 +41,7 @@ class SpellcheckAPI : public ProfileKeyedAPI, }; template <> -void ProfileKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies(); +void BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies(); } // namespace extensions diff --git a/chrome/browser/extensions/api/storage/settings_frontend.cc b/chrome/browser/extensions/api/storage/settings_frontend.cc index f00a7f6..a9999c4 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend.cc @@ -34,7 +34,7 @@ namespace storage = api::storage; namespace { -base::LazyInstance<ProfileKeyedAPIFactory<SettingsFrontend> > g_factory = +base::LazyInstance<BrowserContextKeyedAPIFactory<SettingsFrontend> > g_factory = LAZY_INSTANCE_INITIALIZER; // Settings change Observer which forwards changes on to the extension @@ -87,7 +87,7 @@ SettingsStorageQuotaEnforcer::Limits GetSyncLimits() { // static SettingsFrontend* SettingsFrontend::Get(BrowserContext* context) { - return ProfileKeyedAPIFactory<SettingsFrontend>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<SettingsFrontend>::Get(context); } // static @@ -218,10 +218,10 @@ void SettingsFrontend::DisableStorageForTesting( } } -// ProfileKeyedAPI implementation. +// BrowserContextKeyedAPI implementation. // static -ProfileKeyedAPIFactory<SettingsFrontend>* +BrowserContextKeyedAPIFactory<SettingsFrontend>* SettingsFrontend::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/storage/settings_frontend.h b/chrome/browser/extensions/api/storage/settings_frontend.h index abda6c8..82673bb 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend.h +++ b/chrome/browser/extensions/api/storage/settings_frontend.h @@ -10,12 +10,12 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/api/storage/settings_namespace.h" #include "chrome/browser/extensions/api/storage/settings_observer.h" #include "chrome/browser/extensions/api/storage/settings_storage_factory.h" #include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" #include "chrome/browser/extensions/api/storage/value_store_cache.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "sync/api/syncable_service.h" namespace content { @@ -28,7 +28,7 @@ namespace extensions { // to SettingsBackend which lives on the FILE thread. // All public methods, must be called on the UI thread, with the exception of // GetBackendForSync(), which must be called on the FILE thread. -class SettingsFrontend : public ProfileKeyedAPI { +class SettingsFrontend : public BrowserContextKeyedAPI { public: // Returns the current instance for |context|. static SettingsFrontend* Get(content::BrowserContext* context); @@ -63,18 +63,18 @@ class SettingsFrontend : public ProfileKeyedAPI { void DisableStorageForTesting( settings_namespace::Namespace settings_namespace); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SettingsFrontend>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<SettingsFrontend>* GetFactoryInstance(); static const char* service_name(); static const bool kServiceRedirectedInIncognito = true; static const bool kServiceIsNULLWhileTesting = true; private: - friend class ProfileKeyedAPIFactory<SettingsFrontend>; + friend class BrowserContextKeyedAPIFactory<SettingsFrontend>; typedef std::map<settings_namespace::Namespace, ValueStoreCache*> CacheMap; - // Constructor for normal ProfileKeyedAPI usage. + // Constructor for normal BrowserContextKeyedAPI usage. explicit SettingsFrontend(content::BrowserContext* context); // Constructor for tests. diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.cc b/chrome/browser/extensions/api/streams_private/streams_private_api.cc index e2f14dc..4fb7516 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc @@ -26,7 +26,7 @@ namespace streams_private = api::streams_private; // static StreamsPrivateAPI* StreamsPrivateAPI::Get(content::BrowserContext* context) { - return GetFactoryInstance()->GetForProfile(context); + return GetFactoryInstance()->Get(context); } StreamsPrivateAPI::StreamsPrivateAPI(content::BrowserContext* context) @@ -67,12 +67,12 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler( streams_[extension_id][url] = make_linked_ptr(stream.release()); } -static base::LazyInstance<ProfileKeyedAPIFactory<StreamsPrivateAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<StreamsPrivateAPI>* - StreamsPrivateAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* +StreamsPrivateAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.h b/chrome/browser/extensions/api/streams_private/streams_private_api.h index f5b5648..45f0b39 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_api.h +++ b/chrome/browser/extensions/api/streams_private/streams_private_api.h @@ -10,10 +10,10 @@ #include <vector> #include "base/values.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" #include "extensions/common/extension.h" @@ -26,7 +26,7 @@ class StreamHandle; namespace extensions { -class StreamsPrivateAPI : public ProfileKeyedAPI, +class StreamsPrivateAPI : public BrowserContextKeyedAPI, public content::NotificationObserver { public: // Convenience method to get the StreamsPrivateAPI for a profile. @@ -40,8 +40,8 @@ class StreamsPrivateAPI : public ProfileKeyedAPI, scoped_ptr<content::StreamHandle> stream, int64 expected_content_size); - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); // content::NotificationObserver implementation. virtual void Observe(int type, @@ -49,12 +49,12 @@ class StreamsPrivateAPI : public ProfileKeyedAPI, const content::NotificationDetails& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<StreamsPrivateAPI>; + friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>; typedef std::map<std::string, std::map<GURL, linked_ptr<content::StreamHandle> > > StreamMap; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "StreamsPrivateAPI"; } diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc index 7af956a..b548029 100644 --- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc +++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc @@ -25,11 +25,12 @@ using sync_file_system::SyncEventObserver; namespace extensions { -static base::LazyInstance<ProfileKeyedAPIFactory<ExtensionSyncEventObserver> > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver> > g_factory = + LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<ExtensionSyncEventObserver>* +BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>* ExtensionSyncEventObserver::GetFactoryInstance() { return g_factory.Pointer(); } @@ -141,7 +142,7 @@ void ExtensionSyncEventObserver::BroadcastOrDispatchEvent( } template <> -void ProfileKeyedAPIFactory< +void BrowserContextKeyedAPIFactory< ExtensionSyncEventObserver>::DeclareFactoryDependencies() { DependsOn(sync_file_system::SyncFileSystemServiceFactory::GetInstance()); DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h index 0563807..f491335 100644 --- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h +++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h @@ -9,8 +9,8 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/sync_file_system/sync_event_observer.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" namespace content { class BrowserContext; @@ -24,9 +24,9 @@ namespace extensions { // Observes changes in SyncFileSystem and relays events to JS Extension API. class ExtensionSyncEventObserver : public sync_file_system::SyncEventObserver, - public ProfileKeyedAPI { + public BrowserContextKeyedAPI { public: - static ProfileKeyedAPIFactory<ExtensionSyncEventObserver>* + static BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>* GetFactoryInstance(); explicit ExtensionSyncEventObserver(content::BrowserContext* context); @@ -51,13 +51,13 @@ class ExtensionSyncEventObserver : public sync_file_system::SyncEventObserver, sync_file_system::SyncDirection direction) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<ExtensionSyncEventObserver>; + friend class BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>; // Returns an empty string if the extension |app_origin| cannot be found // in the installed extension list. std::string GetExtensionId(const GURL& app_origin); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "ExtensionSyncEventObserver"; } static const bool kServiceIsCreatedWithBrowserContext = false; @@ -74,7 +74,7 @@ class ExtensionSyncEventObserver : public sync_file_system::SyncEventObserver, }; template <> -void ProfileKeyedAPIFactory< +void BrowserContextKeyedAPIFactory< ExtensionSyncEventObserver>::DeclareFactoryDependencies(); } // namespace extensions diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc index 750f55a..bb685a4 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc @@ -50,7 +50,7 @@ sync_file_system::SyncFileSystemService* GetSyncFileSystemService( SyncFileSystemServiceFactory::GetForProfile(profile); DCHECK(service); ExtensionSyncEventObserver* observer = - ExtensionSyncEventObserver::GetFactoryInstance()->GetForProfile(profile); + ExtensionSyncEventObserver::GetFactoryInstance()->Get(profile); DCHECK(observer); observer->InitializeForService(service); return service; diff --git a/chrome/browser/extensions/api/system_info/system_info_api.cc b/chrome/browser/extensions/api/system_info/system_info_api.cc index 208ff21..099cfd5 100644 --- a/chrome/browser/extensions/api/system_info/system_info_api.cc +++ b/chrome/browser/extensions/api/system_info/system_info_api.cc @@ -217,11 +217,12 @@ void RemoveEventListener(const std::string& event_name) { } // namespace -static base::LazyInstance<ProfileKeyedAPIFactory<SystemInfoAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<SystemInfoAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<SystemInfoAPI>* SystemInfoAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<SystemInfoAPI>* +SystemInfoAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/system_info/system_info_api.h b/chrome/browser/extensions/api/system_info/system_info_api.h index a77c117..88e08a9 100644 --- a/chrome/browser/extensions/api/system_info/system_info_api.h +++ b/chrome/browser/extensions/api/system_info/system_info_api.h @@ -5,18 +5,18 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_API_H_ -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace extensions { // A Profile-scoped object which is registered as an observer of EventRouter // to observe the systemInfo event listener arrival/removal. -class SystemInfoAPI : public ProfileKeyedAPI, +class SystemInfoAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SystemInfoAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<SystemInfoAPI>* GetFactoryInstance(); explicit SystemInfoAPI(content::BrowserContext* context); virtual ~SystemInfoAPI(); @@ -29,9 +29,9 @@ class SystemInfoAPI : public ProfileKeyedAPI, virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<SystemInfoAPI>; + friend class BrowserContextKeyedAPIFactory<SystemInfoAPI>; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "SystemInfoAPI"; } diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc index 997ccde..d591d0f 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc @@ -122,14 +122,14 @@ TabCaptureRegistry::~TabCaptureRegistry() { // static TabCaptureRegistry* TabCaptureRegistry::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<TabCaptureRegistry>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<TabCaptureRegistry>::Get(context); } -static base::LazyInstance<ProfileKeyedAPIFactory<TabCaptureRegistry> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<TabCaptureRegistry> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<TabCaptureRegistry>* +BrowserContextKeyedAPIFactory<TabCaptureRegistry>* TabCaptureRegistry::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h index eb0b434..f3b1a6c 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h @@ -10,12 +10,12 @@ #include <vector> #include "base/memory/scoped_vector.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/media/media_capture_devices_dispatcher.h" #include "chrome/common/extensions/api/tab_capture.h" #include "content/public/browser/media_request_state.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" class Profile; @@ -30,7 +30,7 @@ class FullscreenObserver; namespace tab_capture = extensions::api::tab_capture; -class TabCaptureRegistry : public ProfileKeyedAPI, +class TabCaptureRegistry : public BrowserContextKeyedAPI, public content::NotificationObserver, public MediaCaptureDevicesDispatcher::Observer { public: @@ -39,8 +39,9 @@ class TabCaptureRegistry : public ProfileKeyedAPI, static TabCaptureRegistry* Get(content::BrowserContext* context); - // Used by ProfileKeyedAPI. - static ProfileKeyedAPIFactory<TabCaptureRegistry>* GetFactoryInstance(); + // Used by BrowserContextKeyedAPI. + static BrowserContextKeyedAPIFactory<TabCaptureRegistry>* + GetFactoryInstance(); // List all pending, active and stopped capture requests. const RegistryCaptureInfo GetCapturedTabs( @@ -59,13 +60,13 @@ class TabCaptureRegistry : public ProfileKeyedAPI, bool VerifyRequest(int render_process_id, int render_view_id); private: - friend class ProfileKeyedAPIFactory<TabCaptureRegistry>; + friend class BrowserContextKeyedAPIFactory<TabCaptureRegistry>; friend class FullscreenObserver; explicit TabCaptureRegistry(content::BrowserContext* context); virtual ~TabCaptureRegistry(); - // Used by ProfileKeyedAPI. + // Used by BrowserContextKeyedAPI. static const char* service_name() { return "TabCaptureRegistry"; } diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc index 1bbd5bd..a955dd1 100644 --- a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc @@ -48,7 +48,7 @@ TabsWindowsAPI::~TabsWindowsAPI() { // static TabsWindowsAPI* TabsWindowsAPI::Get(content::BrowserContext* context) { - return ProfileKeyedAPIFactory<TabsWindowsAPI>::GetForProfile(context); + return BrowserContextKeyedAPIFactory<TabsWindowsAPI>::Get(context); } TabsEventRouter* TabsWindowsAPI::tabs_event_router() { @@ -70,10 +70,11 @@ void TabsWindowsAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<TabsWindowsAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<TabsWindowsAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; -ProfileKeyedAPIFactory<TabsWindowsAPI>* TabsWindowsAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<TabsWindowsAPI>* +TabsWindowsAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.h b/chrome/browser/extensions/api/tabs/tabs_windows_api.h index d65b4ee..a5d25b2 100644 --- a/chrome/browser/extensions/api/tabs/tabs_windows_api.h +++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.h @@ -6,15 +6,16 @@ #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace extensions { class TabsEventRouter; class WindowsEventRouter; -class TabsWindowsAPI : public ProfileKeyedAPI, public EventRouter::Observer { +class TabsWindowsAPI : public BrowserContextKeyedAPI, + public EventRouter::Observer { public: explicit TabsWindowsAPI(content::BrowserContext* context); virtual ~TabsWindowsAPI(); @@ -28,19 +29,19 @@ class TabsWindowsAPI : public ProfileKeyedAPI, public EventRouter::Observer { // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<TabsWindowsAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<TabsWindowsAPI>* GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded(const extensions::EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<TabsWindowsAPI>; + friend class BrowserContextKeyedAPIFactory<TabsWindowsAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "TabsWindowsAPI"; } diff --git a/chrome/browser/extensions/api/usb/usb_device_resource.cc b/chrome/browser/extensions/api/usb/usb_device_resource.cc index 97b8cbf..a427893d 100644 --- a/chrome/browser/extensions/api/usb/usb_device_resource.cc +++ b/chrome/browser/extensions/api/usb/usb_device_resource.cc @@ -19,13 +19,13 @@ using content::BrowserThread; namespace extensions { -static base::LazyInstance<ProfileKeyedAPIFactory< - ApiResourceManager<UsbDeviceResource> > > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> > > + g_factory = LAZY_INSTANCE_INITIALIZER; // static template <> -ProfileKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> >* +BrowserContextKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> >* ApiResourceManager<UsbDeviceResource>::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index 99392bd..f8b7a60 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -829,11 +829,11 @@ void WebNavigationAPI::Shutdown() { this); } -static base::LazyInstance<ProfileKeyedAPIFactory<WebNavigationAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<WebNavigationAPI> > + g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<WebNavigationAPI>* +BrowserContextKeyedAPIFactory<WebNavigationAPI>* WebNavigationAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h index 9241a1a..effdabf 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h @@ -12,7 +12,6 @@ #include <set> #include "base/compiler_specific.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/profiles/profile.h" @@ -22,6 +21,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "url/gurl.h" @@ -223,7 +223,7 @@ class WebNavigationGetAllFramesFunction : public ChromeSyncExtensionFunction { WEBNAVIGATION_GETALLFRAMES) }; -class WebNavigationAPI : public ProfileKeyedAPI, +class WebNavigationAPI : public BrowserContextKeyedAPI, public extensions::EventRouter::Observer { public: explicit WebNavigationAPI(content::BrowserContext* context); @@ -232,19 +232,19 @@ class WebNavigationAPI : public ProfileKeyedAPI, // BrowserContextKeyedService implementation. virtual void Shutdown() OVERRIDE; - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<WebNavigationAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<WebNavigationAPI>* GetFactoryInstance(); // EventRouter::Observer implementation. virtual void OnListenerAdded(const extensions::EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<WebNavigationAPI>; + friend class BrowserContextKeyedAPIFactory<WebNavigationAPI>; content::BrowserContext* browser_context_; - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. static const char* service_name() { return "WebNavigationAPI"; } diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 738c79f..fd4cd7a 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -421,11 +421,12 @@ WebRequestAPI::~WebRequestAPI() { ->UnregisterObserver(this); } -static base::LazyInstance<ProfileKeyedAPIFactory<WebRequestAPI> > +static base::LazyInstance<BrowserContextKeyedAPIFactory<WebRequestAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<WebRequestAPI>* WebRequestAPI::GetFactoryInstance() { +BrowserContextKeyedAPIFactory<WebRequestAPI>* +WebRequestAPI::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/web_request/web_request_api.h b/chrome/browser/extensions/api/web_request/web_request_api.h index e9d434a..6258ae9 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.h +++ b/chrome/browser/extensions/api/web_request/web_request_api.h @@ -16,9 +16,9 @@ #include "base/time/time.h" #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_function.h" #include "extensions/common/url_pattern_set.h" @@ -59,22 +59,22 @@ class WebRequestRulesRegistry; // work is done by ExtensionWebRequestEventRouter below. This class observes // extension::EventRouter to deal with event listeners. There is one instance // per BrowserContext which is shared with incognito. -class WebRequestAPI : public ProfileKeyedAPI, +class WebRequestAPI : public BrowserContextKeyedAPI, public EventRouter::Observer { public: explicit WebRequestAPI(content::BrowserContext* context); virtual ~WebRequestAPI(); - // ProfileKeyedAPI support: - static ProfileKeyedAPIFactory<WebRequestAPI>* GetFactoryInstance(); + // BrowserContextKeyedAPI support: + static BrowserContextKeyedAPIFactory<WebRequestAPI>* GetFactoryInstance(); // EventRouter::Observer overrides: virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<WebRequestAPI>; + friend class BrowserContextKeyedAPIFactory<WebRequestAPI>; - // ProfileKeyedAPI support: + // BrowserContextKeyedAPI support: static const char* service_name() { return "WebRequestAPI"; } static const bool kServiceRedirectedInIncognito = true; static const bool kServiceIsNULLWhileTesting = true; diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc index 7bf7676..a45e5fe 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc @@ -30,8 +30,8 @@ using media::AudioManager; namespace wap = api::webrtc_audio_private; static base::LazyInstance< - ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService> > g_factory = - LAZY_INSTANCE_INITIALIZER; + BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService> > g_factory = + LAZY_INSTANCE_INITIALIZER; WebrtcAudioPrivateEventService::WebrtcAudioPrivateEventService( content::BrowserContext* context) @@ -53,7 +53,7 @@ void WebrtcAudioPrivateEventService::Shutdown() { } // static -ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>* +BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>* WebrtcAudioPrivateEventService::GetFactoryInstance() { return g_factory.Pointer(); } diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h index 066ab39..be4a9e8 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h @@ -7,10 +7,10 @@ #include "base/memory/ref_counted.h" #include "base/system_monitor/system_monitor.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/common/extensions/api/webrtc_audio_private.h" #include "content/public/browser/render_view_host.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" #include "media/audio/audio_device_name.h" #include "url/gurl.h" @@ -22,15 +22,15 @@ namespace extensions { // Listens for device changes and forwards as an extension event. class WebrtcAudioPrivateEventService - : public ProfileKeyedAPI, + : public BrowserContextKeyedAPI, public base::SystemMonitor::DevicesChangedObserver { public: explicit WebrtcAudioPrivateEventService(content::BrowserContext* context); virtual ~WebrtcAudioPrivateEventService(); - // ProfileKeyedAPI implementation. + // BrowserContextKeyedAPI implementation. virtual void Shutdown() OVERRIDE; - static ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>* + static BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>* GetFactoryInstance(); static const char* service_name(); @@ -39,7 +39,7 @@ class WebrtcAudioPrivateEventService base::SystemMonitor::DeviceType device_type) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>; + friend class BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>; void SignalEvent(); diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc index d8487fe..29f766d 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc @@ -348,8 +348,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, GetAssociatedSink) { IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, TriggerEvent) { WebrtcAudioPrivateEventService* service = - WebrtcAudioPrivateEventService::GetFactoryInstance()->GetForProfile( - profile()); + WebrtcAudioPrivateEventService::GetFactoryInstance()->Get(profile()); // Just trigger, without any extension listening. service->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); |