| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link); | 227 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link); |
| 228 // Record that the user was shown the promo. | 228 // Record that the user was shown the promo. |
| 229 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); | 229 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); |
| 230 } | 230 } |
| 231 #endif | 231 #endif |
| 232 } | 232 } |
| 233 | 233 |
| 234 StringValue header_value(header); | 234 StringValue header_value(header); |
| 235 StringValue sub_header_value(sub_header); | 235 StringValue sub_header_value(sub_header); |
| 236 StringValue icon_url_value(icon_url); | 236 StringValue icon_url_value(icon_url); |
| 237 web_ui()->CallJavascriptFunction( | 237 base::FundamentalValue is_user_signed_in(!username.empty()); |
| 238 "ntp.updateLogin", header_value, sub_header_value, icon_url_value); | 238 web_ui()->CallJavascriptFunction("ntp.updateLogin", |
| 239 header_value, sub_header_value, icon_url_value, is_user_signed_in); |
| 239 } | 240 } |
| 240 | 241 |
| 241 // static | 242 // static |
| 242 bool NTPLoginHandler::ShouldShow(Profile* profile) { | 243 bool NTPLoginHandler::ShouldShow(Profile* profile) { |
| 243 #if defined(OS_CHROMEOS) | 244 #if defined(OS_CHROMEOS) |
| 244 // For now we don't care about showing sync status on Chrome OS. The promo | 245 // For now we don't care about showing sync status on Chrome OS. The promo |
| 245 // UI and the avatar menu don't exist on that platform. | 246 // UI and the avatar menu don't exist on that platform. |
| 246 return false; | 247 return false; |
| 247 #else | 248 #else |
| 248 if (profile->IsOffTheRecord()) | 249 if (profile->IsOffTheRecord()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 265 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE, | 266 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE, |
| 266 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | 267 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); |
| 267 values->SetString("login_status_url", chrome::kSyncLearnMoreURL); | 268 values->SetString("login_status_url", chrome::kSyncLearnMoreURL); |
| 268 values->SetString("login_status_learn_more", | 269 values->SetString("login_status_learn_more", |
| 269 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 270 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
| 270 values->SetString("login_status_advanced", | 271 values->SetString("login_status_advanced", |
| 271 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 272 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
| 272 values->SetString("login_status_dismiss", | 273 values->SetString("login_status_dismiss", |
| 273 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 274 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
| 274 } | 275 } |
| OLD | NEW |