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

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

Issue 11366074: Coalesce event router Init calls into their constructors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: aa Created 8 years, 1 month 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 5e3f1adc3c4a76a4061f1bafdb69518de06cf43e..7cb61a3995f9c9a5d2925a9bd3f2f6d05b3dcffc 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -73,15 +73,8 @@ WebNavigationEventRouter::PendingWebContents::PendingWebContents(
WebNavigationEventRouter::PendingWebContents::~PendingWebContents() {}
WebNavigationEventRouter::WebNavigationEventRouter(Profile* profile)
- : profile_(profile) {}
-
-WebNavigationEventRouter::~WebNavigationEventRouter() {
- BrowserList::RemoveObserver(this);
-}
-
-void WebNavigationEventRouter::Init() {
- if (!registrar_.IsEmpty())
- return;
+ : profile_(profile) {
+ CHECK(registrar_.IsEmpty());
registrar_.Add(this,
chrome::NOTIFICATION_RETARGETING,
content::NotificationService::AllSources());
@@ -99,6 +92,10 @@ void WebNavigationEventRouter::Init() {
}
}
+WebNavigationEventRouter::~WebNavigationEventRouter() {
+ BrowserList::RemoveObserver(this);
+}
+
void WebNavigationEventRouter::OnBrowserAdded(Browser* browser) {
if (!profile_->IsSameProfile(browser->profile()))
return;
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/web_navigation_api.h ('k') | chrome/browser/extensions/browser_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698