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

Unified Diff: chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc

Issue 259843004: Remove some NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED from c/b/extensions Part2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comment Created 6 years, 8 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/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() {
« no previous file with comments | « chrome/browser/extensions/api/log_private/log_private_api.h ('k') | chrome/browser/extensions/extension_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698