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

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

Issue 1494433003: Fixes a crash when InkDropDelegate gets destroyed after its InkDropHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes a crash when InkDropDelegate gets destroyed after its InkDropHost (restore to PS3) 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 !strcmp(classname, LabelButton::kViewClassName) || 49 !strcmp(classname, LabelButton::kViewClassName) ||
50 !strcmp(classname, RadioButton::kViewClassName) || 50 !strcmp(classname, RadioButton::kViewClassName) ||
51 !strcmp(classname, MenuButton::kViewClassName)) { 51 !strcmp(classname, MenuButton::kViewClassName)) {
52 return static_cast<CustomButton*>(view); 52 return static_cast<CustomButton*>(view);
53 } 53 }
54 } 54 }
55 return NULL; 55 return NULL;
56 } 56 }
57 57
58 CustomButton::~CustomButton() { 58 CustomButton::~CustomButton() {
59 // InkDropDelegate needs to be destroyed by now since it may need to call
60 // methods on |this| via InkDropHost.
61 DCHECK(!ink_drop_delegate_);
59 } 62 }
60 63
61 void CustomButton::SetState(ButtonState state) { 64 void CustomButton::SetState(ButtonState state) {
62 if (state == state_) 65 if (state == state_)
63 return; 66 return;
64 67
65 if (animate_on_state_change_ && 68 if (animate_on_state_change_ &&
66 (!is_throbbing_ || !hover_animation_->is_animating())) { 69 (!is_throbbing_ || !hover_animation_->is_animating())) {
67 is_throbbing_ = false; 70 is_throbbing_ = false;
68 if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) { 71 if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); 413 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
411 } 414 }
412 415
413 bool CustomButton::FocusInChildWidget() const { 416 bool CustomButton::FocusInChildWidget() const {
414 return GetWidget() && 417 return GetWidget() &&
415 GetWidget()->GetRootView()->Contains( 418 GetWidget()->GetRootView()->Contains(
416 GetFocusManager()->GetFocusedView()); 419 GetFocusManager()->GetFocusedView());
417 } 420 }
418 421
419 } // namespace views 422 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698