| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/signin/signin_ui_util.h" | 5 #include "chrome/browser/signin/signin_ui_util.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/signin_global_error.h" | 10 #include "chrome/browser/signin/signin_global_error.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // No errors, so just display the signed in user, if any. | 65 // No errors, so just display the signed in user, if any. |
| 66 ProfileSyncService* service = profile->IsSyncAccessible() ? | 66 ProfileSyncService* service = profile->IsSyncAccessible() ? |
| 67 ProfileSyncServiceFactory::GetForProfile(profile) : NULL; | 67 ProfileSyncServiceFactory::GetForProfile(profile) : NULL; |
| 68 | 68 |
| 69 // Even if the user is signed in, don't display the "signed in as..." | 69 // Even if the user is signed in, don't display the "signed in as..." |
| 70 // label if we're still setting up sync. | 70 // label if we're still setting up sync. |
| 71 if (!service || !service->FirstSetupInProgress()) { | 71 if (!service || !service->FirstSetupInProgress()) { |
| 72 std::string username; | 72 std::string username; |
| 73 SigninManagerBase* signin_manager = | 73 SigninManagerBase* signin_manager = |
| 74 SigninManagerFactory::GetForProfileIfExists(profile); | 74 SigninManagerFactory::GetForBrowserContextIfExists(profile); |
| 75 if (signin_manager) | 75 if (signin_manager) |
| 76 username = signin_manager->GetAuthenticatedUsername(); | 76 username = signin_manager->GetAuthenticatedUsername(); |
| 77 if (!username.empty() && !signin_manager->AuthInProgress()) { | 77 if (!username.empty() && !signin_manager->AuthInProgress()) { |
| 78 string16 elided_username = gfx::ElideEmail(UTF8ToUTF16(username), | 78 string16 elided_username = gfx::ElideEmail(UTF8ToUTF16(username), |
| 79 gfx::Font(), | 79 gfx::Font(), |
| 80 kUsernameMaxWidth); | 80 kUsernameMaxWidth); |
| 81 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL, | 81 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL, |
| 82 elided_username); | 82 elided_username); |
| 83 } | 83 } |
| 84 } | 84 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 default: | 140 default: |
| 141 if (status_label) { | 141 if (status_label) { |
| 142 status_label->assign(l10n_util::GetStringUTF16( | 142 status_label->assign(l10n_util::GetStringUTF16( |
| 143 IDS_SYNC_ERROR_SIGNING_IN)); | 143 IDS_SYNC_ERROR_SIGNING_IN)); |
| 144 } | 144 } |
| 145 break; | 145 break; |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace signin_ui_util | 149 } // namespace signin_ui_util |
| OLD | NEW |