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

Side by Side Diff: chrome/browser/sync/sync_global_error.cc

Issue 7978013: Update global error UI on sync error change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/sync_global_error.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/sync_global_error.h" 5 #include "chrome/browser/sync/sync_global_error.h"
6 6
7 #include "chrome/browser/sync/profile_sync_service.h" 7 #include "chrome/browser/sync/profile_sync_service.h"
8 #include "chrome/browser/sync/profile_sync_service_observer.h" 8 #include "chrome/browser/sync/profile_sync_service_observer.h"
9 #include "chrome/browser/sync/sync_ui_util.h" 9 #include "chrome/browser/sync/sync_ui_util.h"
10 #include "chrome/browser/ui/global_error_service.h"
11 #include "chrome/browser/ui/global_error_service_factory.h"
10 #include "chrome/common/net/gaia/google_service_auth_error.h" 12 #include "chrome/common/net/gaia/google_service_auth_error.h"
11 #include "grit/chromium_strings.h" 13 #include "grit/chromium_strings.h"
12 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
14 16
15 typedef GoogleServiceAuthError AuthError; 17 typedef GoogleServiceAuthError AuthError;
16 18
17 using namespace sync_ui_util; 19 using namespace sync_ui_util;
18 20
19 SyncGlobalError::SyncGlobalError(ProfileSyncService* service) 21 SyncGlobalError::SyncGlobalError(ProfileSyncService* service)
20 : service_(service) { 22 : has_error_(false),
23 service_(service) {
21 OnStateChanged(); 24 OnStateChanged();
22 } 25 }
23 26
24 SyncGlobalError::~SyncGlobalError() { 27 SyncGlobalError::~SyncGlobalError() {
25 } 28 }
26 29
27 bool SyncGlobalError::HasBadge() { 30 bool SyncGlobalError::HasBadge() {
28 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
29 // TODO(sail): Due to http://crbug.com/96608 we don't have a wrench menu 32 // TODO(sail): Due to http://crbug.com/96608 we don't have a wrench menu
30 // item on ChromeOS thus we don't badge the wrench menu either. 33 // item on ChromeOS thus we don't badge the wrench menu either.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 89
87 void SyncGlobalError::BubbleViewAcceptButtonPressed() { 90 void SyncGlobalError::BubbleViewAcceptButtonPressed() {
88 service_->ShowErrorUI(); 91 service_->ShowErrorUI();
89 } 92 }
90 93
91 void SyncGlobalError::BubbleViewCancelButtonPressed() { 94 void SyncGlobalError::BubbleViewCancelButtonPressed() {
92 NOTREACHED(); 95 NOTREACHED();
93 } 96 }
94 97
95 void SyncGlobalError::OnStateChanged() { 98 void SyncGlobalError::OnStateChanged() {
96 // TODO(sail): Update the wrench menu button. 99 bool new_has_error = GetStatusLabelsForSyncGlobalError(
100 service_, NULL, NULL, NULL) == SYNC_ERROR;
101 if (new_has_error != has_error_) {
102 has_error_ = new_has_error;
103 GlobalErrorServiceFactory::GetForProfile(
104 service_->profile())->NotifyErrorsChanged(this);
105 }
97 } 106 }
98 107
99 bool SyncGlobalError::HasCustomizedSyncMenuItem() { 108 bool SyncGlobalError::HasCustomizedSyncMenuItem() {
100 return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) == 109 return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
101 SYNC_ERROR; 110 SYNC_ERROR;
102 } 111 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698