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

Side by Side Diff: ui/message_center/views/padded_button.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
« no previous file with comments | « ui/message_center/views/notifier_settings_view.cc ('k') | ui/views/controls/button/checkbox.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/message_center/views/padded_button.h" 5 #include "ui/message_center/views/padded_button.h"
6 6
7 #include "ui/base/resource/resource_bundle.h" 7 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/message_center/message_center_style.h" 9 #include "ui/message_center/message_center_style.h"
10 #include "ui/views/controls/button/image_button.h" 10 #include "ui/views/controls/button/image_button.h"
11 #include "ui/views/painter.h" 11 #include "ui/views/painter.h"
12 12
13 namespace message_center { 13 namespace message_center {
14 14
15 PaddedButton::PaddedButton(views::ButtonListener* listener) 15 PaddedButton::PaddedButton(views::ButtonListener* listener)
16 : views::ImageButton(listener) { 16 : views::ImageButton(listener) {
17 Button::ConfigureDefaultFocus(this); 17 Button::ConfigureDefaultFocus(this);
18 set_request_focus_on_press(false);
19 SetFocusPainter(views::Painter::CreateSolidFocusPainter( 18 SetFocusPainter(views::Painter::CreateSolidFocusPainter(
20 kFocusBorderColor, 19 kFocusBorderColor,
21 gfx::Insets(1, 2, 2, 2))); 20 gfx::Insets(1, 2, 2, 2)));
22 } 21 }
23 22
24 PaddedButton::~PaddedButton() { 23 PaddedButton::~PaddedButton() {
25 } 24 }
26 25
27 void PaddedButton::SetPadding(int horizontal_padding, int vertical_padding) { 26 void PaddedButton::SetPadding(int horizontal_padding, int vertical_padding) {
28 padding_.Set(std::max(vertical_padding, 0), 27 padding_.Set(std::max(vertical_padding, 0),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 86
88 if (padding_.top() == 0 && padding_.bottom() == 0) 87 if (padding_.top() == 0 && padding_.bottom() == 0)
89 offset.set_y((bounds.height() - image.height()) / 2); // Middle align. 88 offset.set_y((bounds.height() - image.height()) / 2); // Middle align.
90 else if (padding_.bottom() > 0) 89 else if (padding_.bottom() > 0)
91 offset.set_y(bounds.height() - image.height()); // Bottom align. 90 offset.set_y(bounds.height() - image.height()); // Bottom align.
92 91
93 return bounds.origin() + offset; 92 return bounds.origin() + offset;
94 } 93 }
95 94
96 } // namespace message_center 95 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/notifier_settings_view.cc ('k') | ui/views/controls/button/checkbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698