OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 if (IsChromeDashboardEnabled()) { | 86 if (IsChromeDashboardEnabled()) { |
87 return l10n_util::GetStringFUTF16( | 87 return l10n_util::GetStringFUTF16( |
88 IDS_SYNC_ACCOUNT_SYNCING_WITH_MANAGE_LINK_NEW, | 88 IDS_SYNC_ACCOUNT_SYNCING_WITH_MANAGE_LINK_NEW, |
89 base::ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); | 89 base::ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); |
90 } | 90 } |
91 return l10n_util::GetStringFUTF16( | 91 return l10n_util::GetStringFUTF16( |
92 IDS_SYNC_ACCOUNT_SYNCING_WITH_MANAGE_LINK, | 92 IDS_SYNC_ACCOUNT_SYNCING_WITH_MANAGE_LINK, |
93 base::ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); | 93 base::ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); |
94 default: | 94 default: |
95 NOTREACHED(); | 95 NOTREACHED(); |
96 return NULL; | 96 return nullptr; |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 void GetStatusForActionableError( | 100 void GetStatusForActionableError( |
101 const syncer::SyncProtocolError& error, | 101 const syncer::SyncProtocolError& error, |
102 base::string16* status_label) { | 102 base::string16* status_label) { |
103 DCHECK(status_label); | 103 DCHECK(status_label); |
104 switch (error.action) { | 104 switch (error.action) { |
105 case syncer::STOP_AND_RESTART_SYNC: | 105 case syncer::STOP_AND_RESTART_SYNC: |
106 status_label->assign( | 106 status_label->assign( |
(...skipping 12 matching lines...) Expand all Loading... |
119 status_label->assign( | 119 status_label->assign( |
120 l10n_util::GetStringUTF16(IDS_SYNC_CLEAR_USER_DATA)); | 120 l10n_util::GetStringUTF16(IDS_SYNC_CLEAR_USER_DATA)); |
121 break; | 121 break; |
122 default: | 122 default: |
123 NOTREACHED(); | 123 NOTREACHED(); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 // TODO(akalin): Write unit tests for these three functions below. | 127 // TODO(akalin): Write unit tests for these three functions below. |
128 | 128 |
129 // status_label and link_label must either be both NULL or both non-NULL. | 129 // status_label and link_label must either be both null or both non-null. |
130 MessageType GetStatusInfo(Profile* profile, | 130 MessageType GetStatusInfo(Profile* profile, |
131 ProfileSyncService* service, | 131 ProfileSyncService* service, |
132 const SigninManagerBase& signin, | 132 const SigninManagerBase& signin, |
133 StatusLabelStyle style, | 133 StatusLabelStyle style, |
134 base::string16* status_label, | 134 base::string16* status_label, |
135 base::string16* link_label) { | 135 base::string16* link_label) { |
136 DCHECK_EQ(status_label == NULL, link_label == NULL); | 136 DCHECK_EQ(status_label == nullptr, link_label == nullptr); |
137 | 137 |
138 MessageType result_type(SYNCED); | 138 MessageType result_type(SYNCED); |
139 | 139 |
140 if (!signin.IsAuthenticated()) | 140 if (!signin.IsAuthenticated()) |
141 return PRE_SYNCED; | 141 return PRE_SYNCED; |
142 | 142 |
143 if (!service || service->IsManaged() || service->IsFirstSetupComplete() || | 143 if (!service || service->IsManaged() || service->IsFirstSetupComplete() || |
144 !service->IsSyncRequested()) { | 144 !service->IsSyncRequested()) { |
145 // The order or priority is going to be: 1. Unrecoverable errors. | 145 // The order or priority is going to be: 1. Unrecoverable errors. |
146 // 2. Auth errors. 3. Protocol errors. 4. Passphrase errors. | 146 // 2. Auth errors. 3. Protocol errors. 4. Passphrase errors. |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 base::string16 ConstructTime(int64_t time_in_int) { | 462 base::string16 ConstructTime(int64_t time_in_int) { |
463 base::Time time = base::Time::FromInternalValue(time_in_int); | 463 base::Time time = base::Time::FromInternalValue(time_in_int); |
464 | 464 |
465 // If time is null the format function returns a time in 1969. | 465 // If time is null the format function returns a time in 1969. |
466 if (time.is_null()) | 466 if (time.is_null()) |
467 return base::string16(); | 467 return base::string16(); |
468 return base::TimeFormatFriendlyDateAndTime(time); | 468 return base::TimeFormatFriendlyDateAndTime(time); |
469 } | 469 } |
470 | 470 |
471 } // namespace sync_ui_util | 471 } // namespace sync_ui_util |
OLD | NEW |