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

Unified Diff: chrome/browser/extensions/api/mdns/mdns_api.cc

Issue 166053003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: | 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/mdns/mdns_api.cc
diff --git a/chrome/browser/extensions/api/mdns/mdns_api.cc b/chrome/browser/extensions/api/mdns/mdns_api.cc
index 05ef707f9c53ee35f39a7958ec938b8da52992d3..b8361cc81f781b38580890f6537d421f32af80de 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_api.cc
@@ -30,9 +30,9 @@ bool IsServiceTypeWhitelisted(const std::string& service_type) {
} // namespace
-MDnsAPI::MDnsAPI(Profile* profile) : profile_(profile) {
- DCHECK(profile_);
- ExtensionSystem::Get(profile)->event_router()->RegisterObserver(
+MDnsAPI::MDnsAPI(content::BrowserContext* context) : browser_context_(context) {
+ DCHECK(browser_context_);
+ ExtensionSystem::Get(context)->event_router()->RegisterObserver(
this, mdns::OnServiceList::kEventName);
}
@@ -43,8 +43,8 @@ MDnsAPI::~MDnsAPI() {
}
// static
-MDnsAPI* MDnsAPI::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<MDnsAPI>::GetForProfile(profile);
+MDnsAPI* MDnsAPI::Get(content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<MDnsAPI>::GetForProfile(context);
}
static base::LazyInstance<ProfileKeyedAPIFactory<MDnsAPI> > g_factory =
@@ -84,8 +84,10 @@ void MDnsAPI::UpdateMDnsListeners(const EventListenerInfo& details) {
// Check all listeners for service type filers.
const EventListenerMap::ListenerList& listeners =
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- listeners().GetEventListenersByName(details.event_name);
+ extensions::ExtensionSystem::Get(browser_context_)
+ ->event_router()
+ ->listeners()
+ .GetEventListenersByName(details.event_name);
for (EventListenerMap::ListenerList::const_iterator it = listeners.begin();
it != listeners.end(); ++it) {
base::DictionaryValue* filter = ((*it)->filter.get());
@@ -140,15 +142,16 @@ void MDnsAPI::OnDnsSdEvent(const std::string& service_type,
scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args);
scoped_ptr<Event> event(
new Event(mdns::OnServiceList::kEventName, results.Pass()));
- event->restrict_to_browser_context = profile_;
+ event->restrict_to_browser_context = browser_context_;
event->filter_info.SetServiceType(service_type);
VLOG(1) << "Broadcasting OnServiceList event: " << event.get();
// TODO(justinlin): To avoid having listeners without filters getting all
// events, modify API to have this event require filters.
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- BroadcastEvent(event.Pass());
+ extensions::ExtensionSystem::Get(browser_context_)
+ ->event_router()
+ ->BroadcastEvent(event.Pass());
}
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/mdns/mdns_api.h ('k') | chrome/browser/extensions/api/media_galleries/media_galleries_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698