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

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

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 (delegate owned by a leaf c… 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 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
10 #include "ui/gfx/animation/animation_delegate.h" 10 #include "ui/gfx/animation/animation_delegate.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // holds the mouse down over the button. For this implementation, 119 // holds the mouse down over the button. For this implementation,
120 // we simply return IsTriggerableEvent(event). 120 // we simply return IsTriggerableEvent(event).
121 virtual bool ShouldEnterPushedState(const ui::Event& event); 121 virtual bool ShouldEnterPushedState(const ui::Event& event);
122 122
123 // Returns true if the button should enter hovered state; that is, if the 123 // Returns true if the button should enter hovered state; that is, if the
124 // mouse is over the button, and no other window has capture (which would 124 // mouse is over the button, and no other window has capture (which would
125 // prevent the button from receiving MouseExited events and updating its 125 // prevent the button from receiving MouseExited events and updating its
126 // state). This does not take into account enabled state. 126 // state). This does not take into account enabled state.
127 bool ShouldEnterHoveredState(); 127 bool ShouldEnterHoveredState();
128 128
129 void SetInkDropDelegate(scoped_ptr<InkDropDelegate> ink_drop_delegate); 129 InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; }
130 InkDropDelegate* ink_drop_delegate() const { 130 void set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) {
131 return ink_drop_delegate_.get(); 131 ink_drop_delegate_ = ink_drop_delegate;
132 } 132 }
133 133
134 // Overridden from View: 134 // Overridden from View:
135 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 135 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
136 void ViewHierarchyChanged( 136 void ViewHierarchyChanged(
137 const ViewHierarchyChangedDetails& details) override; 137 const ViewHierarchyChangedDetails& details) override;
138 void OnBlur() override; 138 void OnBlur() override;
139 139
140 // The button state (defined in implementation) 140 // The button state (defined in implementation)
141 ButtonState state_; 141 ButtonState state_;
(...skipping 12 matching lines...) Expand all
154 154
155 // Is the hover animation running because StartThrob was invoked? 155 // Is the hover animation running because StartThrob was invoked?
156 bool is_throbbing_; 156 bool is_throbbing_;
157 157
158 // Mouse event flags which can trigger button actions. 158 // Mouse event flags which can trigger button actions.
159 int triggerable_event_flags_; 159 int triggerable_event_flags_;
160 160
161 // See description above setter. 161 // See description above setter.
162 bool request_focus_on_press_; 162 bool request_focus_on_press_;
163 163
164 // Animation delegate for the ink drop ripple effect. 164 // Animation delegate for the ink drop ripple effect. It is owned by a
165 scoped_ptr<InkDropDelegate> ink_drop_delegate_; 165 // descendant class and needs to be reset before an instance of the concrete
166 // CustomButton is destroyed.
167 InkDropDelegate* ink_drop_delegate_;
166 168
167 // The event on which the button should notify its listener. 169 // The event on which the button should notify its listener.
168 NotifyAction notify_action_; 170 NotifyAction notify_action_;
169 171
170 DISALLOW_COPY_AND_ASSIGN(CustomButton); 172 DISALLOW_COPY_AND_ASSIGN(CustomButton);
171 }; 173 };
172 174
173 } // namespace views 175 } // namespace views
174 176
175 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 177 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_delegate_unittest.cc ('k') | ui/views/controls/button/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698