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

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

Issue 17392009: [sync] Hide "Sync nothing" UI; Go back to signing out on dashboard clears and abandoned initial set… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 5 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_ui_util.h" 5 #include "chrome/browser/sync/sync_ui_util.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 StatusLabelStyle style) { 49 StatusLabelStyle style) {
50 string16 user_name = UTF8ToUTF16(signin.GetAuthenticatedUsername()); 50 string16 user_name = UTF8ToUTF16(signin.GetAuthenticatedUsername());
51 51
52 if (!user_name.empty()) { 52 if (!user_name.empty()) {
53 if (!service || service->IsManaged()) { 53 if (!service || service->IsManaged()) {
54 // User is signed in, but sync is disabled. 54 // User is signed in, but sync is disabled.
55 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED, 55 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED,
56 user_name); 56 user_name);
57 } else if (service->IsStartSuppressed()) { 57 } else if (service->IsStartSuppressed()) {
58 // User is signed in, but sync has been stopped. 58 // User is signed in, but sync has been stopped.
59 return l10n_util::GetStringFUTF16( 59 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED,
60 IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED, 60 user_name);
61 user_name,
62 ASCIIToUTF16(chrome::kSyncGoogleDashboardURL));
63 } 61 }
64 } 62 }
65 63
66 if (!service || !service->sync_initialized()) { 64 if (!service || !service->sync_initialized()) {
67 // User is not signed in, or sync is still initializing. 65 // User is not signed in, or sync is still initializing.
68 return string16(); 66 return string16();
69 } 67 }
70 68
71 DCHECK(!user_name.empty()); 69 DCHECK(!user_name.empty());
72 70
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 status_label); 244 status_label);
247 } 245 }
248 } else if (status_label) { 246 } else if (status_label) {
249 status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR)); 247 status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR));
250 } 248 }
251 } else if (!signin.GetAuthenticatedUsername().empty()) { 249 } else if (!signin.GetAuthenticatedUsername().empty()) {
252 // The user is signed in, but sync has been stopped. 250 // The user is signed in, but sync has been stopped.
253 if (status_label) { 251 if (status_label) {
254 string16 label = l10n_util::GetStringFUTF16( 252 string16 label = l10n_util::GetStringFUTF16(
255 IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED, 253 IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED,
256 UTF8ToUTF16(signin.GetAuthenticatedUsername()), 254 UTF8ToUTF16(signin.GetAuthenticatedUsername()));
257 ASCIIToUTF16(chrome::kSyncGoogleDashboardURL));
258 status_label->assign(label); 255 status_label->assign(label);
259 result_type = PRE_SYNCED; 256 result_type = PRE_SYNCED;
260 } 257 }
261 } 258 }
262 } 259 }
263 return result_type; 260 return result_type;
264 } 261 }
265 262
266 // Returns the status info for use on the new tab page, where we want slightly 263 // Returns the status info for use on the new tab page, where we want slightly
267 // different information than in the settings panel. 264 // different information than in the settings panel.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 string16 ConstructTime(int64 time_in_int) { 360 string16 ConstructTime(int64 time_in_int) {
364 base::Time time = base::Time::FromInternalValue(time_in_int); 361 base::Time time = base::Time::FromInternalValue(time_in_int);
365 362
366 // If time is null the format function returns a time in 1969. 363 // If time is null the format function returns a time in 1969.
367 if (time.is_null()) 364 if (time.is_null())
368 return string16(); 365 return string16();
369 return base::TimeFormatFriendlyDateAndTime(time); 366 return base::TimeFormatFriendlyDateAndTime(time);
370 } 367 }
371 368
372 } // namespace sync_ui_util 369 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698