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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 views::Painter::CreateImageGridPainter(kHoveredImageSet)); 154 views::Painter::CreateImageGridPainter(kHoveredImageSet));
155 const int kPressedImageSet[] = IMAGE_GRID(IDR_INFOBARBUTTON_PRESSED); 155 const int kPressedImageSet[] = IMAGE_GRID(IDR_INFOBARBUTTON_PRESSED);
156 button_border->SetPainter( 156 button_border->SetPainter(
157 false, views::Button::STATE_PRESSED, 157 false, views::Button::STATE_PRESSED,
158 views::Painter::CreateImageGridPainter(kPressedImageSet)); 158 views::Painter::CreateImageGridPainter(kPressedImageSet));
159 button->SetBorder(std::move(button_border)); 159 button->SetBorder(std::move(button_border));
160 button->set_animate_on_state_change(false); 160 button->set_animate_on_state_change(false);
161 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 161 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
162 button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); 162 button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont));
163 views::Button::ConfigureDefaultFocus(button); 163 views::Button::ConfigureDefaultFocus(button);
164 button->set_request_focus_on_press(true);
164 button->SetTextColor(views::Button::STATE_NORMAL, GetInfobarTextColor()); 165 button->SetTextColor(views::Button::STATE_NORMAL, GetInfobarTextColor());
165 button->SetTextColor(views::Button::STATE_HOVERED, GetInfobarTextColor()); 166 button->SetTextColor(views::Button::STATE_HOVERED, GetInfobarTextColor());
166 return button; 167 return button;
167 } 168 }
168 169
169 views::MdTextButton* InfoBarView::CreateMdTextButton( 170 views::MdTextButton* InfoBarView::CreateMdTextButton(
170 views::ButtonListener* listener, 171 views::ButtonListener* listener,
171 const base::string16& text) { 172 const base::string16& text) {
172 DCHECK(ui::MaterialDesignController::IsModeMaterial()); 173 DCHECK(ui::MaterialDesignController::IsModeMaterial());
173 views::MdTextButton* button = 174 views::MdTextButton* button =
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 icon_ = new views::ImageView; 269 icon_ = new views::ImageView;
269 icon_->SetImage(image.ToImageSkia()); 270 icon_->SetImage(image.ToImageSkia());
270 icon_->SizeToPreferredSize(); 271 icon_->SizeToPreferredSize();
271 child_container_->AddChildView(icon_); 272 child_container_->AddChildView(icon_);
272 } 273 }
273 274
274 if (ui::MaterialDesignController::IsModeMaterial()) { 275 if (ui::MaterialDesignController::IsModeMaterial()) {
275 BarControlButton* close = new BarControlButton(this); 276 BarControlButton* close = new BarControlButton(this);
276 close->SetIcon(gfx::VectorIconId::BAR_CLOSE, 277 close->SetIcon(gfx::VectorIconId::BAR_CLOSE,
277 base::Bind(&GetInfobarTextColor)); 278 base::Bind(&GetInfobarTextColor));
278 close->set_request_focus_on_press(false);
279 close_button_ = close; 279 close_button_ = close;
280 } else { 280 } else {
281 close_button_ = new views::ImageButton(this); 281 close_button_ = new views::ImageButton(this);
282 close_button_->set_request_focus_on_press(true);
282 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 283 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
283 close_button_->SetImage(views::CustomButton::STATE_NORMAL, 284 close_button_->SetImage(views::CustomButton::STATE_NORMAL,
284 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia()); 285 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia());
285 close_button_->SetImage(views::CustomButton::STATE_HOVERED, 286 close_button_->SetImage(views::CustomButton::STATE_HOVERED,
286 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia()); 287 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia());
287 close_button_->SetImage(views::CustomButton::STATE_PRESSED, 288 close_button_->SetImage(views::CustomButton::STATE_PRESSED,
288 rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia()); 289 rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia());
289 } 290 }
290 close_button_->SetAccessibleName( 291 close_button_->SetAccessibleName(
291 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 292 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 437 }
437 438
438 bool InfoBarView::DoesIntersectRect(const View* target, 439 bool InfoBarView::DoesIntersectRect(const View* target,
439 const gfx::Rect& rect) const { 440 const gfx::Rect& rect) const {
440 DCHECK_EQ(this, target); 441 DCHECK_EQ(this, target);
441 // Only events that intersect the portion below the arrow are interesting. 442 // Only events that intersect the portion below the arrow are interesting.
442 gfx::Rect non_arrow_bounds = GetLocalBounds(); 443 gfx::Rect non_arrow_bounds = GetLocalBounds();
443 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); 444 non_arrow_bounds.Inset(0, arrow_height(), 0, 0);
444 return rect.Intersects(non_arrow_bounds); 445 return rect.Intersects(non_arrow_bounds);
445 } 446 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698