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

Unified Diff: chrome/browser/sync/sessions/notification_service_sessions_router.cc

Issue 2750163003: Prevent tabs sync during browser shutdown.
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/sessions_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sessions/notification_service_sessions_router.cc
diff --git a/chrome/browser/sync/sessions/notification_service_sessions_router.cc b/chrome/browser/sync/sessions/notification_service_sessions_router.cc
index 9bb3d5c8e7d283a9d8c23b16a532c876647fbe88..43dac6517773d8ec76e7a2cf02adecf619156825 100644
--- a/chrome/browser/sync/sessions/notification_service_sessions_router.cc
+++ b/chrome/browser/sync/sessions/notification_service_sessions_router.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/sync_start_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h"
#include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
#include "chrome/common/features.h"
@@ -77,6 +78,14 @@ NotificationServiceSessionsRouter::NotificationServiceSessionsRouter(
content::NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::NotificationService::AllSources());
+ registrar_.Add(this, chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
+ content::NotificationService::AllBrowserContextsAndSources());
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
+ content::NotificationService::AllBrowserContextsAndSources());
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
+ content::NotificationService::AllSources());
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
+ content::NotificationService::AllSources());
#if BUILDFLAG(ENABLE_EXTENSIONS)
registrar_.Add(this,
chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
@@ -129,6 +138,28 @@ void NotificationServiceSessionsRouter::Observe(
return;
break;
}
+ case chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: {
+ if (handler_)
+ handler_->SetAllBrowsersClosing(true);
+ break;
+ }
+#if !defined(OS_IOS)
+ case chrome::NOTIFICATION_BROWSER_CLOSING: {
+ Browser* browser = content::Source<Browser>(source).ptr();
+ if (!browser || browser->profile() != profile_)
+ return;
+ if (handler_ && chrome::GetBrowserCount(profile_) == 1U) {
+ handler_->SetAllBrowsersClosing(true);
+ }
+ break;
+ }
+#endif // !defined(OS_IOS)
+ case chrome::NOTIFICATION_BROWSER_OPENED:
+ case chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED: {
+ if (handler_)
+ handler_->SetAllBrowsersClosing(false);
+ break;
+ }
// Source<NavigationController>.
case content::NOTIFICATION_NAV_LIST_PRUNED:
case content::NOTIFICATION_NAV_ENTRY_CHANGED:
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/sessions_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698