Chromium Code Reviews| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 | 166 |
| 167 void NTPLoginHandler::HandleShowAdvancedLoginUI(const base::ListValue* args) { | 167 void NTPLoginHandler::HandleShowAdvancedLoginUI(const base::ListValue* args) { |
| 168 Browser* browser = | 168 Browser* browser = |
| 169 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); | 169 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
| 170 if (browser) | 170 if (browser) |
| 171 chrome::ShowBrowserSignin(browser, signin_metrics::SOURCE_NTP_LINK); | 171 chrome::ShowBrowserSignin(browser, signin_metrics::SOURCE_NTP_LINK); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void NTPLoginHandler::UpdateLogin() { | 174 void NTPLoginHandler::UpdateLogin() { |
| 175 Profile* profile = Profile::FromWebUI(web_ui()); | 175 Profile* profile = Profile::FromWebUI(web_ui()); |
| 176 if (profile->IsGuestSession()) | |
| 177 return; | |
| 178 | |
| 176 std::string username = | 179 std::string username = |
| 177 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername(); | 180 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername(); |
|
Dan Beam
2015/03/18 17:08:09
auto* factory = SigninManagerFactory::GetForProfil
Mike Lerman
2015/03/18 19:23:47
Done.
| |
| 178 | 181 |
| 179 base::string16 header, sub_header; | 182 base::string16 header, sub_header; |
| 180 std::string icon_url; | 183 std::string icon_url; |
| 181 if (!username.empty()) { | 184 if (!username.empty()) { |
| 182 ProfileInfoCache& cache = | 185 ProfileInfoCache& cache = |
| 183 g_browser_process->profile_manager()->GetProfileInfoCache(); | 186 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 184 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 187 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
| 185 if (profile_index != std::string::npos) { | 188 if (profile_index != std::string::npos) { |
| 186 // Only show the profile picture and full name for the single profile | 189 // Only show the profile picture and full name for the single profile |
| 187 // case. In the multi-profile case the profile picture is visible in the | 190 // case. In the multi-profile case the profile picture is visible in the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 values->SetString("login_status_message", message); | 256 values->SetString("login_status_message", message); |
| 254 values->SetString("login_status_url", | 257 values->SetString("login_status_url", |
| 255 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 258 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
| 256 values->SetString("login_status_advanced", | 259 values->SetString("login_status_advanced", |
| 257 hide_sync ? base::string16() : | 260 hide_sync ? base::string16() : |
| 258 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 261 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
| 259 values->SetString("login_status_dismiss", | 262 values->SetString("login_status_dismiss", |
| 260 hide_sync ? base::string16() : | 263 hide_sync ? base::string16() : |
| 261 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 264 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
| 262 } | 265 } |
| OLD | NEW |