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

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

Issue 9959038: Removed ProfileSyncService::UIShouldDepictAuthInProgress (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT. Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/sync/profile_sync_service.h" 8 #include "chrome/browser/sync/profile_sync_service.h"
9 #include "chrome/browser/sync/profile_sync_service_observer.h" 9 #include "chrome/browser/sync/profile_sync_service_observer.h"
10 #include "chrome/browser/sync/sync_ui_util.h" 10 #include "chrome/browser/sync/sync_ui_util.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/global_error_service.h" 12 #include "chrome/browser/ui/global_error_service.h"
13 #include "chrome/browser/ui/global_error_service_factory.h" 13 #include "chrome/browser/ui/global_error_service_factory.h"
14 #include "chrome/common/net/gaia/google_service_auth_error.h" 14 #include "chrome/common/net/gaia/google_service_auth_error.h"
15 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 18
19 typedef GoogleServiceAuthError AuthError; 19 typedef GoogleServiceAuthError AuthError;
20 20
21 SyncGlobalError::SyncGlobalError(ProfileSyncService* service) 21 SyncGlobalError::SyncGlobalError(ProfileSyncService* service,
22 : service_(service) { 22 SigninManager* signin)
23 : service_(service),
24 signin_(signin) {
25 DCHECK(service_);
26 DCHECK(signin_);
23 OnStateChanged(); 27 OnStateChanged();
24 } 28 }
25 29
26 SyncGlobalError::~SyncGlobalError() { 30 SyncGlobalError::~SyncGlobalError() {
27 } 31 }
28 32
29 bool SyncGlobalError::HasBadge() { 33 bool SyncGlobalError::HasBadge() {
30 return !menu_label_.empty(); 34 return !menu_label_.empty();
31 } 35 }
32 36
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 93
90 void SyncGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { 94 void SyncGlobalError::BubbleViewCancelButtonPressed(Browser* browser) {
91 NOTREACHED(); 95 NOTREACHED();
92 } 96 }
93 97
94 void SyncGlobalError::OnStateChanged() { 98 void SyncGlobalError::OnStateChanged() {
95 string16 menu_label; 99 string16 menu_label;
96 string16 bubble_message; 100 string16 bubble_message;
97 string16 bubble_accept_label; 101 string16 bubble_accept_label;
98 sync_ui_util::GetStatusLabelsForSyncGlobalError( 102 sync_ui_util::GetStatusLabelsForSyncGlobalError(
99 service_, &menu_label, &bubble_message, &bubble_accept_label); 103 service_, *signin_, &menu_label, &bubble_message, &bubble_accept_label);
100 104
101 // All the labels should be empty or all of them non-empty. 105 // All the labels should be empty or all of them non-empty.
102 DCHECK((menu_label.empty() && bubble_message.empty() && 106 DCHECK((menu_label.empty() && bubble_message.empty() &&
103 bubble_accept_label.empty()) || 107 bubble_accept_label.empty()) ||
104 (!menu_label.empty() && !bubble_message.empty() && 108 (!menu_label.empty() && !bubble_message.empty() &&
105 !bubble_accept_label.empty())); 109 !bubble_accept_label.empty()));
106 110
107 if (menu_label != menu_label_ || bubble_message != bubble_message_ || 111 if (menu_label != menu_label_ || bubble_message != bubble_message_ ||
108 bubble_accept_label != bubble_accept_label_) { 112 bubble_accept_label != bubble_accept_label_) {
109 menu_label_ = menu_label; 113 menu_label_ = menu_label;
110 bubble_message_ = bubble_message; 114 bubble_message_ = bubble_message;
111 bubble_accept_label_ = bubble_accept_label; 115 bubble_accept_label_ = bubble_accept_label;
112 116
113 // Profile can be NULL during tests. 117 // Profile can be NULL during tests.
114 Profile* profile = service_->profile(); 118 Profile* profile = service_->profile();
115 if (profile) { 119 if (profile) {
116 GlobalErrorServiceFactory::GetForProfile( 120 GlobalErrorServiceFactory::GetForProfile(
117 profile)->NotifyErrorsChanged(this); 121 profile)->NotifyErrorsChanged(this);
118 } 122 }
119 } 123 }
120 } 124 }
121 125
122 bool SyncGlobalError::HasCustomizedSyncMenuItem() { 126 bool SyncGlobalError::HasCustomizedSyncMenuItem() {
123 return !menu_label_.empty(); 127 return !menu_label_.empty();
124 } 128 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error.h ('k') | chrome/browser/sync/sync_global_error_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698