OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/views/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); | 1199 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); |
1200 manage_accounts_link_ = CreateLink(link_title, this); | 1200 manage_accounts_link_ = CreateLink(link_title, this); |
1201 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 1201 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
1202 layout->AddView(manage_accounts_link_); | 1202 layout->AddView(manage_accounts_link_); |
1203 } else { | 1203 } else { |
1204 // Badge the email address if there's an authentication error. | 1204 // Badge the email address if there's an authentication error. |
1205 if (HasAuthError(browser_->profile())) { | 1205 if (HasAuthError(browser_->profile())) { |
1206 const gfx::ImageSkia warning_image = *rb->GetImageNamed( | 1206 const gfx::ImageSkia warning_image = *rb->GetImageNamed( |
1207 IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR).ToImageSkia(); | 1207 IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR).ToImageSkia(); |
1208 auth_error_email_button_ = | 1208 auth_error_email_button_ = |
1209 new RightAlignedIconLabelButton(this, avatar_item.sync_state); | 1209 new RightAlignedIconLabelButton(this, avatar_item.username); |
1210 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); | 1210 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); |
1211 auth_error_email_button_->SetImage( | 1211 auth_error_email_button_->SetImage( |
1212 views::LabelButton::STATE_NORMAL, warning_image); | 1212 views::LabelButton::STATE_NORMAL, warning_image); |
1213 auth_error_email_button_->SetTextColor( | 1213 auth_error_email_button_->SetTextColor( |
1214 views::LabelButton::STATE_NORMAL, | 1214 views::LabelButton::STATE_NORMAL, |
1215 views::Link::GetDefaultEnabledColor()); | 1215 views::Link::GetDefaultEnabledColor()); |
1216 auth_error_email_button_->SetFocusable(true); | 1216 auth_error_email_button_->SetFocusable(true); |
1217 gfx::Insets insets = views::LabelButtonBorder::GetDefaultInsetsForStyle( | 1217 gfx::Insets insets = views::LabelButtonBorder::GetDefaultInsetsForStyle( |
1218 views::Button::STYLE_TEXTBUTTON); | 1218 views::Button::STYLE_TEXTBUTTON); |
1219 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder( | 1219 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder( |
1220 insets.top(), insets.left(), insets.bottom(), insets.right())); | 1220 insets.top(), insets.left(), insets.bottom(), insets.right())); |
1221 layout->AddView(auth_error_email_button_); | 1221 layout->AddView(auth_error_email_button_); |
1222 } else { | 1222 } else { |
1223 // Add a small padding between the email button and the profile name. | 1223 // Add a small padding between the email button and the profile name. |
1224 layout->StartRowWithPadding(1, 0, 0, 2); | 1224 layout->StartRowWithPadding(1, 0, 0, 2); |
1225 views::Label* email_label = new views::Label(avatar_item.sync_state); | 1225 views::Label* email_label = new views::Label(avatar_item.username); |
1226 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); | 1226 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); |
1227 email_label->SetEnabled(false); | 1227 email_label->SetEnabled(false); |
1228 layout->AddView(email_label); | 1228 layout->AddView(email_label); |
1229 } | 1229 } |
1230 } | 1230 } |
1231 } else { | 1231 } else { |
1232 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile( | 1232 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile( |
1233 browser_->profile()->GetOriginalProfile()); | 1233 browser_->profile()->GetOriginalProfile()); |
1234 if (signin_manager->IsSigninAllowed()) { | 1234 if (signin_manager->IsSigninAllowed()) { |
1235 views::Label* promo = new views::Label( | 1235 views::Label* promo = new views::Label( |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1704 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1705 IncognitoModePrefs::DISABLED; | 1705 IncognitoModePrefs::DISABLED; |
1706 return incognito_available && !browser_->profile()->IsGuestSession(); | 1706 return incognito_available && !browser_->profile()->IsGuestSession(); |
1707 } | 1707 } |
1708 | 1708 |
1709 void ProfileChooserView::PostActionPerformed( | 1709 void ProfileChooserView::PostActionPerformed( |
1710 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1710 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1711 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1711 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1712 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1712 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1713 } | 1713 } |
OLD | NEW |