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

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

Issue 240453006: Fix sign-in error strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extract separate CLs, fix new avatar button Created 6 years, 7 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 | Annotate | Revision Log
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_global_error.h" 5 #include "chrome/browser/signin/signin_global_error.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 13 matching lines...) Expand all
24 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
25 #include "net/base/url_util.h" 25 #include "net/base/url_util.h"
26 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
27 27
28 SigninGlobalError::SigninGlobalError( 28 SigninGlobalError::SigninGlobalError(
29 SigninErrorController* error_controller, 29 SigninErrorController* error_controller,
30 Profile* profile) 30 Profile* profile)
31 : profile_(profile), 31 : profile_(profile),
32 error_controller_(error_controller) { 32 error_controller_(error_controller) {
33 error_controller_->AddObserver(this); 33 error_controller_->AddObserver(this);
34 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this); 34 if (!switches::IsNewProfileManagement())
35 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this);
35 } 36 }
36 37
37 SigninGlobalError::~SigninGlobalError() { 38 SigninGlobalError::~SigninGlobalError() {
38 DCHECK(!error_controller_) 39 DCHECK(!error_controller_)
39 << "SigninGlobalError::Shutdown() was not called"; 40 << "SigninGlobalError::Shutdown() was not called";
40 } 41 }
41 42
42 bool SigninGlobalError::HasError() { 43 bool SigninGlobalError::HasError() {
43 return HasMenuItem(); 44 return HasMenuItem();
44 } 45 }
45 46
46 void SigninGlobalError::AttemptToFixError(Browser* browser) { 47 void SigninGlobalError::AttemptToFixError(Browser* browser) {
47 if (!HasError()) 48 if (!HasError())
48 return; 49 return;
49 50
50 ExecuteMenuItem(browser); 51 ExecuteMenuItem(browser);
51 } 52 }
52 53
53 void SigninGlobalError::Shutdown() { 54 void SigninGlobalError::Shutdown() {
54 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this); 55 if (!switches::IsNewProfileManagement())
56 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this);
57
55 error_controller_->RemoveObserver(this); 58 error_controller_->RemoveObserver(this);
56 error_controller_ = NULL; 59 error_controller_ = NULL;
57 } 60 }
58 61
59 bool SigninGlobalError::HasMenuItem() { 62 bool SigninGlobalError::HasMenuItem() {
60 return error_controller_->HasError(); 63 return error_controller_->HasError();
61 } 64 }
62 65
63 int SigninGlobalError::MenuItemCommandID() { 66 int SigninGlobalError::MenuItemCommandID() {
64 return IDC_SHOW_SIGNIN_ERROR; 67 return IDC_SHOW_SIGNIN_ERROR;
(...skipping 18 matching lines...) Expand all
83 #endif 86 #endif
84 87
85 // Global errors don't show up in the wrench menu on android. 88 // Global errors don't show up in the wrench menu on android.
86 #if !defined(OS_ANDROID) 89 #if !defined(OS_ANDROID)
87 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); 90 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_);
88 if (login_ui->current_login_ui()) { 91 if (login_ui->current_login_ui()) {
89 login_ui->current_login_ui()->FocusUI(); 92 login_ui->current_login_ui()->FocusUI();
90 return; 93 return;
91 } 94 }
92 95
93 chrome::ShowSingletonTab( 96 if (switches::IsNewProfileManagement()) {
94 browser, 97 browser->window()->ShowAvatarBubbleFromAvatarButton(
95 signin::GetReauthURL(profile_, error_controller_->error_account_id())); 98 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH);
99 } else {
100 chrome::ShowSingletonTab(
101 browser,
102 signin::GetReauthURL(profile_, error_controller_->error_account_id()));
103 }
96 #endif 104 #endif
97 } 105 }
98 106
99 bool SigninGlobalError::HasBubbleView() { 107 bool SigninGlobalError::HasBubbleView() {
100 return !GetBubbleViewMessages().empty(); 108 return !GetBubbleViewMessages().empty();
101 } 109 }
102 110
103 base::string16 SigninGlobalError::GetBubbleViewTitle() { 111 base::string16 SigninGlobalError::GetBubbleViewTitle() {
104 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); 112 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE);
105 } 113 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ExecuteMenuItem(browser); 176 ExecuteMenuItem(browser);
169 } 177 }
170 178
171 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { 179 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) {
172 NOTREACHED(); 180 NOTREACHED();
173 } 181 }
174 182
175 void SigninGlobalError::OnErrorChanged() { 183 void SigninGlobalError::OnErrorChanged() {
176 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); 184 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this);
177 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698