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

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

Issue 959343003: Enable new sync URL to link to Chrome Away (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/url_constants.h » ('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 "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/metrics/field_trial.h"
9 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/signin/signin_error_controller_factory.h" 15 #include "chrome/browser/signin/signin_error_controller_factory.h"
15 #include "chrome/browser/signin/signin_ui_util.h" 16 #include "chrome/browser/signin/signin_ui_util.h"
16 #include "chrome/browser/sync/profile_sync_service.h" 17 #include "chrome/browser/sync/profile_sync_service.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
(...skipping 17 matching lines...) Expand all
36 #if defined(OS_CHROMEOS) 37 #if defined(OS_CHROMEOS)
37 #include "components/user_manager/user_manager.h" 38 #include "components/user_manager/user_manager.h"
38 #endif // defined(OS_CHROMEOS) 39 #endif // defined(OS_CHROMEOS)
39 40
40 typedef GoogleServiceAuthError AuthError; 41 typedef GoogleServiceAuthError AuthError;
41 42
42 namespace sync_ui_util { 43 namespace sync_ui_util {
43 44
44 namespace { 45 namespace {
45 46
47 bool IsChromeDashboardEnabled() {
48 const std::string group_name =
49 base::FieldTrialList::FindFullName("ChromeDashboard");
50 return group_name == "Enabled";
51 }
52
46 // Returns the message that should be displayed when the user is authenticated 53 // Returns the message that should be displayed when the user is authenticated
47 // and can connect to the sync server. If the user hasn't yet authenticated, an 54 // and can connect to the sync server. If the user hasn't yet authenticated, an
48 // empty string is returned. 55 // empty string is returned.
49 base::string16 GetSyncedStateStatusLabel(ProfileSyncService* service, 56 base::string16 GetSyncedStateStatusLabel(ProfileSyncService* service,
50 const SigninManagerBase& signin, 57 const SigninManagerBase& signin,
51 StatusLabelStyle style) { 58 StatusLabelStyle style) {
52 std::string user_display_name = signin.GetAuthenticatedUsername(); 59 std::string user_display_name = signin.GetAuthenticatedUsername();
53 60
54 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
55 if (user_manager::UserManager::IsInitialized()) { 62 if (user_manager::UserManager::IsInitialized()) {
(...skipping 25 matching lines...) Expand all
81 88
82 DCHECK(!user_name.empty()); 89 DCHECK(!user_name.empty());
83 90
84 // Message may also carry additional advice with an HTML link, if acceptable. 91 // Message may also carry additional advice with an HTML link, if acceptable.
85 switch (style) { 92 switch (style) {
86 case PLAIN_TEXT: 93 case PLAIN_TEXT:
87 return l10n_util::GetStringFUTF16( 94 return l10n_util::GetStringFUTF16(
88 IDS_SYNC_ACCOUNT_SYNCING_TO_USER, 95 IDS_SYNC_ACCOUNT_SYNCING_TO_USER,
89 user_name); 96 user_name);
90 case WITH_HTML: 97 case WITH_HTML:
98 if (IsChromeDashboardEnabled()) {
99 return l10n_util::GetStringFUTF16(
100 IDS_SYNC_ACCOUNT_SYNCING_TO_USER_WITH_MANAGE_LINK_NEW,
101 user_name,
102 base::ASCIIToUTF16(chrome::kSyncChromeDashboardURL));
103 }
91 return l10n_util::GetStringFUTF16( 104 return l10n_util::GetStringFUTF16(
92 IDS_SYNC_ACCOUNT_SYNCING_TO_USER_WITH_MANAGE_LINK, 105 IDS_SYNC_ACCOUNT_SYNCING_TO_USER_WITH_MANAGE_LINK,
93 user_name, 106 user_name,
94 base::ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); 107 base::ASCIIToUTF16(chrome::kSyncGoogleDashboardURL));
95 default: 108 default:
96 NOTREACHED(); 109 NOTREACHED();
97 return NULL; 110 return NULL;
98 } 111 }
99 } 112 }
100 113
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 base::string16 ConstructTime(int64 time_in_int) { 389 base::string16 ConstructTime(int64 time_in_int) {
377 base::Time time = base::Time::FromInternalValue(time_in_int); 390 base::Time time = base::Time::FromInternalValue(time_in_int);
378 391
379 // If time is null the format function returns a time in 1969. 392 // If time is null the format function returns a time in 1969.
380 if (time.is_null()) 393 if (time.is_null())
381 return base::string16(); 394 return base::string16();
382 return base::TimeFormatFriendlyDateAndTime(time); 395 return base::TimeFormatFriendlyDateAndTime(time);
383 } 396 }
384 397
385 } // namespace sync_ui_util 398 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « no previous file | chrome/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698