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

Side by Side Diff: chrome/browser/signin/signin_ui_util.cc

Issue 809313009: Make the SigninErrorController a PKS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Copyrighted: 2015 Created 5 years, 11 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 unified diff | Download patch
OLDNEW
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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/signin/account_tracker_service_factory.h" 11 #include "chrome/browser/signin/account_tracker_service_factory.h"
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 12 #include "chrome/browser/signin/signin_error_controller_factory.h"
13 #include "chrome/browser/signin/signin_global_error.h" 13 #include "chrome/browser/signin/signin_global_error.h"
14 #include "chrome/browser/signin/signin_global_error_factory.h" 14 #include "chrome/browser/signin/signin_global_error_factory.h"
15 #include "chrome/browser/signin/signin_manager_factory.h" 15 #include "chrome/browser/signin/signin_manager_factory.h"
16 #include "chrome/browser/sync/profile_sync_service.h" 16 #include "chrome/browser/sync/profile_sync_service.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h" 17 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/browser/sync/sync_global_error.h" 18 #include "chrome/browser/sync/sync_global_error.h"
19 #include "chrome/browser/sync/sync_global_error_factory.h" 19 #include "chrome/browser/sync/sync_global_error_factory.h"
20 #include "chrome/browser/ui/browser_navigator.h" 20 #include "chrome/browser/ui/browser_navigator.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "chrome/grit/chromium_strings.h" 22 #include "chrome/grit/chromium_strings.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "components/signin/core/browser/account_tracker_service.h" 24 #include "components/signin/core/browser/account_tracker_service.h"
25 #include "components/signin/core/browser/profile_oauth2_token_service.h"
26 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
27 #include "components/signin/core/common/profile_management_switches.h" 26 #include "components/signin/core/common/profile_management_switches.h"
28 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/gfx/font_list.h" 28 #include "ui/gfx/font_list.h"
30 #include "ui/gfx/text_elider.h" 29 #include "ui/gfx/text_elider.h"
31 30
32 namespace { 31 namespace {
33 // Maximum width of a username - we trim emails that are wider than this so 32 // Maximum width of a username - we trim emails that are wider than this so
34 // the wrench menu doesn't get ridiculously wide. 33 // the wrench menu doesn't get ridiculously wide.
35 const int kUsernameMaxWidth = 200; 34 const int kUsernameMaxWidth = 200;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // that can be used to display information about the state. 99 // that can be used to display information about the state.
101 void GetStatusLabelsForAuthError(Profile* profile, 100 void GetStatusLabelsForAuthError(Profile* profile,
102 const SigninManagerBase& signin_manager, 101 const SigninManagerBase& signin_manager,
103 base::string16* status_label, 102 base::string16* status_label,
104 base::string16* link_label) { 103 base::string16* link_label) {
105 base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); 104 base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
106 if (link_label) 105 if (link_label)
107 link_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL)); 106 link_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL));
108 107
109 const GoogleServiceAuthError::State state = 108 const GoogleServiceAuthError::State state =
110 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> 109 SigninErrorControllerFactory::GetForProfile(profile)->
111 signin_error_controller()->auth_error().state(); 110 auth_error().state();
112 switch (state) { 111 switch (state) {
113 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: 112 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
114 case GoogleServiceAuthError::SERVICE_ERROR: 113 case GoogleServiceAuthError::SERVICE_ERROR:
115 case GoogleServiceAuthError::ACCOUNT_DELETED: 114 case GoogleServiceAuthError::ACCOUNT_DELETED:
116 case GoogleServiceAuthError::ACCOUNT_DISABLED: 115 case GoogleServiceAuthError::ACCOUNT_DISABLED:
117 // If the user name is empty then the first login failed, otherwise the 116 // If the user name is empty then the first login failed, otherwise the
118 // credentials are out-of-date. 117 // credentials are out-of-date.
119 if (!signin_manager.IsAuthenticated()) { 118 if (!signin_manager.IsAuthenticated()) {
120 if (status_label) { 119 if (status_label) {
121 status_label->assign( 120 status_label->assign(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 std::string email = account_tracker->GetAccountInfo(account_id).email; 179 std::string email = account_tracker->GetAccountInfo(account_id).email;
181 if (email.empty()) { 180 if (email.empty()) {
182 DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED, 181 DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED,
183 account_tracker->GetMigrationState()); 182 account_tracker->GetMigrationState());
184 return account_id; 183 return account_id;
185 } 184 }
186 return email; 185 return email;
187 } 186 }
188 187
189 } // namespace signin_ui_util 188 } // namespace signin_ui_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698