Index: chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc |
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 bd3d2a17aa7dc2bf92d7d92b6d44d812a52ecb2e..d8a09fa87eefed8768df6c9515400d32b2e25cbe 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 |
@@ -13,7 +13,6 @@ |
#include "base/memory/linked_ptr.h" |
#include "base/memory/scoped_ptr.h" |
#include "chrome/browser/browser_process.h" |
-#include "chrome/browser/chrome_notification_types.h" |
#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/log_private/syslog_parser.h" |
@@ -22,10 +21,9 @@ |
#include "chrome/browser/net/chrome_net_log.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/extensions/api/log_private.h" |
-#include "content/public/browser/notification_details.h" |
-#include "content/public/browser/notification_source.h" |
#include "extensions/browser/event_router.h" |
#include "extensions/browser/extension_function.h" |
+#include "extensions/browser/extension_registry.h" |
using content::BrowserThread; |
@@ -71,11 +69,10 @@ LogPrivateAPI* LogPrivateAPI::Get(content::BrowserContext* context) { |
} |
LogPrivateAPI::LogPrivateAPI(content::BrowserContext* context) |
- : profile_(Profile::FromBrowserContext(context)), |
- logging_net_internals_(false) { |
- registrar_.Add(this, |
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
- content::Source<Profile>(profile_)); |
+ : browser_context_(context), |
+ logging_net_internals_(false), |
+ extension_registry_observer_(this) { |
+ extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); |
} |
LogPrivateAPI::~LogPrivateAPI() { |
@@ -100,7 +97,7 @@ static base::LazyInstance<BrowserContextKeyedAPIFactory<LogPrivateAPI> > |
// static |
BrowserContextKeyedAPIFactory<LogPrivateAPI>* |
LogPrivateAPI::GetFactoryInstance() { |
- return &g_factory.Get(); |
+ return g_factory.Pointer(); |
} |
void LogPrivateAPI::OnAddEntry(const net::NetLog::Entry& entry) { |
@@ -133,7 +130,8 @@ void LogPrivateAPI::AddEntriesOnUI(scoped_ptr<base::ListValue> value) { |
event_args->Append(value->DeepCopy()); |
scoped_ptr<Event> event(new Event(events::kOnAddNetInternalsEntries, |
event_args.Pass())); |
- EventRouter::Get(profile_)->DispatchEventToExtension(*ix, event.Pass()); |
+ EventRouter::Get(browser_context_) |
+ ->DispatchEventToExtension(*ix, event.Pass()); |
} |
} |
@@ -163,14 +161,11 @@ void LogPrivateAPI::StopNetInternalLogging() { |
} |
} |
-void LogPrivateAPI::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { |
- const Extension* extension = |
- content::Details<const UnloadedExtensionInfo>(details)->extension; |
- StopNetInternalsWatch(extension->id()); |
- } |
+void LogPrivateAPI::OnExtensionUnloaded( |
+ content::BrowserContext* browser_context, |
+ const Extension* extension, |
+ UnloadedExtensionInfo::Reason reason) { |
+ StopNetInternalsWatch(extension->id()); |
} |
LogPrivateGetHistoricalFunction::LogPrivateGetHistoricalFunction() { |