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

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

Issue 1550443002: Pushed InkDropHost inheritence up to CustomButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed whitespace in toolbar_action_view.h Created 4 years, 11 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.h ('k') | ui/views/controls/button/image_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/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 //////////////////////////////////////////////////////////////////////////////// 326 ////////////////////////////////////////////////////////////////////////////////
327 // CustomButton, gfx::AnimationDelegate implementation: 327 // CustomButton, gfx::AnimationDelegate implementation:
328 328
329 void CustomButton::AnimationProgressed(const gfx::Animation* animation) { 329 void CustomButton::AnimationProgressed(const gfx::Animation* animation) {
330 SchedulePaint(); 330 SchedulePaint();
331 } 331 }
332 332
333 //////////////////////////////////////////////////////////////////////////////// 333 ////////////////////////////////////////////////////////////////////////////////
334 // CustomButton, views::InkDropHost implementation:
335
336 void CustomButton::AddInkDropLayer(ui::Layer* ink_drop_layer) {
337 SetPaintToLayer(true);
338 SetFillsBoundsOpaquely(false);
sadrul 2016/01/06 19:18:45 It shouldn't happen here. At most, this should DCH
339 layer()->Add(ink_drop_layer);
340 layer()->StackAtBottom(ink_drop_layer);
341 }
342
343 void CustomButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
344 layer()->Remove(ink_drop_layer);
345 SetFillsBoundsOpaquely(true);
346 SetPaintToLayer(false);
347 }
348
349 gfx::Point CustomButton::CalculateInkDropCenter() const {
350 return GetLocalBounds().CenterPoint();
351 }
352
353 ////////////////////////////////////////////////////////////////////////////////
334 // CustomButton, protected: 354 // CustomButton, protected:
335 355
336 CustomButton::CustomButton(ButtonListener* listener) 356 CustomButton::CustomButton(ButtonListener* listener)
337 : Button(listener), 357 : Button(listener),
338 state_(STATE_NORMAL), 358 state_(STATE_NORMAL),
339 hover_animation_(this), 359 hover_animation_(this),
340 animate_on_state_change_(true), 360 animate_on_state_change_(true),
341 is_throbbing_(false), 361 is_throbbing_(false),
342 triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON), 362 triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON),
343 request_focus_on_press_(true), 363 request_focus_on_press_(true),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); 442 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
423 } 443 }
424 444
425 bool CustomButton::FocusInChildWidget() const { 445 bool CustomButton::FocusInChildWidget() const {
426 return GetWidget() && 446 return GetWidget() &&
427 GetWidget()->GetRootView()->Contains( 447 GetWidget()->GetRootView()->Contains(
428 GetFocusManager()->GetFocusedView()); 448 GetFocusManager()->GetFocusedView());
429 } 449 }
430 450
431 } // namespace views 451 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/image_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698