Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3543)

Unified Diff: chrome/browser/signin/signin_ui_util.cc

Issue 2435053002: Remove the sign-in menu item on macOS. (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/signin/signin_ui_util.h ('k') | chrome/browser/ui/cocoa/browser_window_command_handler.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b2576bc2c1e0fc87e6e7a8456f661bf3582d6151..a7a6c9928b91c43d10b34aa601ec2cf67435b446 100644
--- a/chrome/browser/signin/signin_ui_util.cc
+++ b/chrome/browser/signin/signin_ui_util.cc
@@ -34,49 +34,6 @@
namespace signin_ui_util {
-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;
-
-// Returns all errors reported by signed in services.
-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;
-}
-
-// If a signed in service is reporting an error, returns the GlobalError
-// object associated with that service, or null if no errors are reported.
-GlobalError* GetSignedInServiceError(Profile* profile) {
- std::vector<GlobalError*> errors = GetSignedInServiceErrors(profile);
- if (errors.empty())
- return nullptr;
- return errors[0];
-}
-
-} // namespace
-
base::string16 GetAuthenticatedUsername(const SigninManagerBase* signin) {
std::string user_display_name;
@@ -96,35 +53,6 @@ base::string16 GetAuthenticatedUsername(const SigninManagerBase* signin) {
return base::UTF8ToUTF16(user_display_name);
}
-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.
- browser_sync::ProfileSyncService* service =
- profile->IsSyncAllowed()
- ? ProfileSyncServiceFactory::GetForProfile(profile)
- : nullptr;
-
- // 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->IsFirstSetupInProgress()) {
- std::string username;
- SigninManagerBase* signin_manager =
- SigninManagerFactory::GetForProfileIfExists(profile);
- if (signin_manager)
- username = signin_manager->GetAuthenticatedAccountInfo().email;
- 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,
« no previous file with comments | « chrome/browser/signin/signin_ui_util.h ('k') | chrome/browser/ui/cocoa/browser_window_command_handler.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698