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

Unified Diff: chrome/browser/extensions/api/history/history_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/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 9abd10fe278e79e5e003af158a360f4742a00970..ec2c02ad1c268c41507590c4949844419e5d65cc 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -200,10 +200,11 @@ void HistoryEventRouter::DispatchEvent(
}
}
-HistoryAPI::HistoryAPI(Profile* profile) : profile_(profile) {
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+HistoryAPI::HistoryAPI(content::BrowserContext* context)
+ : browser_context_(context) {
+ ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver(
this, api::history::OnVisited::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver(
this, api::history::OnVisitRemoved::kEventName);
}
@@ -211,7 +212,8 @@ HistoryAPI::~HistoryAPI() {
}
void HistoryAPI::Shutdown() {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
static base::LazyInstance<ProfileKeyedAPIFactory<HistoryAPI> >
@@ -228,8 +230,10 @@ void ProfileKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() {
}
void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) {
- history_event_router_.reset(new HistoryEventRouter(profile_));
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ history_event_router_.reset(
+ new HistoryEventRouter(Profile::FromBrowserContext(browser_context_)));
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
void HistoryFunction::Run() {

Powered by Google App Engine
This is Rietveld 408576698