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

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

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor ink drop animations (comments in c/b/ui/views/) Created 5 years 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 if (state_ != STATE_DISABLED) 277 if (state_ != STATE_DISABLED)
278 SetState(STATE_NORMAL); 278 SetState(STATE_NORMAL);
279 View::ShowContextMenu(p, source_type); 279 View::ShowContextMenu(p, source_type);
280 } 280 }
281 281
282 void CustomButton::OnDragDone() { 282 void CustomButton::OnDragDone() {
283 // Only reset the state to normal if the button isn't currently disabled 283 // Only reset the state to normal if the button isn't currently disabled
284 // (since disabled buttons may still be able to be dragged). 284 // (since disabled buttons may still be able to be dragged).
285 if (state_ != STATE_DISABLED) 285 if (state_ != STATE_DISABLED)
286 SetState(STATE_NORMAL); 286 SetState(STATE_NORMAL);
287 Button::OnDragDone();
287 } 288 }
288 289
289 void CustomButton::GetAccessibleState(ui::AXViewState* state) { 290 void CustomButton::GetAccessibleState(ui::AXViewState* state) {
290 Button::GetAccessibleState(state); 291 Button::GetAccessibleState(state);
291 switch (state_) { 292 switch (state_) {
292 case STATE_HOVERED: 293 case STATE_HOVERED:
293 state->AddStateFlag(ui::AX_STATE_HOVERED); 294 state->AddStateFlag(ui::AX_STATE_HOVERED);
294 break; 295 break;
295 case STATE_PRESSED: 296 case STATE_PRESSED:
296 state->AddStateFlag(ui::AX_STATE_PRESSED); 297 state->AddStateFlag(ui::AX_STATE_PRESSED);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); 390 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
390 } 391 }
391 392
392 bool CustomButton::FocusInChildWidget() const { 393 bool CustomButton::FocusInChildWidget() const {
393 return GetWidget() && 394 return GetWidget() &&
394 GetWidget()->GetRootView()->Contains( 395 GetWidget()->GetRootView()->Contains(
395 GetFocusManager()->GetFocusedView()); 396 GetFocusManager()->GetFocusedView());
396 } 397 }
397 398
398 } // namespace views 399 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698