Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1806)

Unified Diff: chrome/browser/extensions/api/cast_channel/cast_channel_api.cc

Issue 171813010: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 1). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_context_ Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/cast_channel/cast_channel_api.cc
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 c0d5e57fd95a71ff6e61599f20f45f4191510496..e6dc135ff6dd428cf76f16442f9190065c396245 100644
--- a/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc
+++ b/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/cast_channel/cast_socket.h"
#include "chrome/browser/net/chrome_net_log.h"
-#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
@@ -44,14 +43,14 @@ std::string ParamToString(const T& info) {
} // namespace
-CastChannelAPI::CastChannelAPI(Profile* profile)
- : profile_(profile) {
- DCHECK(profile_);
+CastChannelAPI::CastChannelAPI(content::BrowserContext* context)
+ : browser_context_(context) {
+ DCHECK(browser_context_);
}
// static
-CastChannelAPI* CastChannelAPI::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<CastChannelAPI>::GetForProfile(profile);
+CastChannelAPI* CastChannelAPI::Get(content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<CastChannelAPI>::GetForProfile(context);
}
static base::LazyInstance<ProfileKeyedAPIFactory<CastChannelAPI> > g_factory =
@@ -85,8 +84,9 @@ void CastChannelAPI::OnError(const CastSocket* socket,
channel_info.error_state = error;
scoped_ptr<base::ListValue> results = OnError::Create(channel_info);
scoped_ptr<Event> event(new Event(OnError::kEventName, results.Pass()));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(socket->owner_extension_id(), event.Pass());
+ extensions::ExtensionSystem::Get(browser_context_)
+ ->event_router()
+ ->DispatchEventToExtension(socket->owner_extension_id(), event.Pass());
}
void CastChannelAPI::OnMessage(const CastSocket* socket,
@@ -99,8 +99,9 @@ void CastChannelAPI::OnMessage(const CastSocket* socket,
VLOG(1) << "Sending message " << ParamToString(message_info)
<< " to channel " << ParamToString(channel_info);
scoped_ptr<Event> event(new Event(OnMessage::kEventName, results.Pass()));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(socket->owner_extension_id(), event.Pass());
+ extensions::ExtensionSystem::Get(browser_context_)
+ ->event_router()
+ ->DispatchEventToExtension(socket->owner_extension_id(), event.Pass());
}
CastChannelAPI::~CastChannelAPI() {}

Powered by Google App Engine
This is Rietveld 408576698