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

Unified Diff: chrome/browser/ui/tabs/pinned_tab_service.cc

Issue 2793443003: Removed NOTIFICATION_BROWSER_CLOSING notification (Closed)
Patch Set: Removed unused headers from unload controllers Created 3 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/ui/tabs/pinned_tab_service.cc
diff --git a/chrome/browser/ui/tabs/pinned_tab_service.cc b/chrome/browser/ui/tabs/pinned_tab_service.cc
index 5f56a5ecf9a5c511250eb07a09b41f2f46188a2a..be00f58798398de11a33e4ae8f6a54f86674d958 100644
--- a/chrome/browser/ui/tabs/pinned_tab_service.cc
+++ b/chrome/browser/ui/tabs/pinned_tab_service.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/tabs/pinned_tab_codec.h"
#include "content/public/browser/notification_service.h"
@@ -33,12 +34,11 @@ PinnedTabService::PinnedTabService(Profile* profile)
has_normal_browser_(false) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllBrowserContextsAndSources());
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
- content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
+ BrowserList::AddObserver(this);
}
void PinnedTabService::Observe(int type,
@@ -77,18 +77,6 @@ void PinnedTabService::Observe(int type,
break;
}
- case chrome::NOTIFICATION_BROWSER_CLOSING: {
- Browser* browser = content::Source<Browser>(source).ptr();
- if (has_normal_browser_ && save_pinned_tabs_ &&
- browser->profile() == profile_) {
- if (IsOnlyNormalBrowser(browser)) {
- has_normal_browser_ = false;
- PinnedTabCodec::WritePinnedTabs(profile_);
- }
- }
- break;
- }
-
case chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: {
if (has_normal_browser_ && save_pinned_tabs_) {
PinnedTabCodec::WritePinnedTabs(profile_);
@@ -101,3 +89,13 @@ void PinnedTabService::Observe(int type,
NOTREACHED();
}
}
+
+void PinnedTabService::OnBrowserCloseStarted(Browser* browser) {
+ if (has_normal_browser_ && save_pinned_tabs_ &&
+ browser->profile() == profile_) {
+ if (IsOnlyNormalBrowser(browser)) {
+ has_normal_browser_ = false;
+ PinnedTabCodec::WritePinnedTabs(profile_);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698