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

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

Issue 1437523005: Custom buttons should only handle accelerators when focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase & style Created 5 years, 1 month 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const ViewHierarchyChangedDetails& details) override; 128 const ViewHierarchyChangedDetails& details) override;
129 void OnBlur() override; 129 void OnBlur() override;
130 130
131 // The button state (defined in implementation) 131 // The button state (defined in implementation)
132 ButtonState state_; 132 ButtonState state_;
133 133
134 // Hover animation. 134 // Hover animation.
135 scoped_ptr<gfx::ThrobAnimation> hover_animation_; 135 scoped_ptr<gfx::ThrobAnimation> hover_animation_;
136 136
137 private: 137 private:
138 // Returns true if this is not a top level widget. Virtual for tests.
139 virtual bool IsChildWidget() const;
140 // Returns true if the focus is not in a top level widget. Virtual for tests.
141 virtual bool FocusInChildWidget() const;
142
138 // Should we animate when the state changes? Defaults to true. 143 // Should we animate when the state changes? Defaults to true.
139 bool animate_on_state_change_; 144 bool animate_on_state_change_;
140 145
141 // Is the hover animation running because StartThrob was invoked? 146 // Is the hover animation running because StartThrob was invoked?
142 bool is_throbbing_; 147 bool is_throbbing_;
143 148
144 // Mouse event flags which can trigger button actions. 149 // Mouse event flags which can trigger button actions.
145 int triggerable_event_flags_; 150 int triggerable_event_flags_;
146 151
147 // See description above setter. 152 // See description above setter.
148 bool request_focus_on_press_; 153 bool request_focus_on_press_;
149 154
150 // The event on which the button should notify its listener. 155 // The event on which the button should notify its listener.
151 NotifyAction notify_action_; 156 NotifyAction notify_action_;
152 157
153 DISALLOW_COPY_AND_ASSIGN(CustomButton); 158 DISALLOW_COPY_AND_ASSIGN(CustomButton);
154 }; 159 };
155 160
156 } // namespace views 161 } // namespace views
157 162
158 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 163 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/custom_button.cc » ('j') | ui/views/controls/button/custom_button.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698