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/ui/webui/ntp/ntp_login_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 return false; | 256 return false; |
257 | 257 |
258 return profile->GetOriginalProfile()->IsSyncAccessible(); | 258 return profile->GetOriginalProfile()->IsSyncAccessible(); |
259 #endif | 259 #endif |
260 } | 260 } |
261 | 261 |
262 // static | 262 // static |
263 void NTPLoginHandler::GetLocalizedValues(Profile* profile, | 263 void NTPLoginHandler::GetLocalizedValues(Profile* profile, |
264 DictionaryValue* values) { | 264 DictionaryValue* values) { |
265 PrefService* prefs = profile->GetPrefs(); | 265 PrefService* prefs = profile->GetPrefs(); |
266 bool hide_sync = prefs->GetString(prefs::kGoogleServicesUsername).empty() || | 266 std::string error_message = prefs->GetString(prefs::kSyncPromoErrorMessage); |
267 !prefs->GetBoolean(prefs::kSyncPromoShowNTPBubble); | 267 bool hide_sync = !prefs->GetBoolean(prefs::kSyncPromoShowNTPBubble); |
Andrew T Wilson (Slow)
2012/12/03 14:54:49
Will this have unexpected side effects with old pr
Roger Tawa OOO till Jul 10th
2012/12/03 22:26:54
The bubble clears the error message once the user
| |
268 | 268 |
269 values->SetString("login_status_message", | 269 string16 message = |
270 hide_sync ? string16() : | 270 hide_sync ? string16() : |
271 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE, | 271 !error_message.empty() ? UTF8ToUTF16(error_message) : |
272 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | 272 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE, |
273 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | |
274 | |
275 values->SetString("login_status_message", message); | |
273 values->SetString("login_status_url", | 276 values->SetString("login_status_url", |
274 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 277 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
275 values->SetString("login_status_advanced", | 278 values->SetString("login_status_advanced", |
276 hide_sync ? string16() : | 279 hide_sync || !error_message.empty() ? string16() : |
277 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
278 values->SetString("login_status_dismiss", | 281 values->SetString("login_status_dismiss", |
279 hide_sync ? string16() : | 282 hide_sync ? string16() : |
280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 283 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
281 } | 284 } |
OLD | NEW |