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

Unified Diff: chrome/browser/extensions/api/history/history_api.cc

Issue 238633009: cleanup: Use EventRouter instead of ExtensionSystem::Get->event_router() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error for chromeos build. 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/history/history_api.cc
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc
index 654e1d37b5d6cf6b9411c55520cafe5b644d3aa1..cd216a148db7d34a287b738794027f1981b84aab 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -30,7 +30,6 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/event_router.h"
-#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
@@ -193,29 +192,27 @@ void HistoryEventRouter::DispatchEvent(
Profile* profile,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args) {
- if (profile && extensions::ExtensionSystem::Get(profile)->event_router()) {
+ if (profile && extensions::EventRouter::Get(profile)) {
scoped_ptr<extensions::Event> event(new extensions::Event(
event_name, event_args.Pass()));
event->restrict_to_browser_context = profile;
- extensions::ExtensionSystem::Get(profile)->event_router()->
- BroadcastEvent(event.Pass());
+ extensions::EventRouter::Get(profile)->BroadcastEvent(event.Pass());
}
}
HistoryAPI::HistoryAPI(content::BrowserContext* context)
: browser_context_(context) {
- ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver(
- this, api::history::OnVisited::kEventName);
- ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver(
- this, api::history::OnVisitRemoved::kEventName);
+ EventRouter* event_router = EventRouter::Get(browser_context_);
+ event_router->RegisterObserver(this, api::history::OnVisited::kEventName);
+ event_router->RegisterObserver(this,
+ api::history::OnVisitRemoved::kEventName);
}
HistoryAPI::~HistoryAPI() {
}
void HistoryAPI::Shutdown() {
- ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
- this);
+ EventRouter::Get(browser_context_)->UnregisterObserver(this);
}
static base::LazyInstance<BrowserContextKeyedAPIFactory<HistoryAPI> >
@@ -235,8 +232,7 @@ void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() {
void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) {
history_event_router_.reset(
new HistoryEventRouter(Profile::FromBrowserContext(browser_context_)));
- ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
- this);
+ EventRouter::Get(browser_context_)->UnregisterObserver(this);
}
void HistoryFunction::Run() {
« no previous file with comments | « chrome/browser/extensions/api/gcm/gcm_api.cc ('k') | chrome/browser/extensions/api/hotword_private/hotword_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698