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

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

Issue 1963563002: Views: Flip default value of CustomButton::request_focus_on_press_ to false. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
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/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 150 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
151 back_button->SetImage(views::ImageButton::STATE_NORMAL, 151 back_button->SetImage(views::ImageButton::STATE_NORMAL,
152 rb->GetImageSkiaNamed(IDR_BACK)); 152 rb->GetImageSkiaNamed(IDR_BACK));
153 back_button->SetImage(views::ImageButton::STATE_HOVERED, 153 back_button->SetImage(views::ImageButton::STATE_HOVERED,
154 rb->GetImageSkiaNamed(IDR_BACK_H)); 154 rb->GetImageSkiaNamed(IDR_BACK_H));
155 back_button->SetImage(views::ImageButton::STATE_PRESSED, 155 back_button->SetImage(views::ImageButton::STATE_PRESSED,
156 rb->GetImageSkiaNamed(IDR_BACK_P)); 156 rb->GetImageSkiaNamed(IDR_BACK_P));
157 back_button->SetImage(views::ImageButton::STATE_DISABLED, 157 back_button->SetImage(views::ImageButton::STATE_DISABLED,
158 rb->GetImageSkiaNamed(IDR_BACK_D)); 158 rb->GetImageSkiaNamed(IDR_BACK_D));
159 views::Button::ConfigureDefaultFocus(back_button); 159 views::Button::ConfigureDefaultFocus(back_button);
160 back_button->set_request_focus_on_press(true);
160 return back_button; 161 return back_button;
161 } 162 }
162 163
163 // BackgroundColorHoverButton ------------------------------------------------- 164 // BackgroundColorHoverButton -------------------------------------------------
164 165
165 // A custom button that allows for setting a background color when hovered over. 166 // A custom button that allows for setting a background color when hovered over.
166 class BackgroundColorHoverButton : public views::LabelButton { 167 class BackgroundColorHoverButton : public views::LabelButton {
167 public: 168 public:
168 BackgroundColorHoverButton(views::ButtonListener* listener, 169 BackgroundColorHoverButton(views::ButtonListener* listener,
169 const base::string16& text, 170 const base::string16& text,
170 const gfx::ImageSkia& icon) 171 const gfx::ImageSkia& icon)
171 : views::LabelButton(listener, text) { 172 : views::LabelButton(listener, text) {
172 SetImageLabelSpacing(views::kItemLabelSpacing); 173 SetImageLabelSpacing(views::kItemLabelSpacing);
173 SetBorder(views::Border::CreateEmptyBorder( 174 SetBorder(views::Border::CreateEmptyBorder(
174 0, views::kButtonHEdgeMarginNew, 0, views::kButtonHEdgeMarginNew)); 175 0, views::kButtonHEdgeMarginNew, 0, views::kButtonHEdgeMarginNew));
175 SetMinSize(gfx::Size(0, 176 SetMinSize(gfx::Size(0,
176 kButtonHeight + views::kRelatedControlVerticalSpacing)); 177 kButtonHeight + views::kRelatedControlVerticalSpacing));
177 SetImage(STATE_NORMAL, icon); 178 SetImage(STATE_NORMAL, icon);
178 Button::ConfigureDefaultFocus(this); 179 Button::ConfigureDefaultFocus(this);
180 set_request_focus_on_press(true);
179 } 181 }
180 182
181 ~BackgroundColorHoverButton() override {} 183 ~BackgroundColorHoverButton() override {}
182 184
183 private: 185 private:
184 // views::LabelButton: 186 // views::LabelButton:
185 void OnPaint(gfx::Canvas* canvas) override { 187 void OnPaint(gfx::Canvas* canvas) override {
186 if ((state() == STATE_PRESSED) || 188 if ((state() == STATE_PRESSED) ||
187 (state() == STATE_HOVERED)) { 189 (state() == STATE_HOVERED)) {
188 canvas->DrawColor(GetNativeTheme()->GetSystemColor( 190 canvas->DrawColor(GetNativeTheme()->GetSystemColor(
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 // Badge the email address if there's an authentication error. 1399 // Badge the email address if there's an authentication error.
1398 if (HasAuthError(browser_->profile())) { 1400 if (HasAuthError(browser_->profile())) {
1399 auth_error_email_button_ = 1401 auth_error_email_button_ =
1400 new RightAlignedIconLabelButton(this, avatar_item.username); 1402 new RightAlignedIconLabelButton(this, avatar_item.username);
1401 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); 1403 auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL);
1402 auth_error_email_button_->SetImage( 1404 auth_error_email_button_->SetImage(
1403 views::LabelButton::STATE_NORMAL, 1405 views::LabelButton::STATE_NORMAL,
1404 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18, 1406 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18,
1405 gfx::kChromeIconGrey)); 1407 gfx::kChromeIconGrey));
1406 views::Button::ConfigureDefaultFocus(auth_error_email_button_); 1408 views::Button::ConfigureDefaultFocus(auth_error_email_button_);
1409 auth_error_email_button_->set_request_focus_on_press(true);
1407 gfx::Insets insets = 1410 gfx::Insets insets =
1408 views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( 1411 views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
1409 views::Button::STYLE_TEXTBUTTON); 1412 views::Button::STYLE_TEXTBUTTON);
1410 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder( 1413 auth_error_email_button_->SetBorder(views::Border::CreateEmptyBorder(
1411 insets.top(), insets.left(), insets.bottom(), insets.right())); 1414 insets.top(), insets.left(), insets.bottom(), insets.right()));
1412 layout->AddView(auth_error_email_button_); 1415 layout->AddView(auth_error_email_button_);
1413 } else { 1416 } else {
1414 // Add a small padding between the email button and the profile name. 1417 // Add a small padding between the email button and the profile name.
1415 layout->StartRowWithPadding(1, 0, 0, 2); 1418 layout->StartRowWithPadding(1, 0, 0, 2);
1416 views::Label* email_label = new views::Label(avatar_item.username); 1419 views::Label* email_label = new views::Label(avatar_item.username);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1888 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1886 IncognitoModePrefs::DISABLED; 1889 IncognitoModePrefs::DISABLED;
1887 return incognito_available && !browser_->profile()->IsGuestSession(); 1890 return incognito_available && !browser_->profile()->IsGuestSession();
1888 } 1891 }
1889 1892
1890 void ProfileChooserView::PostActionPerformed( 1893 void ProfileChooserView::PostActionPerformed(
1891 ProfileMetrics::ProfileDesktopMenu action_performed) { 1894 ProfileMetrics::ProfileDesktopMenu action_performed) {
1892 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1895 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1893 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1896 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1894 } 1897 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698