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

Side by Side Diff: ui/views/controls/button/image_button.cc

Issue 1817253003: [MD] Use same focus ring on BarControlButton as MdTextButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update docs Created 4 years, 9 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/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/label_button.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 (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 "ui/views/controls/button/image_button.h" 5 #include "ui/views/controls/button/image_button.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 canvas->DrawImageInt(img, position.x(), position.y()); 129 canvas->DrawImageInt(img, position.x(), position.y());
130 } 130 }
131 131
132 Painter::PaintFocusPainter(this, canvas, focus_painter()); 132 Painter::PaintFocusPainter(this, canvas, focus_painter());
133 } 133 }
134 134
135 //////////////////////////////////////////////////////////////////////////////// 135 ////////////////////////////////////////////////////////////////////////////////
136 // ImageButton, protected: 136 // ImageButton, protected:
137 137
138 void ImageButton::OnFocus() { 138 void ImageButton::OnFocus() {
139 View::OnFocus(); 139 CustomButton::OnFocus();
140 if (focus_painter_.get()) 140 if (focus_painter_.get())
141 SchedulePaint(); 141 SchedulePaint();
142 } 142 }
143 143
144 void ImageButton::OnBlur() { 144 void ImageButton::OnBlur() {
145 View::OnBlur(); 145 CustomButton::OnBlur();
146 if (focus_painter_.get()) 146 if (focus_painter_.get())
147 SchedulePaint(); 147 SchedulePaint();
148 } 148 }
149 149
150 gfx::ImageSkia ImageButton::GetImageToPaint() { 150 gfx::ImageSkia ImageButton::GetImageToPaint() {
151 gfx::ImageSkia img; 151 gfx::ImageSkia img;
152 152
153 if (!images_[STATE_HOVERED].isNull() && hover_animation().is_animating()) { 153 if (!images_[STATE_HOVERED].isNull() && hover_animation().is_animating()) {
154 img = gfx::ImageSkiaOperations::CreateBlendedImage( 154 img = gfx::ImageSkiaOperations::CreateBlendedImage(
155 images_[STATE_NORMAL], images_[STATE_HOVERED], 155 images_[STATE_NORMAL], images_[STATE_HOVERED],
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 *tooltip = toggled_tooltip_text_; 266 *tooltip = toggled_tooltip_text_;
267 return true; 267 return true;
268 } 268 }
269 269
270 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { 270 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) {
271 ImageButton::GetAccessibleState(state); 271 ImageButton::GetAccessibleState(state);
272 GetTooltipText(gfx::Point(), &state->name); 272 GetTooltipText(gfx::Point(), &state->name);
273 } 273 }
274 274
275 } // namespace views 275 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698