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

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

Issue 2396133005: [ash-md] Animates ToggleButton highlight to move it in sync with the thumb (Closed)
Patch Set: [ash-md] Animates ToggleButton highlight to move it in sync with the thumb (better destruction sequ… Created 4 years, 2 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"
11 #include "ui/gfx/animation/throb_animation.h" 11 #include "ui/gfx/animation/throb_animation.h"
12 #include "ui/gfx/color_palette.h" 12 #include "ui/gfx/color_palette.h"
13 #include "ui/native_theme/native_theme.h" 13 #include "ui/native_theme/native_theme.h"
14 #include "ui/views/animation/ink_drop_highlight.h" 14 #include "ui/views/animation/ink_drop_highlight.h"
15 #include "ui/views/controls/button/blue_button.h" 15 #include "ui/views/controls/button/blue_button.h"
16 #include "ui/views/controls/button/checkbox.h" 16 #include "ui/views/controls/button/checkbox.h"
17 #include "ui/views/controls/button/image_button.h" 17 #include "ui/views/controls/button/image_button.h"
18 #include "ui/views/controls/button/label_button.h" 18 #include "ui/views/controls/button/label_button.h"
19 #include "ui/views/controls/button/menu_button.h" 19 #include "ui/views/controls/button/menu_button.h"
20 #include "ui/views/controls/button/radio_button.h" 20 #include "ui/views/controls/button/radio_button.h"
21 #include "ui/views/controls/button/toggle_button.h"
21 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
22 23
23 #if defined(USE_AURA) 24 #if defined(USE_AURA)
24 #include "ui/aura/client/capture_client.h" 25 #include "ui/aura/client/capture_client.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
26 #endif 27 #endif
27 28
28 namespace views { 29 namespace views {
29 30
30 namespace { 31 namespace {
(...skipping 16 matching lines...) Expand all
47 48
48 // static 49 // static
49 CustomButton* CustomButton::AsCustomButton(views::View* view) { 50 CustomButton* CustomButton::AsCustomButton(views::View* view) {
50 if (view) { 51 if (view) {
51 const char* classname = view->GetClassName(); 52 const char* classname = view->GetClassName();
52 if (!strcmp(classname, Checkbox::kViewClassName) || 53 if (!strcmp(classname, Checkbox::kViewClassName) ||
53 !strcmp(classname, CustomButton::kViewClassName) || 54 !strcmp(classname, CustomButton::kViewClassName) ||
54 !strcmp(classname, ImageButton::kViewClassName) || 55 !strcmp(classname, ImageButton::kViewClassName) ||
55 !strcmp(classname, LabelButton::kViewClassName) || 56 !strcmp(classname, LabelButton::kViewClassName) ||
56 !strcmp(classname, RadioButton::kViewClassName) || 57 !strcmp(classname, RadioButton::kViewClassName) ||
58 !strcmp(classname, ToggleButton::kViewClassName) ||
57 !strcmp(classname, MenuButton::kViewClassName)) { 59 !strcmp(classname, MenuButton::kViewClassName)) {
58 return static_cast<CustomButton*>(view); 60 return static_cast<CustomButton*>(view);
59 } 61 }
60 } 62 }
61 return NULL; 63 return NULL;
62 } 64 }
63 65
64 CustomButton::~CustomButton() {} 66 CustomButton::~CustomButton() {}
65 67
66 void CustomButton::SetState(ButtonState state) { 68 void CustomButton::SetState(ButtonState state) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 views::InkDropState::ACTION_PENDING || 473 views::InkDropState::ACTION_PENDING ||
472 ink_drop()->GetTargetInkDropState() == 474 ink_drop()->GetTargetInkDropState() ==
473 views::InkDropState::ALTERNATE_ACTION_PENDING) { 475 views::InkDropState::ALTERNATE_ACTION_PENDING) {
474 AnimateInkDrop(views::InkDropState::HIDDEN, 476 AnimateInkDrop(views::InkDropState::HIDDEN,
475 ui::LocatedEvent::FromIfValid(&event)); 477 ui::LocatedEvent::FromIfValid(&event));
476 } 478 }
477 Button::OnClickCanceled(event); 479 Button::OnClickCanceled(event);
478 } 480 }
479 481
480 } // namespace views 482 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698