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

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

Issue 2354613002: [Sync] Fix namespaces for the browser_sync component. (Closed)
Patch Set: Address comments. Created 4 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
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | 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) 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_ui_util.h" 5 #include "chrome/browser/sync/sync_ui_util.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
42 42
43 #if defined(OS_CHROMEOS) 43 #if defined(OS_CHROMEOS)
44 #include "components/signin/core/account_id/account_id.h" 44 #include "components/signin/core/account_id/account_id.h"
45 #include "components/user_manager/user_manager.h" 45 #include "components/user_manager/user_manager.h"
46 #else 46 #else
47 #include "chrome/browser/signin/signin_manager_factory.h" 47 #include "chrome/browser/signin/signin_manager_factory.h"
48 #include "components/sync/driver/sync_error_controller.h" 48 #include "components/sync/driver/sync_error_controller.h"
49 #endif // defined(OS_CHROMEOS) 49 #endif // defined(OS_CHROMEOS)
50 50
51 using browser_sync::ProfileSyncService;
52
51 typedef GoogleServiceAuthError AuthError; 53 typedef GoogleServiceAuthError AuthError;
52 54
53 namespace sync_ui_util { 55 namespace sync_ui_util {
54 56
55 namespace { 57 namespace {
56 58
57 bool IsChromeDashboardEnabled() { 59 bool IsChromeDashboardEnabled() {
58 const std::string group_name = 60 const std::string group_name =
59 base::FieldTrialList::FindFullName("ChromeDashboard"); 61 base::FieldTrialList::FindFullName("ChromeDashboard");
60 return group_name == "Enabled"; 62 return group_name == "Enabled";
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // The order or priority is going to be: 1. Unrecoverable errors. 171 // The order or priority is going to be: 1. Unrecoverable errors.
170 // 2. Auth errors. 3. Protocol errors. 4. Passphrase errors. 172 // 2. Auth errors. 3. Protocol errors. 4. Passphrase errors.
171 173
172 if (service && service->HasUnrecoverableError()) { 174 if (service && service->HasUnrecoverableError()) {
173 if (status_label) { 175 if (status_label) {
174 // Unrecoverable error is sometimes accompanied by actionable error. 176 // Unrecoverable error is sometimes accompanied by actionable error.
175 // If actionable error is set then display corresponding message, 177 // If actionable error is set then display corresponding message,
176 // otherwise show generic unrecoverable error message. 178 // otherwise show generic unrecoverable error message.
177 ProfileSyncService::Status status; 179 ProfileSyncService::Status status;
178 service->QueryDetailedSyncStatus(&status); 180 service->QueryDetailedSyncStatus(&status);
179 if (ShouldShowActionOnUI(status.sync_protocol_error)) { 181 if (browser_sync::ShouldShowActionOnUI(status.sync_protocol_error)) {
180 GetStatusForActionableError(status.sync_protocol_error, status_label); 182 GetStatusForActionableError(status.sync_protocol_error, status_label);
181 } else { 183 } else {
182 status_label->assign(l10n_util::GetStringFUTF16( 184 status_label->assign(l10n_util::GetStringFUTF16(
183 IDS_SYNC_STATUS_UNRECOVERABLE_ERROR, 185 IDS_SYNC_STATUS_UNRECOVERABLE_ERROR,
184 l10n_util::GetStringUTF16( 186 l10n_util::GetStringUTF16(
185 IDS_SYNC_UNRECOVERABLE_ERROR_HELP_URL))); 187 IDS_SYNC_UNRECOVERABLE_ERROR_HELP_URL)));
186 } 188 }
187 } 189 }
188 return SYNC_ERROR; 190 return SYNC_ERROR;
189 } 191 }
(...skipping 15 matching lines...) Expand all
205 if (auth_error.state() != AuthError::NONE) { 207 if (auth_error.state() != AuthError::NONE) {
206 if (status_label && link_label) 208 if (status_label && link_label)
207 signin_ui_util::GetStatusLabelsForAuthError(profile, signin, 209 signin_ui_util::GetStatusLabelsForAuthError(profile, signin,
208 status_label, link_label); 210 status_label, link_label);
209 return SYNC_ERROR; 211 return SYNC_ERROR;
210 } 212 }
211 213
212 // We don't have an auth error. Check for an actionable error. 214 // We don't have an auth error. Check for an actionable error.
213 ProfileSyncService::Status status; 215 ProfileSyncService::Status status;
214 service->QueryDetailedSyncStatus(&status); 216 service->QueryDetailedSyncStatus(&status);
215 if (ShouldShowActionOnUI(status.sync_protocol_error)) { 217 if (browser_sync::ShouldShowActionOnUI(status.sync_protocol_error)) {
216 if (status_label) { 218 if (status_label) {
217 GetStatusForActionableError(status.sync_protocol_error, 219 GetStatusForActionableError(status.sync_protocol_error,
218 status_label); 220 status_label);
219 } 221 }
220 return SYNC_ERROR; 222 return SYNC_ERROR;
221 } 223 }
222 224
223 // Check for a passphrase error. 225 // Check for a passphrase error.
224 if (service->IsPassphraseRequired()) { 226 if (service->IsPassphraseRequired()) {
225 if (service->IsPassphraseRequiredForDecryption()) { 227 if (service->IsPassphraseRequiredForDecryption()) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 status_label->clear(); 281 status_label->clear();
280 signin_ui_util::GetStatusLabelsForAuthError(profile, signin, 282 signin_ui_util::GetStatusLabelsForAuthError(profile, signin,
281 status_label, link_label); 283 status_label, link_label);
282 } 284 }
283 result_type = SYNC_ERROR; 285 result_type = SYNC_ERROR;
284 } 286 }
285 } else if (service->HasUnrecoverableError()) { 287 } else if (service->HasUnrecoverableError()) {
286 result_type = SYNC_ERROR; 288 result_type = SYNC_ERROR;
287 ProfileSyncService::Status status; 289 ProfileSyncService::Status status;
288 service->QueryDetailedSyncStatus(&status); 290 service->QueryDetailedSyncStatus(&status);
289 if (ShouldShowActionOnUI(status.sync_protocol_error)) { 291 if (browser_sync::ShouldShowActionOnUI(status.sync_protocol_error)) {
290 if (status_label) { 292 if (status_label) {
291 GetStatusForActionableError(status.sync_protocol_error, 293 GetStatusForActionableError(status.sync_protocol_error,
292 status_label); 294 status_label);
293 } 295 }
294 } else if (status_label) { 296 } else if (status_label) {
295 status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR)); 297 status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR));
296 } 298 }
297 } else if (signin.IsAuthenticated()) { 299 } else if (signin.IsAuthenticated()) {
298 // The user is signed in, but sync has been stopped. 300 // The user is signed in, but sync has been stopped.
299 if (status_label) { 301 if (status_label) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 base::string16 ConstructTime(int64_t time_in_int) { 489 base::string16 ConstructTime(int64_t time_in_int) {
488 base::Time time = base::Time::FromInternalValue(time_in_int); 490 base::Time time = base::Time::FromInternalValue(time_in_int);
489 491
490 // If time is null the format function returns a time in 1969. 492 // If time is null the format function returns a time in 1969.
491 if (time.is_null()) 493 if (time.is_null())
492 return base::string16(); 494 return base::string16();
493 return base::TimeFormatFriendlyDateAndTime(time); 495 return base::TimeFormatFriendlyDateAndTime(time);
494 } 496 }
495 497
496 } // namespace sync_ui_util 498 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698