| 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/app_launcher_login_handler.h" | 5 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // Record that the user was shown the promo. | 217 // Record that the user was shown the promo. |
| 218 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); | 218 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); |
| 219 } | 219 } |
| 220 #endif | 220 #endif |
| 221 } | 221 } |
| 222 | 222 |
| 223 base::StringValue header_value(header); | 223 base::StringValue header_value(header); |
| 224 base::StringValue sub_header_value(sub_header); | 224 base::StringValue sub_header_value(sub_header); |
| 225 base::StringValue icon_url_value(icon_url); | 225 base::StringValue icon_url_value(icon_url); |
| 226 base::FundamentalValue is_user_signed_in(!username.empty()); | 226 base::FundamentalValue is_user_signed_in(!username.empty()); |
| 227 web_ui()->CallJavascriptFunction("ntp.updateLogin", | 227 web_ui()->CallJavascriptFunctionUnsafe("ntp.updateLogin", header_value, |
| 228 header_value, sub_header_value, icon_url_value, is_user_signed_in); | 228 sub_header_value, icon_url_value, |
| 229 is_user_signed_in); |
| 229 } | 230 } |
| 230 | 231 |
| 231 // static | 232 // static |
| 232 bool AppLauncherLoginHandler::ShouldShow(Profile* profile) { | 233 bool AppLauncherLoginHandler::ShouldShow(Profile* profile) { |
| 233 #if defined(OS_CHROMEOS) | 234 #if defined(OS_CHROMEOS) |
| 234 // For now we don't care about showing sync status on Chrome OS. The promo | 235 // For now we don't care about showing sync status on Chrome OS. The promo |
| 235 // UI and the avatar menu don't exist on that platform. | 236 // UI and the avatar menu don't exist on that platform. |
| 236 return false; | 237 return false; |
| 237 #else | 238 #else |
| 238 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | 239 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 253 values->SetString("login_status_message", message); | 254 values->SetString("login_status_message", message); |
| 254 values->SetString("login_status_url", | 255 values->SetString("login_status_url", |
| 255 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 256 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
| 256 values->SetString("login_status_advanced", | 257 values->SetString("login_status_advanced", |
| 257 hide_sync ? base::string16() : | 258 hide_sync ? base::string16() : |
| 258 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 259 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
| 259 values->SetString("login_status_dismiss", | 260 values->SetString("login_status_dismiss", |
| 260 hide_sync ? base::string16() : | 261 hide_sync ? base::string16() : |
| 261 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 262 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
| 262 } | 263 } |
| OLD | NEW |