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

Unified Diff: chrome/browser/sync/sync_error_notifier_ash.cc

Issue 2772783004: [Sync] Don't display passphrase notification if user dismissed previous one (Closed)
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
Index: chrome/browser/sync/sync_error_notifier_ash.cc
diff --git a/chrome/browser/sync/sync_error_notifier_ash.cc b/chrome/browser/sync/sync_error_notifier_ash.cc
index 2a67912929aaa443f73c93f2c8ed450d037c55b3..e2702a517e4796c67535da63275ec6e0a245c8c2 100644
--- a/chrome/browser/sync/sync_error_notifier_ash.cc
+++ b/chrome/browser/sync/sync_error_notifier_ash.cc
@@ -98,7 +98,9 @@ void SyncNotificationDelegate::ShowSyncSetup() {
SyncErrorNotifier::SyncErrorNotifier(syncer::SyncErrorController* controller,
Profile* profile)
- : error_controller_(controller), profile_(profile) {
+ : error_controller_(controller),
+ profile_(profile),
+ notification_displayed_(false) {
// Create a unique notification ID for this profile.
notification_id_ =
kProfileSyncNotificationId + profile_->GetProfileUserName();
@@ -125,7 +127,11 @@ void SyncErrorNotifier::OnErrorChanged() {
if (!notification_ui_manager)
return;
+ if (error_controller_->HasError() == notification_displayed_)
+ return;
+
if (!error_controller_->HasError()) {
+ notification_displayed_ = false;
g_browser_process->notification_ui_manager()->CancelById(
notification_id_, NotificationUIManager::GetProfileID(profile_));
return;
@@ -144,10 +150,12 @@ void SyncErrorNotifier::OnErrorChanged() {
}
#endif
- // Keep the existing notification if there is one.
- if (notification_ui_manager->FindById(
- notification_id_, NotificationUIManager::GetProfileID(profile_)))
- return;
+ // Error state just got triggered. There shouldn't be previous notification.
+ // Let's display one.
+ DCHECK(!notification_displayed_ && error_controller_->HasError());
+ DCHECK(notification_ui_manager->FindById(
+ notification_id_, NotificationUIManager::GetProfileID(profile_)) ==
+ nullptr);
// Add an accept button to launch the sync setup settings subpage.
message_center::RichNotificationData data;
@@ -177,4 +185,5 @@ void SyncErrorNotifier::OnErrorChanged() {
base::string16(), // display_source
GURL(notification_id_), notification_id_, data, delegate);
notification_ui_manager->Add(notification, profile_);
+ notification_displayed_ = true;
}

Powered by Google App Engine
This is Rietveld 408576698