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

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

Issue 2389453002: Remove IsModeMaterial checks in ui/views/ (Closed)
Patch Set: oops 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/base/material_design/material_design_controller.h"
9 #include "ui/events/event.h" 8 #include "ui/events/event.h"
10 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
11 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
12 #include "ui/gfx/animation/throb_animation.h" 11 #include "ui/gfx/animation/throb_animation.h"
13 #include "ui/gfx/color_palette.h" 12 #include "ui/gfx/color_palette.h"
14 #include "ui/native_theme/native_theme.h" 13 #include "ui/native_theme/native_theme.h"
15 #include "ui/views/animation/ink_drop_highlight.h" 14 #include "ui/views/animation/ink_drop_highlight.h"
16 #include "ui/views/controls/button/blue_button.h" 15 #include "ui/views/controls/button/blue_button.h"
17 #include "ui/views/controls/button/checkbox.h" 16 #include "ui/views/controls/button/checkbox.h"
18 #include "ui/views/controls/button/image_button.h" 17 #include "ui/views/controls/button/image_button.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return; 195 return;
197 } 196 }
198 } 197 }
199 } 198 }
200 if (notify_action_ == NOTIFY_ON_RELEASE) 199 if (notify_action_ == NOTIFY_ON_RELEASE)
201 OnClickCanceled(event); 200 OnClickCanceled(event);
202 } 201 }
203 202
204 void CustomButton::OnMouseCaptureLost() { 203 void CustomButton::OnMouseCaptureLost() {
205 // Starting a drag results in a MouseCaptureLost. Reset button state. 204 // Starting a drag results in a MouseCaptureLost. Reset button state.
206 // TODO(varkha) While in drag only reset the state with Material Design. 205 // TODO(varkha): Reset the state even while in drag. The same logic may
207 // The same logic may applies everywhere so gather any feedback and update. 206 // applies everywhere so gather any feedback and update.
208 bool reset_button_state = 207 if (state_ != STATE_DISABLED)
209 !InDrag() || ui::MaterialDesignController::IsModeMaterial();
210 if (state_ != STATE_DISABLED && reset_button_state)
211 SetState(STATE_NORMAL); 208 SetState(STATE_NORMAL);
212 AnimateInkDrop(views::InkDropState::HIDDEN, nullptr /* event */); 209 AnimateInkDrop(views::InkDropState::HIDDEN, nullptr /* event */);
213 } 210 }
214 211
215 void CustomButton::OnMouseEntered(const ui::MouseEvent& event) { 212 void CustomButton::OnMouseEntered(const ui::MouseEvent& event) {
216 if (state_ != STATE_DISABLED) 213 if (state_ != STATE_DISABLED)
217 SetState(STATE_HOVERED); 214 SetState(STATE_HOVERED);
218 } 215 }
219 216
220 void CustomButton::OnMouseExited(const ui::MouseEvent& event) { 217 void CustomButton::OnMouseExited(const ui::MouseEvent& event) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 views::InkDropState::ACTION_PENDING || 471 views::InkDropState::ACTION_PENDING ||
475 ink_drop()->GetTargetInkDropState() == 472 ink_drop()->GetTargetInkDropState() ==
476 views::InkDropState::ALTERNATE_ACTION_PENDING) { 473 views::InkDropState::ALTERNATE_ACTION_PENDING) {
477 AnimateInkDrop(views::InkDropState::HIDDEN, 474 AnimateInkDrop(views::InkDropState::HIDDEN,
478 ui::LocatedEvent::FromIfValid(&event)); 475 ui::LocatedEvent::FromIfValid(&event));
479 } 476 }
480 Button::OnClickCanceled(event); 477 Button::OnClickCanceled(event);
481 } 478 }
482 479
483 } // namespace views 480 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698