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

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

Issue 1307093004: Remove references to IsNewAvatarMenu since the flag was removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review feedback Created 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/signin/signin_global_error.h ('k') | chrome/browser/signin/signin_promo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 17 matching lines...) Expand all
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 29
30 #if !defined(OS_ANDROID) && !defined(OS_IOS) 30 #if !defined(OS_ANDROID) && !defined(OS_IOS)
31 #include "chrome/browser/signin/signin_promo.h" 31 #include "chrome/browser/signin/signin_promo.h"
32 #endif 32 #endif
33 33
34 SigninGlobalError::SigninGlobalError( 34 SigninGlobalError::SigninGlobalError(
35 SigninErrorController* error_controller, 35 SigninErrorController* error_controller,
36 Profile* profile) 36 Profile* profile)
37 : profile_(profile), 37 : profile_(profile),
38 error_controller_(error_controller), 38 error_controller_(error_controller) {
39 is_added_to_global_error_service_(false) {
40 error_controller_->AddObserver(this); 39 error_controller_->AddObserver(this);
41 is_added_to_global_error_service_ = !switches::IsNewAvatarMenu();
42 if (is_added_to_global_error_service_)
43 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this);
44 } 40 }
45 41
46 SigninGlobalError::~SigninGlobalError() { 42 SigninGlobalError::~SigninGlobalError() {
47 DCHECK(!error_controller_) 43 DCHECK(!error_controller_)
48 << "SigninGlobalError::Shutdown() was not called"; 44 << "SigninGlobalError::Shutdown() was not called";
49 } 45 }
50 46
51 bool SigninGlobalError::HasError() { 47 bool SigninGlobalError::HasError() {
52 return HasMenuItem(); 48 return HasMenuItem();
53 } 49 }
54 50
55 void SigninGlobalError::AttemptToFixError(Browser* browser) { 51 void SigninGlobalError::AttemptToFixError(Browser* browser) {
56 if (!HasError()) 52 if (!HasError())
57 return; 53 return;
58 54
59 ExecuteMenuItem(browser); 55 ExecuteMenuItem(browser);
60 } 56 }
61 57
62 void SigninGlobalError::Shutdown() { 58 void SigninGlobalError::Shutdown() {
63 if (is_added_to_global_error_service_) {
64 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this);
65 is_added_to_global_error_service_ = false;
66 }
67
68 error_controller_->RemoveObserver(this); 59 error_controller_->RemoveObserver(this);
69 error_controller_ = NULL; 60 error_controller_ = NULL;
70 } 61 }
71 62
72 bool SigninGlobalError::HasMenuItem() { 63 bool SigninGlobalError::HasMenuItem() {
73 return error_controller_->HasError(); 64 return error_controller_->HasError();
74 } 65 }
75 66
76 int SigninGlobalError::MenuItemCommandID() { 67 int SigninGlobalError::MenuItemCommandID() {
77 return IDC_SHOW_SIGNIN_ERROR; 68 return IDC_SHOW_SIGNIN_ERROR;
(...skipping 21 matching lines...) Expand all
99 #if !defined(OS_ANDROID) && !defined(OS_IOS) 90 #if !defined(OS_ANDROID) && !defined(OS_IOS)
100 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); 91 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_);
101 if (login_ui->current_login_ui()) { 92 if (login_ui->current_login_ui()) {
102 login_ui->current_login_ui()->FocusUI(); 93 login_ui->current_login_ui()->FocusUI();
103 return; 94 return;
104 } 95 }
105 96
106 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", 97 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth",
107 signin_metrics::HISTOGRAM_REAUTH_SHOWN, 98 signin_metrics::HISTOGRAM_REAUTH_SHOWN,
108 signin_metrics::HISTOGRAM_REAUTH_MAX); 99 signin_metrics::HISTOGRAM_REAUTH_MAX);
109 if (switches::IsNewAvatarMenu()) { 100 browser->window()->ShowAvatarBubbleFromAvatarButton(
110 browser->window()->ShowAvatarBubbleFromAvatarButton( 101 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH,
111 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, 102 signin::ManageAccountsParams());
112 signin::ManageAccountsParams());
113 } else {
114 chrome::ShowSingletonTab(
115 browser,
116 signin::GetReauthURL(profile_, error_controller_->error_account_id()));
117 }
118 #endif 103 #endif
119 } 104 }
120 105
121 bool SigninGlobalError::HasBubbleView() { 106 bool SigninGlobalError::HasBubbleView() {
122 return !GetBubbleViewMessages().empty(); 107 return !GetBubbleViewMessages().empty();
123 } 108 }
124 109
125 base::string16 SigninGlobalError::GetBubbleViewTitle() { 110 base::string16 SigninGlobalError::GetBubbleViewTitle() {
126 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); 111 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE);
127 } 112 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ExecuteMenuItem(browser); 172 ExecuteMenuItem(browser);
188 } 173 }
189 174
190 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { 175 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) {
191 NOTREACHED(); 176 NOTREACHED();
192 } 177 }
193 178
194 void SigninGlobalError::OnErrorChanged() { 179 void SigninGlobalError::OnErrorChanged() {
195 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); 180 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this);
196 } 181 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_global_error.h ('k') | chrome/browser/signin/signin_promo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698