| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 718 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
| 719 } | 719 } |
| 720 | 720 |
| 721 // The arrow keys can be used to tab between items. | 721 // The arrow keys can be used to tab between items. |
| 722 AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE)); | 722 AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE)); |
| 723 AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE)); | 723 AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE)); |
| 724 | 724 |
| 725 ShowView(view_mode_, avatar_menu_.get()); | 725 ShowView(view_mode_, avatar_menu_.get()); |
| 726 } | 726 } |
| 727 | 727 |
| 728 void ProfileChooserView::OnNativeThemeChanged( |
| 729 const ui::NativeTheme* native_theme) { |
| 730 views::BubbleDelegateView::OnNativeThemeChanged(native_theme); |
| 731 auth_error_email_button_->SetTextColor( |
| 732 views::LabelButton::STATE_NORMAL, |
| 733 native_theme->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled)); |
| 734 } |
| 735 |
| 728 void ProfileChooserView::OnAvatarMenuChanged( | 736 void ProfileChooserView::OnAvatarMenuChanged( |
| 729 AvatarMenu* avatar_menu) { | 737 AvatarMenu* avatar_menu) { |
| 730 if (IsProfileChooser(view_mode_) || | 738 if (IsProfileChooser(view_mode_) || |
| 731 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { | 739 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
| 732 // Refresh the view with the new menu. We can't just update the local copy | 740 // Refresh the view with the new menu. We can't just update the local copy |
| 733 // as this may have been triggered by a sign out action, in which case | 741 // as this may have been triggered by a sign out action, in which case |
| 734 // the view is being destroyed. | 742 // the view is being destroyed. |
| 735 ShowView(view_mode_, avatar_menu); | 743 ShowView(view_mode_, avatar_menu); |
| 736 } | 744 } |
| 737 } | 745 } |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 // Badge the email address if there's an authentication error. | 1357 // Badge the email address if there's an authentication error. |
| 1350 if (HasAuthError(browser_->profile())) { | 1358 if (HasAuthError(browser_->profile())) { |
| 1351 auth_error_email_button_ = | 1359 auth_error_email_button_ = |
| 1352 new RightAlignedIconLabelButton(this, avatar_item.username); | 1360 new RightAlignedIconLabelButton(this, avatar_item.username); |
| 1353 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); | 1361 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); |
| 1354 auth_error_email_button_->SetImage( | 1362 auth_error_email_button_->SetImage( |
| 1355 views::LabelButton::STATE_NORMAL, | 1363 views::LabelButton::STATE_NORMAL, |
| 1356 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18, | 1364 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18, |
| 1357 gfx::kChromeIconGrey)); | 1365 gfx::kChromeIconGrey)); |
| 1358 | 1366 |
| 1359 auth_error_email_button_->SetTextColor( | |
| 1360 views::LabelButton::STATE_NORMAL, | |
| 1361 ui::NativeTheme::instance()->GetSystemColor( | |
| 1362 ui::NativeTheme::kColorId_LinkEnabled)); | |
| 1363 auth_error_email_button_->SetFocusable(true); | 1367 auth_error_email_button_->SetFocusable(true); |
| 1364 gfx::Insets insets = | 1368 gfx::Insets insets = |
| 1365 views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( | 1369 views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( |
| 1366 views::Button::STYLE_TEXTBUTTON); | 1370 views::Button::STYLE_TEXTBUTTON); |
| 1367 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder( | 1371 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder( |
| 1368 insets.top(), insets.left(), insets.bottom(), insets.right())); | 1372 insets.top(), insets.left(), insets.bottom(), insets.right())); |
| 1369 layout->AddView(auth_error_email_button_); | 1373 layout->AddView(auth_error_email_button_); |
| 1370 } else { | 1374 } else { |
| 1371 // Add a small padding between the email button and the profile name. | 1375 // Add a small padding between the email button and the profile name. |
| 1372 layout->StartRowWithPadding(1, 0, 0, 2); | 1376 layout->StartRowWithPadding(1, 0, 0, 2); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1874 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1871 IncognitoModePrefs::DISABLED; | 1875 IncognitoModePrefs::DISABLED; |
| 1872 return incognito_available && !browser_->profile()->IsGuestSession(); | 1876 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1873 } | 1877 } |
| 1874 | 1878 |
| 1875 void ProfileChooserView::PostActionPerformed( | 1879 void ProfileChooserView::PostActionPerformed( |
| 1876 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1880 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1877 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1881 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1878 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1882 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1879 } | 1883 } |
| OLD | NEW |