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

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

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 9 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
« no previous file with comments | « views/controls/button/custom_button.h ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/button/custom_button.h" 5 #include "views/controls/button/custom_button.h"
6 6
7 #include "ui/base/accessibility/accessible_view_state.h" 7 #include "ui/base/accessibility/accessible_view_state.h"
8 #include "ui/base/animation/throb_animation.h" 8 #include "ui/base/animation/throb_animation.h"
9 #include "ui/base/keycodes/keyboard_codes.h" 9 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "ui/gfx/screen.h" 10 #include "ui/gfx/screen.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 bool CustomButton::OnKeyReleased(const KeyEvent& event) { 191 bool CustomButton::OnKeyReleased(const KeyEvent& event) {
192 if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE)) 192 if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE))
193 return false; 193 return false;
194 194
195 SetState(BS_NORMAL); 195 SetState(BS_NORMAL);
196 NotifyClick(event); 196 NotifyClick(event);
197 return true; 197 return true;
198 } 198 }
199 199
200 bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) { 200 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) {
201 if (!View::IsEnabled()) 201 if (!View::IsEnabled())
202 return false; 202 return false;
203 203
204 SetState(BS_NORMAL); 204 SetState(BS_NORMAL);
205 KeyEvent key_event(ui::ET_KEY_RELEASED, accelerator.key_code(), 205 KeyEvent key_event(ui::ET_KEY_RELEASED, accelerator.key_code(),
206 accelerator.modifiers()); 206 accelerator.modifiers());
207 NotifyClick(key_event); 207 NotifyClick(key_event);
208 return true; 208 return true;
209 } 209 }
210 210
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 bool CustomButton::IsFocusable() const { 286 bool CustomButton::IsFocusable() const {
287 return (state_ != BS_DISABLED) && View::IsFocusable(); 287 return (state_ != BS_DISABLED) && View::IsFocusable();
288 } 288 }
289 289
290 void CustomButton::OnBlur() { 290 void CustomButton::OnBlur() {
291 if (IsHotTracked()) 291 if (IsHotTracked())
292 SetState(BS_NORMAL); 292 SetState(BS_NORMAL);
293 } 293 }
294 294
295 } // namespace views 295 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/button/custom_button.h ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698