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 |