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

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: Merge with master 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
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 327
328 //////////////////////////////////////////////////////////////////////////////// 328 ////////////////////////////////////////////////////////////////////////////////
329 // CustomButton, gfx::AnimationDelegate implementation: 329 // CustomButton, gfx::AnimationDelegate implementation:
330 330
331 void CustomButton::AnimationProgressed(const gfx::Animation* animation) { 331 void CustomButton::AnimationProgressed(const gfx::Animation* animation) {
332 SchedulePaint(); 332 SchedulePaint();
333 } 333 }
334 334
335 //////////////////////////////////////////////////////////////////////////////// 335 ////////////////////////////////////////////////////////////////////////////////
336 // CustomButton, views::InkDropHost implementation:
337
338 void CustomButton::AddInkDropLayer(ui::Layer* ink_drop_layer) {
339 SetPaintToLayer(true);
340 SetFillsBoundsOpaquely(false);
341 layer()->Add(ink_drop_layer);
342 layer()->StackAtBottom(ink_drop_layer);
343 }
344
345 void CustomButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
346 layer()->Remove(ink_drop_layer);
347 SetFillsBoundsOpaquely(true);
348 SetPaintToLayer(false);
349 }
350
351 gfx::Point CustomButton::CalculateInkDropCenter() const {
352 return GetLocalBounds().CenterPoint();
353 }
354
355 ////////////////////////////////////////////////////////////////////////////////
336 // CustomButton, protected: 356 // CustomButton, protected:
337 357
338 CustomButton::CustomButton(ButtonListener* listener) 358 CustomButton::CustomButton(ButtonListener* listener)
339 : Button(listener), 359 : Button(listener),
340 state_(STATE_NORMAL), 360 state_(STATE_NORMAL),
341 hover_animation_(this), 361 hover_animation_(this),
342 animate_on_state_change_(true), 362 animate_on_state_change_(true),
343 is_throbbing_(false), 363 is_throbbing_(false),
344 triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON), 364 triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON),
345 request_focus_on_press_(true), 365 request_focus_on_press_(true),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); 444 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
425 } 445 }
426 446
427 bool CustomButton::FocusInChildWidget() const { 447 bool CustomButton::FocusInChildWidget() const {
428 return GetWidget() && 448 return GetWidget() &&
429 GetWidget()->GetRootView()->Contains( 449 GetWidget()->GetRootView()->Contains(
430 GetFocusManager()->GetFocusedView()); 450 GetFocusManager()->GetFocusedView());
431 } 451 }
432 452
433 } // namespace views 453 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698