| Index: chrome/browser/signin/signin_ui_util.cc
|
| diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc
|
| index a5ed1122b1c59a704cf6411bc19d223e9a33527b..8710548fe0bd501343aea5340de1fa0a1364fb8f 100644
|
| --- a/chrome/browser/signin/signin_ui_util.cc
|
| +++ b/chrome/browser/signin/signin_ui_util.cc
|
| @@ -10,8 +10,6 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/signin/account_tracker_service_factory.h"
|
| #include "chrome/browser/signin/signin_error_controller_factory.h"
|
| -#include "chrome/browser/signin/signin_global_error.h"
|
| -#include "chrome/browser/signin/signin_global_error_factory.h"
|
| #include "chrome/browser/signin/signin_manager_factory.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| #include "chrome/browser/sync/profile_sync_service_factory.h"
|
| @@ -28,73 +26,8 @@
|
| #include "ui/gfx/font_list.h"
|
| #include "ui/gfx/text_elider.h"
|
|
|
| -namespace {
|
| -// Maximum width of a username - we trim emails that are wider than this so
|
| -// the wrench menu doesn't get ridiculously wide.
|
| -const int kUsernameMaxWidth = 200;
|
| -} // namespace
|
| -
|
| namespace signin_ui_util {
|
|
|
| -GlobalError* GetSignedInServiceError(Profile* profile) {
|
| - std::vector<GlobalError*> errors = GetSignedInServiceErrors(profile);
|
| - if (errors.empty())
|
| - return NULL;
|
| - return errors[0];
|
| -}
|
| -
|
| -std::vector<GlobalError*> GetSignedInServiceErrors(Profile* profile) {
|
| - std::vector<GlobalError*> errors;
|
| - // Chrome OS doesn't use SigninGlobalError or SyncGlobalError. Other platforms
|
| - // may use these services to show auth and sync errors in the toolbar menu.
|
| -#if !defined(OS_CHROMEOS)
|
| - // Auth errors have the highest priority - after that, individual service
|
| - // errors.
|
| - SigninGlobalError* signin_error =
|
| - SigninGlobalErrorFactory::GetForProfile(profile);
|
| - if (signin_error && signin_error->HasError())
|
| - errors.push_back(signin_error);
|
| -
|
| - // No auth error - now try other services. Currently the list is just hard-
|
| - // coded but in the future if we add more we can create some kind of
|
| - // registration framework.
|
| - if (profile->IsSyncAllowed()) {
|
| - SyncGlobalError* error = SyncGlobalErrorFactory::GetForProfile(profile);
|
| - if (error && error->HasMenuItem())
|
| - errors.push_back(error);
|
| - }
|
| -#endif
|
| -
|
| - return errors;
|
| -}
|
| -
|
| -base::string16 GetSigninMenuLabel(Profile* profile) {
|
| - GlobalError* error = signin_ui_util::GetSignedInServiceError(profile);
|
| - if (error)
|
| - return error->MenuItemLabel();
|
| -
|
| - // No errors, so just display the signed in user, if any.
|
| - ProfileSyncService* service = profile->IsSyncAllowed() ?
|
| - ProfileSyncServiceFactory::GetForProfile(profile) : NULL;
|
| -
|
| - // Even if the user is signed in, don't display the "signed in as..."
|
| - // label if we're still setting up sync.
|
| - if (!service || !service->FirstSetupInProgress()) {
|
| - std::string username;
|
| - SigninManagerBase* signin_manager =
|
| - SigninManagerFactory::GetForProfileIfExists(profile);
|
| - if (signin_manager)
|
| - username = signin_manager->GetAuthenticatedUsername();
|
| - if (!username.empty() && !signin_manager->AuthInProgress()) {
|
| - const base::string16 elided = gfx::ElideText(base::UTF8ToUTF16(username),
|
| - gfx::FontList(), kUsernameMaxWidth, gfx::ELIDE_EMAIL);
|
| - return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL, elided);
|
| - }
|
| - }
|
| - return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL,
|
| - l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
|
| -}
|
| -
|
| // Given an authentication state this helper function returns various labels
|
| // that can be used to display information about the state.
|
| void GetStatusLabelsForAuthError(Profile* profile,
|
|
|