summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-25 19:24:41 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-25 19:24:41 +0000
commitc4b717a7763a8509b525ecbcf1d0f03d7eed83b6 (patch)
tree4b5064226e2dbde8a0459dc4cc4989f9c140775a /chrome/browser
parent8548c45dc44afeaeaca0044ec9004aa98a16e754 (diff)
downloadchromium_src-c4b717a7763a8509b525ecbcf1d0f03d7eed83b6.zip
chromium_src-c4b717a7763a8509b525ecbcf1d0f03d7eed83b6.tar.gz
chromium_src-c4b717a7763a8509b525ecbcf1d0f03d7eed83b6.tar.bz2
Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 3).
This is the last part. Follows part 1: https://chromiumcodereview.appspot.com/171813010/ BUG=309909 R=jamescook@chromium.org TBR=brettw@chromium.org, dtseng@chromium.org, erg@chromium.org Review URL: https://codereview.chromium.org/174513003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/api/serial/serial_event_dispatcher.cc11
-rw-r--r--chrome/browser/extensions/api/serial/serial_event_dispatcher.h4
-rw-r--r--chrome/browser/extensions/api/sessions/sessions_api.cc15
-rw-r--r--chrome/browser/extensions/api/sessions/sessions_api.h18
-rw-r--r--chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc19
-rw-r--r--chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h2
-rw-r--r--chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc5
-rw-r--r--chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h11
-rw-r--r--chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc12
-rw-r--r--chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.h4
-rw-r--r--chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc13
-rw-r--r--chrome/browser/extensions/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h4
-rw-r--r--chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc12
-rw-r--r--chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.h4
-rw-r--r--chrome/browser/extensions/api/spellcheck/spellcheck_api.cc5
-rw-r--r--chrome/browser/extensions/api/spellcheck/spellcheck_api.h2
-rw-r--r--chrome/browser/extensions/api/streams_private/streams_private_api.cc14
-rw-r--r--chrome/browser/extensions/api/streams_private/streams_private_api.h5
-rw-r--r--chrome/browser/extensions/api/system_info/system_info_api.cc8
-rw-r--r--chrome/browser/extensions/api/system_info/system_info_api.h4
-rw-r--r--chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc8
-rw-r--r--chrome/browser/extensions/api/tab_capture/tab_capture_registry.h8
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_windows_api.cc71
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_windows_api.h6
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.cc41
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.h4
-rw-r--r--chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc8
-rw-r--r--chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h5
-rw-r--r--chrome/browser/extensions/component_loader.cc4
-rw-r--r--chrome/browser/extensions/extension_commands_global_registry.cc20
-rw-r--r--chrome/browser/extensions/extension_commands_global_registry.h15
-rw-r--r--chrome/browser/extensions/extension_keybinding_registry.cc27
-rw-r--r--chrome/browser/extensions/extension_keybinding_registry.h6
-rw-r--r--chrome/browser/extensions/extension_web_ui_override_registrar.cc13
-rw-r--r--chrome/browser/extensions/extension_web_ui_override_registrar.h6
-rw-r--r--chrome/browser/extensions/plugin_manager.cc13
-rw-r--r--chrome/browser/extensions/plugin_manager.h6
-rw-r--r--chrome/browser/extensions/signin/gaia_auth_extension_loader.cc29
-rw-r--r--chrome/browser/extensions/signin/gaia_auth_extension_loader.h10
-rw-r--r--chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc2
-rw-r--r--chrome/browser/search/hotword_service_factory.cc24
-rw-r--r--chrome/browser/search/hotword_service_factory.h18
-rw-r--r--chrome/browser/speech/extension_api/tts_extension_api.cc8
-rw-r--r--chrome/browser/speech/extension_api/tts_extension_api.h9
44 files changed, 267 insertions, 266 deletions
diff --git a/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc b/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc
index 54495d1..91dae3d 100644
--- a/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc
+++ b/chrome/browser/extensions/api/serial/serial_event_dispatcher.cc
@@ -35,15 +35,16 @@ ProfileKeyedAPIFactory<SerialEventDispatcher>*
}
// static
-SerialEventDispatcher* SerialEventDispatcher::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<SerialEventDispatcher>::GetForProfile(profile);
+SerialEventDispatcher* SerialEventDispatcher::Get(
+ content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<SerialEventDispatcher>::GetForProfile(context);
}
-SerialEventDispatcher::SerialEventDispatcher(Profile* profile)
+SerialEventDispatcher::SerialEventDispatcher(content::BrowserContext* context)
: thread_id_(SerialConnection::kThreadId),
- profile_(profile) {
+ profile_(Profile::FromBrowserContext(context)) {
ApiResourceManager<SerialConnection>* manager =
- ApiResourceManager<SerialConnection>::Get(profile);
+ ApiResourceManager<SerialConnection>::Get(profile_);
DCHECK(manager) << "No serial connection manager.";
connections_ = manager->data_;
}
diff --git a/chrome/browser/extensions/api/serial/serial_event_dispatcher.h b/chrome/browser/extensions/api/serial/serial_event_dispatcher.h
index 7ed44f9..f8a6244 100644
--- a/chrome/browser/extensions/api/serial/serial_event_dispatcher.h
+++ b/chrome/browser/extensions/api/serial/serial_event_dispatcher.h
@@ -18,13 +18,13 @@ namespace api {
// Per-profile dispatcher for events on serial connections.
class SerialEventDispatcher : public ProfileKeyedAPI {
public:
- explicit SerialEventDispatcher(Profile* profile);
+ explicit SerialEventDispatcher(content::BrowserContext* context);
virtual ~SerialEventDispatcher();
// Start receiving data and firing events for a connection.
void PollConnection(const std::string& extension_id, int connection_id);
- static SerialEventDispatcher* Get(Profile* profile);
+ static SerialEventDispatcher* Get(content::BrowserContext* context);
// ProfileKeyedAPI implementation.
static ProfileKeyedAPIFactory<SerialEventDispatcher>* GetFactoryInstance();
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc
index 768b126..1174d6c 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.cc
+++ b/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -576,19 +576,4 @@ bool SessionsRestoreFunction::RunImpl() {
: RestoreLocalSession(*session_id, browser);
}
-SessionsAPI::SessionsAPI(Profile* profile) {
-}
-
-SessionsAPI::~SessionsAPI() {
-}
-
-static base::LazyInstance<ProfileKeyedAPIFactory<SessionsAPI> >
- g_factory = LAZY_INSTANCE_INITIALIZER;
-
-// static
-ProfileKeyedAPIFactory<SessionsAPI>*
- SessionsAPI::GetFactoryInstance() {
- return g_factory.Pointer();
-}
-
} // namespace extensions
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.h b/chrome/browser/extensions/api/sessions/sessions_api.h
index c7d9149..e044019 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.h
+++ b/chrome/browser/extensions/api/sessions/sessions_api.h
@@ -7,7 +7,6 @@
#include <string>
-#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_observer.h"
@@ -80,23 +79,6 @@ class SessionsRestoreFunction : public ChromeSyncExtensionFunction {
Browser* browser);
};
-class SessionsAPI : public ProfileKeyedAPI {
- public:
- explicit SessionsAPI(Profile* profile);
- virtual ~SessionsAPI();
-
- // ProfileKeyedAPI implementation.
- static ProfileKeyedAPIFactory<SessionsAPI>* GetFactoryInstance();
- private:
- friend class ProfileKeyedAPIFactory<SessionsAPI>;
-
- // ProfileKeyedAPI implementation.
- static const char* service_name() {
- return "SessionsAPI";
- }
- static const bool kServiceIsNULLWhileTesting = true;
-};
-
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSIONS_API_H__
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 c3d8434..89e8545 100644
--- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
+++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/preference/preference_api.h"
#include "chrome/browser/prefs/session_startup_pref.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.h"
@@ -69,14 +70,16 @@ TemplateURLData ConvertSearchProvider(
}
} // namespace
-SettingsOverridesAPI::SettingsOverridesAPI(Profile* profile)
- : profile_(profile),
- url_service_(TemplateURLServiceFactory::GetForProfile(profile)) {
- DCHECK(profile);
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
- content::Source<Profile>(profile));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile));
+SettingsOverridesAPI::SettingsOverridesAPI(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)),
+ url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) {
+ DCHECK(profile_);
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile_));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_));
}
SettingsOverridesAPI::~SettingsOverridesAPI() {
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 41cdb4d..c4b65e7 100644
--- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
+++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
@@ -21,7 +21,7 @@ namespace extensions {
class SettingsOverridesAPI : public ProfileKeyedAPI,
public content::NotificationObserver {
public:
- explicit SettingsOverridesAPI(Profile* profile);
+ explicit SettingsOverridesAPI(content::BrowserContext* context);
virtual ~SettingsOverridesAPI();
// ProfileKeyedAPI implementation.
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 6a365b5..c44298a 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
@@ -104,8 +104,8 @@ ProfileKeyedAPIFactory<SignedInDevicesManager>*
SignedInDevicesManager::SignedInDevicesManager()
: profile_(NULL) {}
-SignedInDevicesManager::SignedInDevicesManager(Profile* profile)
- : profile_(profile) {
+SignedInDevicesManager::SignedInDevicesManager(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)) {
extensions::EventRouter* router = extensions::ExtensionSystem::Get(
profile_)->event_router();
@@ -169,4 +169,3 @@ void SignedInDevicesManager::Observe(
}
} // namespace extensions
-
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 ea4a5f1..3bac1af9 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
@@ -14,10 +14,12 @@
#include "extensions/browser/event_router.h"
class Profile;
+
namespace content {
- class NotificationDetails;
- class NotificationObserver;
- class NotificationRegistrar;
+class BrowserContext;
+class NotificationDetails;
+class NotificationObserver;
+class NotificationRegistrar;
} // namespace content
namespace extensions {
@@ -58,7 +60,7 @@ class SignedInDevicesManager
public:
// Default constructor used for testing.
SignedInDevicesManager();
- explicit SignedInDevicesManager(Profile* profile);
+ explicit SignedInDevicesManager(content::BrowserContext* context);
virtual ~SignedInDevicesManager();
// ProfileKeyedAPI implementation.
@@ -96,4 +98,3 @@ class SignedInDevicesManager
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_SIGNED_IN_DEVICES_SIGNED_IN_DEVICES_MANAGER_H__
-
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 b0cf650..07a6c19 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
@@ -31,18 +31,20 @@ ProfileKeyedAPIFactory<TCPSocketEventDispatcher>*
}
// static
-TCPSocketEventDispatcher* TCPSocketEventDispatcher::Get(Profile* profile) {
+TCPSocketEventDispatcher* TCPSocketEventDispatcher::Get(
+ content::BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return ProfileKeyedAPIFactory<TCPSocketEventDispatcher>::GetForProfile(
- profile);
+ context);
}
-TCPSocketEventDispatcher::TCPSocketEventDispatcher(Profile* profile)
+TCPSocketEventDispatcher::TCPSocketEventDispatcher(
+ content::BrowserContext* context)
: thread_id_(Socket::kThreadId),
- profile_(profile) {
+ profile_(Profile::FromBrowserContext(context)) {
ApiResourceManager<ResumableTCPSocket>* manager =
- ApiResourceManager<ResumableTCPSocket>::Get(profile);
+ ApiResourceManager<ResumableTCPSocket>::Get(profile_);
DCHECK(manager) << "There is no socket manager. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
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 21e5483..573b8e1 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
@@ -22,7 +22,7 @@ class TCPSocketEventDispatcher
: public ProfileKeyedAPI,
public base::SupportsWeakPtr<TCPSocketEventDispatcher> {
public:
- explicit TCPSocketEventDispatcher(Profile* profile);
+ explicit TCPSocketEventDispatcher(content::BrowserContext* context);
virtual ~TCPSocketEventDispatcher();
// Socket is active, start receving from it.
@@ -35,7 +35,7 @@ class TCPSocketEventDispatcher
static ProfileKeyedAPIFactory<TCPSocketEventDispatcher>* GetFactoryInstance();
// Convenience method to get the SocketEventDispatcher for a profile.
- static TCPSocketEventDispatcher* Get(Profile* profile);
+ static TCPSocketEventDispatcher* Get(content::BrowserContext* context);
private:
typedef ApiResourceManager<ResumableTCPSocket>::ApiResourceData SocketData;
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 91bb58b..e2bbcb8 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
@@ -29,18 +29,19 @@ ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher>*
// static
TCPServerSocketEventDispatcher* TCPServerSocketEventDispatcher::Get(
- Profile* profile) {
+ content::BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return ProfileKeyedAPIFactory<TCPServerSocketEventDispatcher>::GetForProfile(
- profile);
+ context);
}
-TCPServerSocketEventDispatcher::TCPServerSocketEventDispatcher(Profile* profile)
+TCPServerSocketEventDispatcher::TCPServerSocketEventDispatcher(
+ content::BrowserContext* context)
: thread_id_(Socket::kThreadId),
- profile_(profile) {
+ profile_(Profile::FromBrowserContext(context)) {
ApiResourceManager<ResumableTCPServerSocket>* server_manager =
- ApiResourceManager<ResumableTCPServerSocket>::Get(profile);
+ ApiResourceManager<ResumableTCPServerSocket>::Get(profile_);
DCHECK(server_manager) << "There is no server socket manager. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
@@ -48,7 +49,7 @@ TCPServerSocketEventDispatcher::TCPServerSocketEventDispatcher(Profile* profile)
server_sockets_ = server_manager->data_;
ApiResourceManager<ResumableTCPSocket>* client_manager =
- ApiResourceManager<ResumableTCPSocket>::Get(profile);
+ ApiResourceManager<ResumableTCPSocket>::Get(profile_);
DCHECK(client_manager) << "There is no client socket manager. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
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 4d15bc3..68eca9e 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
@@ -23,7 +23,7 @@ class TCPServerSocketEventDispatcher
: public ProfileKeyedAPI,
public base::SupportsWeakPtr<TCPServerSocketEventDispatcher> {
public:
- explicit TCPServerSocketEventDispatcher(Profile* profile);
+ explicit TCPServerSocketEventDispatcher(content::BrowserContext* context);
virtual ~TCPServerSocketEventDispatcher();
// Server socket is active, start accepting connections from it.
@@ -37,7 +37,7 @@ class TCPServerSocketEventDispatcher
GetFactoryInstance();
// Convenience method to get the SocketEventDispatcher for a profile.
- static TCPServerSocketEventDispatcher* Get(Profile* profile);
+ static TCPServerSocketEventDispatcher* Get(content::BrowserContext* context);
private:
typedef ApiResourceManager<ResumableTCPServerSocket>::ApiResourceData
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 cadb1dd..1f1f5bc 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
@@ -27,18 +27,20 @@ ProfileKeyedAPIFactory<UDPSocketEventDispatcher>*
}
// static
-UDPSocketEventDispatcher* UDPSocketEventDispatcher::Get(Profile* profile) {
+UDPSocketEventDispatcher* UDPSocketEventDispatcher::Get(
+ content::BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return ProfileKeyedAPIFactory<UDPSocketEventDispatcher>::GetForProfile(
- profile);
+ context);
}
-UDPSocketEventDispatcher::UDPSocketEventDispatcher(Profile* profile)
+UDPSocketEventDispatcher::UDPSocketEventDispatcher(
+ content::BrowserContext* context)
: thread_id_(Socket::kThreadId),
- profile_(profile) {
+ profile_(Profile::FromBrowserContext(context)) {
ApiResourceManager<ResumableUDPSocket>* manager =
- ApiResourceManager<ResumableUDPSocket>::Get(profile);
+ ApiResourceManager<ResumableUDPSocket>::Get(profile_);
DCHECK(manager) << "There is no socket manager. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
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 0f6e9e8..63baf84 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
@@ -22,7 +22,7 @@ class UDPSocketEventDispatcher
: public ProfileKeyedAPI,
public base::SupportsWeakPtr<UDPSocketEventDispatcher> {
public:
- explicit UDPSocketEventDispatcher(Profile* profile);
+ explicit UDPSocketEventDispatcher(content::BrowserContext* context);
virtual ~UDPSocketEventDispatcher();
// Socket is active, start receving from it.
@@ -35,7 +35,7 @@ class UDPSocketEventDispatcher
static ProfileKeyedAPIFactory<UDPSocketEventDispatcher>* GetFactoryInstance();
// Convenience method to get the SocketEventDispatcher for a profile.
- static UDPSocketEventDispatcher* Get(Profile* profile);
+ static UDPSocketEventDispatcher* Get(content::BrowserContext* context);
private:
typedef ApiResourceManager<ResumableUDPSocket>::ApiResourceData SocketData;
diff --git a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
index 996624a..7f182f5 100644
--- a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
+++ b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
@@ -6,6 +6,7 @@
#include "base/lazy_instance.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h"
@@ -39,8 +40,8 @@ SpellcheckService::DictionaryFormat GetDictionaryFormat(std::string format) {
} // namespace
-
-SpellcheckAPI::SpellcheckAPI(Profile* profile) {
+SpellcheckAPI::SpellcheckAPI(content::BrowserContext* context) {
+ Profile* profile = Profile::FromBrowserContext(context);
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
content::Source<Profile>(profile));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
diff --git a/chrome/browser/extensions/api/spellcheck/spellcheck_api.h b/chrome/browser/extensions/api/spellcheck/spellcheck_api.h
index f14e669..0d9f5b7 100644
--- a/chrome/browser/extensions/api/spellcheck/spellcheck_api.h
+++ b/chrome/browser/extensions/api/spellcheck/spellcheck_api.h
@@ -16,7 +16,7 @@ namespace extensions {
class SpellcheckAPI : public ProfileKeyedAPI,
public content::NotificationObserver {
public:
- explicit SpellcheckAPI(Profile* profile);
+ explicit SpellcheckAPI(content::BrowserContext* context);
virtual ~SpellcheckAPI();
// ProfileKeyedAPI implementation.
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 2d69b27..a4925e4b 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
@@ -29,15 +29,15 @@ const char kOnExecuteMimeTypeHandler[] =
namespace extensions {
// static
-StreamsPrivateAPI* StreamsPrivateAPI::Get(Profile* profile) {
- return GetFactoryInstance()->GetForProfile(profile);
+StreamsPrivateAPI* StreamsPrivateAPI::Get(content::BrowserContext* context) {
+ return GetFactoryInstance()->GetForProfile(context);
}
-StreamsPrivateAPI::StreamsPrivateAPI(Profile* profile)
- : profile_(profile),
- weak_ptr_factory_(this) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile));
+StreamsPrivateAPI::StreamsPrivateAPI(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)), weak_ptr_factory_(this) {
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_));
}
StreamsPrivateAPI::~StreamsPrivateAPI() {
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 ec78445..f5b5648 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.h
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.h
@@ -20,6 +20,7 @@
class Profile;
namespace content {
+class BrowserContext;
class StreamHandle;
}
@@ -29,9 +30,9 @@ class StreamsPrivateAPI : public ProfileKeyedAPI,
public content::NotificationObserver {
public:
// Convenience method to get the StreamsPrivateAPI for a profile.
- static StreamsPrivateAPI* Get(Profile* profile);
+ static StreamsPrivateAPI* Get(content::BrowserContext* context);
- explicit StreamsPrivateAPI(Profile* profile);
+ explicit StreamsPrivateAPI(content::BrowserContext* context);
virtual ~StreamsPrivateAPI();
void ExecuteMimeTypeHandler(const std::string& extension_id,
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 ca89224..208ff21 100644
--- a/chrome/browser/extensions/api/system_info/system_info_api.cc
+++ b/chrome/browser/extensions/api/system_info/system_info_api.cc
@@ -225,8 +225,9 @@ ProfileKeyedAPIFactory<SystemInfoAPI>* SystemInfoAPI::GetFactoryInstance() {
return g_factory.Pointer();
}
-SystemInfoAPI::SystemInfoAPI(Profile* profile) : profile_(profile) {
- EventRouter* router = ExtensionSystem::Get(profile_)->event_router();
+SystemInfoAPI::SystemInfoAPI(content::BrowserContext* context)
+ : browser_context_(context) {
+ EventRouter* router = ExtensionSystem::Get(browser_context_)->event_router();
router->RegisterObserver(this, system_storage::OnAttached::kEventName);
router->RegisterObserver(this, system_storage::OnDetached::kEventName);
router->RegisterObserver(this, system_display::OnDisplayChanged::kEventName);
@@ -236,7 +237,8 @@ SystemInfoAPI::~SystemInfoAPI() {
}
void SystemInfoAPI::Shutdown() {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
void SystemInfoAPI::OnListenerAdded(const EventListenerInfo& details) {
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 d262546..a77c117 100644
--- a/chrome/browser/extensions/api/system_info/system_info_api.h
+++ b/chrome/browser/extensions/api/system_info/system_info_api.h
@@ -18,7 +18,7 @@ class SystemInfoAPI : public ProfileKeyedAPI,
// ProfileKeyedAPI implementation.
static ProfileKeyedAPIFactory<SystemInfoAPI>* GetFactoryInstance();
- explicit SystemInfoAPI(Profile* profile);
+ explicit SystemInfoAPI(content::BrowserContext* context);
virtual ~SystemInfoAPI();
// BrowserContextKeyedService implementation.
@@ -37,7 +37,7 @@ class SystemInfoAPI : public ProfileKeyedAPI,
}
static const bool kServiceIsNULLWhileTesting = true;
- Profile* profile_;
+ content::BrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(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 03420bf..997ccde 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
@@ -105,8 +105,8 @@ TabCaptureRequest::TabCaptureRequest(
TabCaptureRequest::~TabCaptureRequest() {
}
-TabCaptureRegistry::TabCaptureRegistry(Profile* profile)
- : profile_(profile) {
+TabCaptureRegistry::TabCaptureRegistry(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)) {
MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this);
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_UNLOADED,
@@ -121,8 +121,8 @@ TabCaptureRegistry::~TabCaptureRegistry() {
}
// static
-TabCaptureRegistry* TabCaptureRegistry::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<TabCaptureRegistry>::GetForProfile(profile);
+TabCaptureRegistry* TabCaptureRegistry::Get(content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<TabCaptureRegistry>::GetForProfile(context);
}
static base::LazyInstance<ProfileKeyedAPIFactory<TabCaptureRegistry> >
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 efaa37f..eb0b434 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
@@ -19,6 +19,10 @@
class Profile;
+namespace content {
+class BrowserContext;
+}
+
namespace extensions {
struct TabCaptureRequest;
@@ -33,7 +37,7 @@ class TabCaptureRegistry : public ProfileKeyedAPI,
typedef std::vector<std::pair<int, tab_capture::TabCaptureState> >
RegistryCaptureInfo;
- static TabCaptureRegistry* Get(Profile* profile);
+ static TabCaptureRegistry* Get(content::BrowserContext* context);
// Used by ProfileKeyedAPI.
static ProfileKeyedAPIFactory<TabCaptureRegistry>* GetFactoryInstance();
@@ -58,7 +62,7 @@ class TabCaptureRegistry : public ProfileKeyedAPI,
friend class ProfileKeyedAPIFactory<TabCaptureRegistry>;
friend class FullscreenObserver;
- explicit TabCaptureRegistry(Profile* profile);
+ explicit TabCaptureRegistry(content::BrowserContext* context);
virtual ~TabCaptureRegistry();
// Used by ProfileKeyedAPI.
diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
index df6c640..1bbd5bd 100644
--- a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
@@ -7,6 +7,7 @@
#include "base/lazy_instance.h"
#include "chrome/browser/extensions/api/tabs/tabs_event_router.h"
#include "chrome/browser/extensions/api/tabs/windows_event_router.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/tabs.h"
#include "chrome/common/extensions/api/windows.h"
#include "extensions/browser/event_router.h"
@@ -14,64 +15,59 @@
namespace extensions {
-TabsWindowsAPI::TabsWindowsAPI(Profile* profile) : profile_(profile) {
+TabsWindowsAPI::TabsWindowsAPI(content::BrowserContext* context)
+ : browser_context_(context) {
+ EventRouter* event_router =
+ ExtensionSystem::Get(browser_context_)->event_router();
+
// Tabs API Events.
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnCreated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnUpdated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnMoved::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnSelectionChanged::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnActiveChanged::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnActivated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnHighlightChanged::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnHighlighted::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnDetached::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnAttached::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnRemoved::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::tabs::OnReplaced::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnCreated::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnUpdated::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnMoved::kEventName);
+ event_router->RegisterObserver(this,
+ api::tabs::OnSelectionChanged::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnActiveChanged::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnActivated::kEventName);
+ event_router->RegisterObserver(this,
+ api::tabs::OnHighlightChanged::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnHighlighted::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnDetached::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnAttached::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnRemoved::kEventName);
+ event_router->RegisterObserver(this, api::tabs::OnReplaced::kEventName);
// Windows API Events.
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::windows::OnCreated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::windows::OnRemoved::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, api::windows::OnFocusChanged::kEventName);
+ event_router->RegisterObserver(this, api::windows::OnCreated::kEventName);
+ event_router->RegisterObserver(this, api::windows::OnRemoved::kEventName);
+ event_router->RegisterObserver(this,
+ api::windows::OnFocusChanged::kEventName);
}
TabsWindowsAPI::~TabsWindowsAPI() {
}
// static
-TabsWindowsAPI* TabsWindowsAPI::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<TabsWindowsAPI>::GetForProfile(profile);
+TabsWindowsAPI* TabsWindowsAPI::Get(content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<TabsWindowsAPI>::GetForProfile(context);
}
TabsEventRouter* TabsWindowsAPI::tabs_event_router() {
if (!tabs_event_router_.get())
- tabs_event_router_.reset(new TabsEventRouter(profile_));
+ tabs_event_router_.reset(
+ new TabsEventRouter(Profile::FromBrowserContext(browser_context_)));
return tabs_event_router_.get();
}
WindowsEventRouter* TabsWindowsAPI::windows_event_router() {
if (!windows_event_router_)
- windows_event_router_.reset(new WindowsEventRouter(profile_));
+ windows_event_router_.reset(
+ new WindowsEventRouter(Profile::FromBrowserContext(browser_context_)));
return windows_event_router_.get();
}
void TabsWindowsAPI::Shutdown() {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
static base::LazyInstance<ProfileKeyedAPIFactory<TabsWindowsAPI> >
@@ -85,7 +81,8 @@ void TabsWindowsAPI::OnListenerAdded(const EventListenerInfo& details) {
// Initialize the event routers.
tabs_event_router();
windows_event_router();
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.h b/chrome/browser/extensions/api/tabs/tabs_windows_api.h
index cba5874..d65b4ee 100644
--- a/chrome/browser/extensions/api/tabs/tabs_windows_api.h
+++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.h
@@ -16,11 +16,11 @@ class WindowsEventRouter;
class TabsWindowsAPI : public ProfileKeyedAPI, public EventRouter::Observer {
public:
- explicit TabsWindowsAPI(Profile* profile);
+ explicit TabsWindowsAPI(content::BrowserContext* context);
virtual ~TabsWindowsAPI();
// Convenience method to get the TabsWindowsAPI for a profile.
- static TabsWindowsAPI* Get(Profile* profile);
+ static TabsWindowsAPI* Get(content::BrowserContext* context);
TabsEventRouter* tabs_event_router();
WindowsEventRouter* windows_event_router();
@@ -38,7 +38,7 @@ class TabsWindowsAPI : public ProfileKeyedAPI, public EventRouter::Observer {
private:
friend class ProfileKeyedAPIFactory<TabsWindowsAPI>;
- Profile* profile_;
+ content::BrowserContext* browser_context_;
// ProfileKeyedAPI implementation.
static const char* service_name() {
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 94628ab..3d27101 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -798,33 +798,34 @@ bool WebNavigationGetAllFramesFunction::RunImpl() {
return true;
}
-WebNavigationAPI::WebNavigationAPI(Profile* profile)
- : profile_(profile) {
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnBeforeNavigate::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnCommitted::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnCompleted::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+WebNavigationAPI::WebNavigationAPI(content::BrowserContext* context)
+ : browser_context_(context) {
+ EventRouter* event_router =
+ ExtensionSystem::Get(browser_context_)->event_router();
+ event_router->RegisterObserver(this,
+ web_navigation::OnBeforeNavigate::kEventName);
+ event_router->RegisterObserver(this, web_navigation::OnCommitted::kEventName);
+ event_router->RegisterObserver(this, web_navigation::OnCompleted::kEventName);
+ event_router->RegisterObserver(
this, web_navigation::OnCreatedNavigationTarget::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ event_router->RegisterObserver(
this, web_navigation::OnDOMContentLoaded::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ event_router->RegisterObserver(
this, web_navigation::OnHistoryStateUpdated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnErrorOccurred::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ event_router->RegisterObserver(this,
+ web_navigation::OnErrorOccurred::kEventName);
+ event_router->RegisterObserver(
this, web_navigation::OnReferenceFragmentUpdated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnTabReplaced::kEventName);
+ event_router->RegisterObserver(this,
+ web_navigation::OnTabReplaced::kEventName);
}
WebNavigationAPI::~WebNavigationAPI() {
}
void WebNavigationAPI::Shutdown() {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
static base::LazyInstance<ProfileKeyedAPIFactory<WebNavigationAPI> >
@@ -837,8 +838,10 @@ WebNavigationAPI::GetFactoryInstance() {
}
void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
- web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_));
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ web_navigation_event_router_.reset(new WebNavigationEventRouter(
+ Profile::FromBrowserContext(browser_context_)));
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
#endif // OS_ANDROID
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 b445c34..9241a1a 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
@@ -226,7 +226,7 @@ class WebNavigationGetAllFramesFunction : public ChromeSyncExtensionFunction {
class WebNavigationAPI : public ProfileKeyedAPI,
public extensions::EventRouter::Observer {
public:
- explicit WebNavigationAPI(Profile* profile);
+ explicit WebNavigationAPI(content::BrowserContext* context);
virtual ~WebNavigationAPI();
// BrowserContextKeyedService implementation.
@@ -242,7 +242,7 @@ class WebNavigationAPI : public ProfileKeyedAPI,
private:
friend class ProfileKeyedAPIFactory<WebNavigationAPI>;
- Profile* profile_;
+ content::BrowserContext* browser_context_;
// ProfileKeyedAPI implementation.
static const char* service_name() {
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 4854390..2d7175e 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
@@ -32,7 +32,8 @@ static base::LazyInstance<
LAZY_INSTANCE_INITIALIZER;
WebrtcAudioPrivateEventService::WebrtcAudioPrivateEventService(
- Profile* profile) : profile_(profile) {
+ content::BrowserContext* context)
+ : browser_context_(context) {
// In unit tests, the SystemMonitor may not be created.
base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
if (system_monitor)
@@ -77,12 +78,11 @@ void WebrtcAudioPrivateEventService::OnDevicesChanged(
void WebrtcAudioPrivateEventService::SignalEvent() {
using api::webrtc_audio_private::OnSinksChanged::kEventName;
- EventRouter* router =
- ExtensionSystem::Get(profile_)->event_router();
+ EventRouter* router = ExtensionSystem::Get(browser_context_)->event_router();
if (!router || !router->HasEventListener(kEventName))
return;
ExtensionService* extension_service =
- ExtensionSystem::Get(profile_)->extension_service();
+ ExtensionSystem::Get(browser_context_)->extension_service();
const ExtensionSet* extensions = extension_service->extensions();
for (ExtensionSet::const_iterator it = extensions->begin();
it != extensions->end(); ++it) {
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 1e400b7..840888c 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
@@ -9,7 +9,6 @@
#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/browser/profiles/profile.h"
#include "chrome/common/extensions/api/webrtc_audio_private.h"
#include "content/public/browser/render_view_host.h"
#include "media/audio/audio_device_name.h"
@@ -22,7 +21,7 @@ class WebrtcAudioPrivateEventService
: public ProfileKeyedAPI,
public base::SystemMonitor::DevicesChangedObserver {
public:
- explicit WebrtcAudioPrivateEventService(Profile* profile);
+ explicit WebrtcAudioPrivateEventService(content::BrowserContext* context);
virtual ~WebrtcAudioPrivateEventService();
// ProfileKeyedAPI implementation.
@@ -40,7 +39,7 @@ class WebrtcAudioPrivateEventService
void SignalEvent();
- Profile* profile_;
+ content::BrowserContext* browser_context_;
};
// Common base for WebrtcAudioPrivate functions, that provides a
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index 7929617..1996146 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -15,7 +15,6 @@
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/hotword_service_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -296,8 +295,7 @@ void ComponentLoader::AddHangoutServicesExtension() {
}
void ComponentLoader::AddHotwordHelperExtension() {
- Profile* profile = static_cast<Profile*>(browser_context_);
- if (HotwordServiceFactory::IsHotwordAllowed(profile)) {
+ if (HotwordServiceFactory::IsHotwordAllowed(browser_context_)) {
Add(IDR_HOTWORD_HELPER_MANIFEST,
base::FilePath(FILE_PATH_LITERAL("hotword_helper")));
}
diff --git a/chrome/browser/extensions/extension_commands_global_registry.cc b/chrome/browser/extensions/extension_commands_global_registry.cc
index 24c5b7e..17b4da0 100644
--- a/chrome/browser/extensions/extension_commands_global_registry.cc
+++ b/chrome/browser/extensions/extension_commands_global_registry.cc
@@ -7,16 +7,16 @@
#include "base/lazy_instance.h"
#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/extensions/global_shortcut_listener.h"
-#include "chrome/browser/profiles/profile.h"
#include "extensions/common/extension.h"
namespace extensions {
ExtensionCommandsGlobalRegistry::ExtensionCommandsGlobalRegistry(
- Profile* profile)
- : ExtensionKeybindingRegistry(
- profile, ExtensionKeybindingRegistry::ALL_EXTENSIONS, NULL),
- profile_(profile) {
+ content::BrowserContext* context)
+ : ExtensionKeybindingRegistry(context,
+ ExtensionKeybindingRegistry::ALL_EXTENSIONS,
+ NULL),
+ browser_context_(context) {
Init();
}
@@ -39,10 +39,10 @@ ExtensionCommandsGlobalRegistry::GetFactoryInstance() {
}
// static
-ExtensionCommandsGlobalRegistry*
-ExtensionCommandsGlobalRegistry::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<
- ExtensionCommandsGlobalRegistry>::GetForProfile(profile);
+ExtensionCommandsGlobalRegistry* ExtensionCommandsGlobalRegistry::Get(
+ content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<ExtensionCommandsGlobalRegistry>::GetForProfile(
+ context);
}
void ExtensionCommandsGlobalRegistry::AddExtensionKeybinding(
@@ -53,7 +53,7 @@ void ExtensionCommandsGlobalRegistry::AddExtensionKeybinding(
return;
extensions::CommandService* command_service =
- extensions::CommandService::Get(profile_);
+ extensions::CommandService::Get(browser_context_);
// Add all the active global keybindings, if any.
extensions::CommandMap commands;
if (!command_service->GetNamedCommands(
diff --git a/chrome/browser/extensions/extension_commands_global_registry.h b/chrome/browser/extensions/extension_commands_global_registry.h
index 04e8bd8..c84e2f2 100644
--- a/chrome/browser/extensions/extension_commands_global_registry.h
+++ b/chrome/browser/extensions/extension_commands_global_registry.h
@@ -14,13 +14,12 @@
#include "chrome/browser/extensions/global_shortcut_listener.h"
#include "ui/base/accelerators/accelerator.h"
-class Profile;
-
-namespace extensions {
-class Extension;
+namespace content {
+class BrowserContext;
}
namespace extensions {
+class Extension;
// ExtensionCommandsGlobalRegistry is a class that handles the cross-platform
// implementation of the global shortcut registration for the Extension Commands
@@ -40,9 +39,9 @@ class ExtensionCommandsGlobalRegistry
// Convenience method to get the ExtensionCommandsGlobalRegistry for a
// profile.
- static ExtensionCommandsGlobalRegistry* Get(Profile* profile);
+ static ExtensionCommandsGlobalRegistry* Get(content::BrowserContext* context);
- explicit ExtensionCommandsGlobalRegistry(Profile* profile);
+ explicit ExtensionCommandsGlobalRegistry(content::BrowserContext* context);
virtual ~ExtensionCommandsGlobalRegistry();
private:
@@ -65,8 +64,8 @@ class ExtensionCommandsGlobalRegistry
// registered for has been pressed.
virtual void OnKeyPressed(const ui::Accelerator& accelerator) OVERRIDE;
- // Weak pointer to our profile. Not owned by us.
- Profile* profile_;
+ // Weak pointer to our browser context. Not owned by us.
+ content::BrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(ExtensionCommandsGlobalRegistry);
};
diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc
index b383376..5217165 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.cc
+++ b/chrome/browser/extensions/extension_keybinding_registry.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/browser_context.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_set.h"
@@ -18,18 +19,24 @@
namespace extensions {
ExtensionKeybindingRegistry::ExtensionKeybindingRegistry(
- Profile* profile, ExtensionFilter extension_filter, Delegate* delegate)
- : profile_(profile),
+ content::BrowserContext* context,
+ ExtensionFilter extension_filter,
+ Delegate* delegate)
+ : profile_(Profile::FromBrowserContext(context)),
extension_filter_(extension_filter),
delegate_(delegate) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
- content::Source<Profile>(profile->GetOriginalProfile()));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile->GetOriginalProfile()));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED,
- content::Source<Profile>(profile->GetOriginalProfile()));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED,
- content::Source<Profile>(profile->GetOriginalProfile()));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile_->GetOriginalProfile()));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_->GetOriginalProfile()));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED,
+ content::Source<Profile>(profile_->GetOriginalProfile()));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED,
+ content::Source<Profile>(profile_->GetOriginalProfile()));
}
ExtensionKeybindingRegistry::~ExtensionKeybindingRegistry() {
diff --git a/chrome/browser/extensions/extension_keybinding_registry.h b/chrome/browser/extensions/extension_keybinding_registry.h
index 2e4c754..c89efc2 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.h
+++ b/chrome/browser/extensions/extension_keybinding_registry.h
@@ -17,6 +17,10 @@
class Profile;
+namespace content {
+class BrowserContext;
+}
+
namespace ui {
class Accelerator;
}
@@ -45,7 +49,7 @@ class ExtensionKeybindingRegistry : public content::NotificationObserver {
// If |extension_filter| is not ALL_EXTENSIONS, only keybindings by
// by extensions that match the filter will be registered.
- ExtensionKeybindingRegistry(Profile* profile,
+ ExtensionKeybindingRegistry(content::BrowserContext* context,
ExtensionFilter extension_filter,
Delegate* delegate);
diff --git a/chrome/browser/extensions/extension_web_ui_override_registrar.cc b/chrome/browser/extensions/extension_web_ui_override_registrar.cc
index d559c68..d9d28d8 100644
--- a/chrome/browser/extensions/extension_web_ui_override_registrar.cc
+++ b/chrome/browser/extensions/extension_web_ui_override_registrar.cc
@@ -14,11 +14,14 @@
namespace extensions {
ExtensionWebUIOverrideRegistrar::ExtensionWebUIOverrideRegistrar(
- Profile* profile) : profile_(profile) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
- content::Source<Profile>(profile));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile));
+ content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)) {
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile_));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_));
}
ExtensionWebUIOverrideRegistrar::~ExtensionWebUIOverrideRegistrar() {
diff --git a/chrome/browser/extensions/extension_web_ui_override_registrar.h b/chrome/browser/extensions/extension_web_ui_override_registrar.h
index 782cc51..eca634f 100644
--- a/chrome/browser/extensions/extension_web_ui_override_registrar.h
+++ b/chrome/browser/extensions/extension_web_ui_override_registrar.h
@@ -12,12 +12,16 @@
class Profile;
+namespace content {
+class BrowserContext;
+}
+
namespace extensions {
class ExtensionWebUIOverrideRegistrar : public ProfileKeyedAPI,
public content::NotificationObserver {
public:
- explicit ExtensionWebUIOverrideRegistrar(Profile* profile);
+ explicit ExtensionWebUIOverrideRegistrar(content::BrowserContext* context);
virtual ~ExtensionWebUIOverrideRegistrar();
// ProfileKeyedAPI implementation.
diff --git a/chrome/browser/extensions/plugin_manager.cc b/chrome/browser/extensions/plugin_manager.cc
index 0c88dc6..66faab6 100644
--- a/chrome/browser/extensions/plugin_manager.cc
+++ b/chrome/browser/extensions/plugin_manager.cc
@@ -25,11 +25,14 @@ static const char* kNaClPluginMimeType = "application/x-nacl";
namespace extensions {
-PluginManager::PluginManager(Profile* profile) : profile_(profile) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
- content::Source<Profile>(profile));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile));
+PluginManager::PluginManager(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)) {
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile_));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_));
}
PluginManager::~PluginManager() {
diff --git a/chrome/browser/extensions/plugin_manager.h b/chrome/browser/extensions/plugin_manager.h
index 096f7a6..71f91d6 100644
--- a/chrome/browser/extensions/plugin_manager.h
+++ b/chrome/browser/extensions/plugin_manager.h
@@ -13,12 +13,16 @@
class GURL;
class Profile;
+namespace content {
+class BrowserContext;
+}
+
namespace extensions {
class PluginManager : public ProfileKeyedAPI,
public content::NotificationObserver {
public:
- explicit PluginManager(Profile* profile);
+ explicit PluginManager(content::BrowserContext* context);
virtual ~PluginManager();
// ProfileKeyedAPI implementation.
diff --git a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
index 627d2b3..6b88f54 100644
--- a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
+++ b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_system.h"
#include "grit/browser_resources.h"
@@ -25,21 +25,22 @@
#include "chromeos/chromeos_switches.h"
#endif
+using content::BrowserContext;
using content::BrowserThread;
namespace {
-extensions::ComponentLoader* GetComponentLoader(Profile* profile) {
+extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) {
extensions::ExtensionSystem* extension_system =
- extensions::ExtensionSystem::Get(profile);
+ extensions::ExtensionSystem::Get(context);
ExtensionService* extension_service = extension_system->extension_service();
return extension_service->component_loader();
}
-void LoadGaiaAuthExtension(Profile* profile) {
+void LoadGaiaAuthExtension(BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- extensions::ComponentLoader* component_loader = GetComponentLoader(profile);
+ extensions::ComponentLoader* component_loader = GetComponentLoader(context);
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
base::FilePath auth_extension_path =
@@ -75,19 +76,19 @@ void LoadGaiaAuthExtension(Profile* profile) {
base::FilePath(FILE_PATH_LITERAL("gaia_auth")));
}
-void UnloadGaiaAuthExtension(Profile* profile) {
+void UnloadGaiaAuthExtension(BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
const char kGaiaAuthId[] = "mfffpogegjflfpflabcdkioaeobkgjik";
- GetComponentLoader(profile)->Remove(kGaiaAuthId);
+ GetComponentLoader(context)->Remove(kGaiaAuthId);
}
} // namespace
namespace extensions {
-GaiaAuthExtensionLoader::GaiaAuthExtensionLoader(Profile* profile)
- : profile_(profile), load_count_(0) {}
+GaiaAuthExtensionLoader::GaiaAuthExtensionLoader(BrowserContext* context)
+ : browser_context_(context), load_count_(0) {}
GaiaAuthExtensionLoader::~GaiaAuthExtensionLoader() {
DCHECK_EQ(0, load_count_);
@@ -95,27 +96,27 @@ GaiaAuthExtensionLoader::~GaiaAuthExtensionLoader() {
void GaiaAuthExtensionLoader::LoadIfNeeded() {
if (load_count_ == 0)
- LoadGaiaAuthExtension(profile_);
+ LoadGaiaAuthExtension(browser_context_);
++load_count_;
}
void GaiaAuthExtensionLoader::UnloadIfNeeded() {
--load_count_;
if (load_count_ == 0)
- UnloadGaiaAuthExtension(profile_);
+ UnloadGaiaAuthExtension(browser_context_);
}
void GaiaAuthExtensionLoader::Shutdown() {
if (load_count_ > 0) {
- UnloadGaiaAuthExtension(profile_);
+ UnloadGaiaAuthExtension(browser_context_);
load_count_ = 0;
}
}
// static
-GaiaAuthExtensionLoader* GaiaAuthExtensionLoader::Get(Profile* profile) {
+GaiaAuthExtensionLoader* GaiaAuthExtensionLoader::Get(BrowserContext* context) {
return ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>::GetForProfile(
- profile);
+ context);
}
static base::LazyInstance<ProfileKeyedAPIFactory<GaiaAuthExtensionLoader> >
diff --git a/chrome/browser/extensions/signin/gaia_auth_extension_loader.h b/chrome/browser/extensions/signin/gaia_auth_extension_loader.h
index 5d8c9eb..e8f328e 100644
--- a/chrome/browser/extensions/signin/gaia_auth_extension_loader.h
+++ b/chrome/browser/extensions/signin/gaia_auth_extension_loader.h
@@ -8,14 +8,16 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-class Profile;
+namespace content {
+class BrowserContext;
+}
namespace extensions {
// Manages and registers the gaia auth extension with the extension system.
class GaiaAuthExtensionLoader : public ProfileKeyedAPI {
public:
- explicit GaiaAuthExtensionLoader(Profile* profile);
+ explicit GaiaAuthExtensionLoader(content::BrowserContext* context);
virtual ~GaiaAuthExtensionLoader();
// Load the gaia auth extension if the extension is not loaded yet.
@@ -23,7 +25,7 @@ class GaiaAuthExtensionLoader : public ProfileKeyedAPI {
// Unload the gaia auth extension if no pending reference.
void UnloadIfNeeded();
- static GaiaAuthExtensionLoader* Get(Profile* profile);
+ static GaiaAuthExtensionLoader* Get(content::BrowserContext* context);
// ProfileKeyedAPI implementation.
static ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>* GetFactoryInstance();
@@ -40,7 +42,7 @@ class GaiaAuthExtensionLoader : public ProfileKeyedAPI {
}
static const bool kServiceRedirectedInIncognito = true;
- Profile* profile_;
+ content::BrowserContext* browser_context_;
int load_count_;
DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader);
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index 887fae6..81813a5 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -86,7 +86,6 @@
#include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h"
#include "chrome/browser/extensions/api/runtime/runtime_api_factory.h"
#include "chrome/browser/extensions/api/serial/serial_connection.h"
-#include "chrome/browser/extensions/api/sessions/sessions_api.h"
#include "chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h"
#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h"
#include "chrome/browser/extensions/api/socket/socket.h"
@@ -310,7 +309,6 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
extensions::PushMessagingAPI::GetFactoryInstance();
extensions::RendererStartupHelperFactory::GetInstance();
extensions::RuntimeAPIFactory::GetInstance();
- extensions::SessionsAPI::GetFactoryInstance();
extensions::SettingsOverridesAPI::GetFactoryInstance();
extensions::SignedInDevicesManager::GetFactoryInstance();
#if defined(ENABLE_SPELLCHECK)
diff --git a/chrome/browser/search/hotword_service_factory.cc b/chrome/browser/search/hotword_service_factory.cc
index 571b4b3..eb79553 100644
--- a/chrome/browser/search/hotword_service_factory.cc
+++ b/chrome/browser/search/hotword_service_factory.cc
@@ -5,17 +5,19 @@
#include "chrome/browser/search/hotword_service_factory.h"
#include "base/prefs/pref_service.h"
-#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/hotword_service.h"
#include "chrome/common/pref_names.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "components/user_prefs/pref_registry_syncable.h"
+#include "content/public/browser/browser_context.h"
+
+using content::BrowserContext;
// static
-HotwordService* HotwordServiceFactory::GetForProfile(Profile* profile) {
+HotwordService* HotwordServiceFactory::GetForProfile(BrowserContext* context) {
return static_cast<HotwordService*>(
- GetInstance()->GetServiceForBrowserContext(profile, true));
+ GetInstance()->GetServiceForBrowserContext(context, true));
}
// static
@@ -24,20 +26,20 @@ HotwordServiceFactory* HotwordServiceFactory::GetInstance() {
}
// static
-bool HotwordServiceFactory::ShouldShowOptInPopup(Profile* profile) {
- HotwordService* hotword_service = GetForProfile(profile);
+bool HotwordServiceFactory::ShouldShowOptInPopup(BrowserContext* context) {
+ HotwordService* hotword_service = GetForProfile(context);
return hotword_service && hotword_service->ShouldShowOptInPopup();
}
// static
-bool HotwordServiceFactory::IsServiceAvailable(Profile* profile) {
- HotwordService* hotword_service = GetForProfile(profile);
+bool HotwordServiceFactory::IsServiceAvailable(BrowserContext* context) {
+ HotwordService* hotword_service = GetForProfile(context);
return hotword_service && hotword_service->IsServiceAvailable();
}
// static
-bool HotwordServiceFactory::IsHotwordAllowed(Profile* profile) {
- HotwordService* hotword_service = GetForProfile(profile);
+bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) {
+ HotwordService* hotword_service = GetForProfile(context);
return hotword_service && hotword_service->IsHotwordAllowed();
}
@@ -62,6 +64,6 @@ void HotwordServiceFactory::RegisterProfilePrefs(
}
BrowserContextKeyedService* HotwordServiceFactory::BuildServiceInstanceFor(
- content::BrowserContext* profile) const {
- return new HotwordService(static_cast<Profile*>(profile));
+ BrowserContext* context) const {
+ return new HotwordService(Profile::FromBrowserContext(context));
}
diff --git a/chrome/browser/search/hotword_service_factory.h b/chrome/browser/search/hotword_service_factory.h
index 0eb6a74..5310a0e 100644
--- a/chrome/browser/search/hotword_service_factory.h
+++ b/chrome/browser/search/hotword_service_factory.h
@@ -15,19 +15,19 @@ class Profile;
// Singleton that owns all HotwordServices and associates them with Profiles.
class HotwordServiceFactory : public BrowserContextKeyedServiceFactory {
public:
- // Returns the HotwordService for |profile|.
- static HotwordService* GetForProfile(Profile* profile);
+ // Returns the HotwordService for |context|.
+ static HotwordService* GetForProfile(content::BrowserContext* context);
static HotwordServiceFactory* GetInstance();
- // Returns true to show the opt in pop up for that profile.
- static bool ShouldShowOptInPopup(Profile* profile);
+ // Returns true to show the opt in pop up for |context|.
+ static bool ShouldShowOptInPopup(content::BrowserContext* context);
- // Returns true if the hotwording service is available for |profile|.
- static bool IsServiceAvailable(Profile* profile);
+ // Returns true if the hotwording service is available for |context|.
+ static bool IsServiceAvailable(content::BrowserContext* context);
- // Returns true if hotwording is allowed for |profile|.
- static bool IsHotwordAllowed(Profile* profile);
+ // Returns true if hotwording is allowed for |context|.
+ static bool IsHotwordAllowed(content::BrowserContext* context);
private:
friend struct DefaultSingletonTraits<HotwordServiceFactory>;
@@ -39,7 +39,7 @@ class HotwordServiceFactory : public BrowserContextKeyedServiceFactory {
virtual void RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
- content::BrowserContext* profile) const OVERRIDE;
+ content::BrowserContext* context) const OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory);
};
diff --git a/chrome/browser/speech/extension_api/tts_extension_api.cc b/chrome/browser/speech/extension_api/tts_extension_api.cc
index e9fd625..dcb5e3a 100644
--- a/chrome/browser/speech/extension_api/tts_extension_api.cc
+++ b/chrome/browser/speech/extension_api/tts_extension_api.cc
@@ -10,7 +10,6 @@
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_function_registry.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
#include "chrome/browser/speech/extension_api/tts_extension_api_constants.h"
#include "chrome/browser/speech/tts_controller.h"
@@ -342,12 +341,7 @@ bool TtsGetVoicesFunction::RunImpl() {
return true;
}
-// static
-TtsAPI* TtsAPI::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<TtsAPI>::GetForProfile(profile);
-}
-
-TtsAPI::TtsAPI(Profile* profile) {
+TtsAPI::TtsAPI(content::BrowserContext* context) {
ExtensionFunctionRegistry* registry =
ExtensionFunctionRegistry::GetInstance();
registry->RegisterFunction<ExtensionTtsEngineSendTtsEventFunction>();
diff --git a/chrome/browser/speech/extension_api/tts_extension_api.h b/chrome/browser/speech/extension_api/tts_extension_api.h
index a8f3c19..4746e09 100644
--- a/chrome/browser/speech/extension_api/tts_extension_api.h
+++ b/chrome/browser/speech/extension_api/tts_extension_api.h
@@ -11,7 +11,9 @@
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/speech/tts_controller.h"
-class Profile;
+namespace content {
+class BrowserContext;
+}
const char *TtsEventTypeToString(TtsEventType event_type);
TtsEventType TtsEventTypeFromString(const std::string& str);
@@ -62,12 +64,9 @@ class TtsGetVoicesFunction : public ChromeSyncExtensionFunction {
class TtsAPI : public ProfileKeyedAPI {
public:
- explicit TtsAPI(Profile* profile);
+ explicit TtsAPI(content::BrowserContext* context);
virtual ~TtsAPI();
- // Convenience method to get the TtsAPI for a profile.
- static TtsAPI* Get(Profile* profile);
-
// ProfileKeyedAPI implementation.
static ProfileKeyedAPIFactory<TtsAPI>* GetFactoryInstance();