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

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 174513003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 3). (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/web_navigation/web_navigation_api.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 94628ab695b776bfb9cd5867c1f42d1ad9d5ee4a..3d271017315592b5f2d766a0d5df4053948d9491 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -798,33 +798,34 @@ bool WebNavigationGetAllFramesFunction::RunImpl() {
return true;
}
-WebNavigationAPI::WebNavigationAPI(Profile* profile)
- : profile_(profile) {
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnBeforeNavigate::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnCommitted::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnCompleted::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+WebNavigationAPI::WebNavigationAPI(content::BrowserContext* context)
+ : browser_context_(context) {
+ EventRouter* event_router =
+ ExtensionSystem::Get(browser_context_)->event_router();
+ event_router->RegisterObserver(this,
+ web_navigation::OnBeforeNavigate::kEventName);
+ event_router->RegisterObserver(this, web_navigation::OnCommitted::kEventName);
+ event_router->RegisterObserver(this, web_navigation::OnCompleted::kEventName);
+ event_router->RegisterObserver(
this, web_navigation::OnCreatedNavigationTarget::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ event_router->RegisterObserver(
this, web_navigation::OnDOMContentLoaded::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ event_router->RegisterObserver(
this, web_navigation::OnHistoryStateUpdated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnErrorOccurred::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
+ event_router->RegisterObserver(this,
+ web_navigation::OnErrorOccurred::kEventName);
+ event_router->RegisterObserver(
this, web_navigation::OnReferenceFragmentUpdated::kEventName);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, web_navigation::OnTabReplaced::kEventName);
+ event_router->RegisterObserver(this,
+ web_navigation::OnTabReplaced::kEventName);
}
WebNavigationAPI::~WebNavigationAPI() {
}
void WebNavigationAPI::Shutdown() {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
static base::LazyInstance<ProfileKeyedAPIFactory<WebNavigationAPI> >
@@ -837,8 +838,10 @@ WebNavigationAPI::GetFactoryInstance() {
}
void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
- web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_));
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ web_navigation_event_router_.reset(new WebNavigationEventRouter(
+ Profile::FromBrowserContext(browser_context_)));
+ ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver(
+ this);
}
#endif // OS_ANDROID

Powered by Google App Engine
This is Rietveld 408576698