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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 1461923002: Change name of NativeTheme::instance() to make it clear it's web only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NATIVE_THEME_EXPORT for mac Created 5 years 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 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 profiles::TutorialMode tutorial_mode, 649 profiles::TutorialMode tutorial_mode,
650 signin::GAIAServiceType service_type) 650 signin::GAIAServiceType service_type)
651 : BubbleDelegateView(anchor_view, arrow), 651 : BubbleDelegateView(anchor_view, arrow),
652 browser_(browser), 652 browser_(browser),
653 view_mode_(view_mode), 653 view_mode_(view_mode),
654 tutorial_mode_(tutorial_mode), 654 tutorial_mode_(tutorial_mode),
655 gaia_service_type_(service_type) { 655 gaia_service_type_(service_type) {
656 // Reset the default margins inherited from the BubbleDelegateView. 656 // Reset the default margins inherited from the BubbleDelegateView.
657 // Add a small bottom inset so that the bubble's rounded corners show up. 657 // Add a small bottom inset so that the bubble's rounded corners show up.
658 set_margins(gfx::Insets(0, 0, 1, 0)); 658 set_margins(gfx::Insets(0, 0, 1, 0));
659 set_background(views::Background::CreateSolidBackground(
660 GetNativeTheme()->GetSystemColor(
661 ui::NativeTheme::kColorId_DialogBackground)));
662 ResetView(); 659 ResetView();
663 660
664 avatar_menu_.reset(new AvatarMenu( 661 avatar_menu_.reset(new AvatarMenu(
665 &g_browser_process->profile_manager()->GetProfileInfoCache(), 662 &g_browser_process->profile_manager()->GetProfileInfoCache(),
666 this, 663 this,
667 browser_)); 664 browser_));
668 avatar_menu_->RebuildMenu(); 665 avatar_menu_->RebuildMenu();
669 666
670 ProfileOAuth2TokenService* oauth2_token_service = 667 ProfileOAuth2TokenService* oauth2_token_service =
671 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); 668 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; 715 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
719 } 716 }
720 717
721 // The arrow keys can be used to tab between items. 718 // The arrow keys can be used to tab between items.
722 AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE)); 719 AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE));
723 AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE)); 720 AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE));
724 721
725 ShowView(view_mode_, avatar_menu_.get()); 722 ShowView(view_mode_, avatar_menu_.get());
726 } 723 }
727 724
725 void ProfileChooserView::OnNativeThemeChanged(
726 const ui::NativeTheme* native_theme) {
727 views::BubbleDelegateView::OnNativeThemeChanged(native_theme);
728 set_background(views::Background::CreateSolidBackground(
729 GetNativeTheme()->GetSystemColor(
730 ui::NativeTheme::kColorId_DialogBackground)));
731 if (auth_error_email_button_) {
732 auth_error_email_button_->SetTextColor(
733 views::LabelButton::STATE_NORMAL,
734 native_theme->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled));
735 }
736 }
737
728 void ProfileChooserView::OnAvatarMenuChanged( 738 void ProfileChooserView::OnAvatarMenuChanged(
729 AvatarMenu* avatar_menu) { 739 AvatarMenu* avatar_menu) {
730 if (IsProfileChooser(view_mode_) || 740 if (IsProfileChooser(view_mode_) ||
731 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { 741 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) {
732 // Refresh the view with the new menu. We can't just update the local copy 742 // 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 743 // as this may have been triggered by a sign out action, in which case
734 // the view is being destroyed. 744 // the view is being destroyed.
735 ShowView(view_mode_, avatar_menu); 745 ShowView(view_mode_, avatar_menu);
736 } 746 }
737 } 747 }
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 // Badge the email address if there's an authentication error. 1360 // Badge the email address if there's an authentication error.
1351 if (HasAuthError(browser_->profile())) { 1361 if (HasAuthError(browser_->profile())) {
1352 auth_error_email_button_ = 1362 auth_error_email_button_ =
1353 new RightAlignedIconLabelButton(this, avatar_item.username); 1363 new RightAlignedIconLabelButton(this, avatar_item.username);
1354 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); 1364 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL);
1355 auth_error_email_button_->SetImage( 1365 auth_error_email_button_->SetImage(
1356 views::LabelButton::STATE_NORMAL, 1366 views::LabelButton::STATE_NORMAL,
1357 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18, 1367 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18,
1358 gfx::kChromeIconGrey)); 1368 gfx::kChromeIconGrey));
1359 1369
1360 auth_error_email_button_->SetTextColor(
1361 views::LabelButton::STATE_NORMAL,
1362 ui::NativeTheme::instance()->GetSystemColor(
1363 ui::NativeTheme::kColorId_LinkEnabled));
1364 auth_error_email_button_->SetFocusable(true); 1370 auth_error_email_button_->SetFocusable(true);
1365 gfx::Insets insets = 1371 gfx::Insets insets =
1366 views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( 1372 views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
1367 views::Button::STYLE_TEXTBUTTON); 1373 views::Button::STYLE_TEXTBUTTON);
1368 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder( 1374 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder(
1369 insets.top(), insets.left(), insets.bottom(), insets.right())); 1375 insets.top(), insets.left(), insets.bottom(), insets.right()));
1370 layout->AddView(auth_error_email_button_); 1376 layout->AddView(auth_error_email_button_);
1371 } else { 1377 } else {
1372 // Add a small padding between the email button and the profile name. 1378 // Add a small padding between the email button and the profile name.
1373 layout->StartRowWithPadding(1, 0, 0, 2); 1379 layout->StartRowWithPadding(1, 0, 0, 2);
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1877 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1872 IncognitoModePrefs::DISABLED; 1878 IncognitoModePrefs::DISABLED;
1873 return incognito_available && !browser_->profile()->IsGuestSession(); 1879 return incognito_available && !browser_->profile()->IsGuestSession();
1874 } 1880 }
1875 1881
1876 void ProfileChooserView::PostActionPerformed( 1882 void ProfileChooserView::PostActionPerformed(
1877 ProfileMetrics::ProfileDesktopMenu action_performed) { 1883 ProfileMetrics::ProfileDesktopMenu action_performed) {
1878 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1884 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1879 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1885 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1880 } 1886 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698