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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 10825254: Remove views::KeyEvent, replacing uses of it with ui::KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.cc
===================================================================
--- ui/views/controls/button/custom_button.cc (revision 150588)
+++ ui/views/controls/button/custom_button.cc (working copy)
@@ -6,6 +6,7 @@
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/animation/throb_animation.h"
+#include "ui/base/event.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
@@ -166,7 +167,7 @@
SetState(HitTest(event.location()) ? BS_HOT : BS_NORMAL);
}
-bool CustomButton::OnKeyPressed(const KeyEvent& event) {
+bool CustomButton::OnKeyPressed(const ui::KeyEvent& event) {
if (state_ == BS_DISABLED)
return false;
@@ -177,19 +178,25 @@
SetState(BS_PUSHED);
} else if (event.key_code() == ui::VKEY_RETURN) {
SetState(BS_NORMAL);
- NotifyClick(event);
+ // TODO(beng): remove once NotifyClick takes ui::Event.
+ views::MouseEvent synthetic_event(
+ ui::ET_MOUSE_RELEASED, 0, 0, ui::EF_LEFT_MOUSE_BUTTON);
+ NotifyClick(synthetic_event);
} else {
return false;
}
return true;
}
-bool CustomButton::OnKeyReleased(const KeyEvent& event) {
+bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) {
if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE))
return false;
SetState(BS_NORMAL);
- NotifyClick(event);
+ // TODO(beng): remove once NotifyClick takes ui::Event.
+ views::MouseEvent synthetic_event(
+ ui::ET_MOUSE_RELEASED, 0, 0, ui::EF_LEFT_MOUSE_BUTTON);
+ NotifyClick(synthetic_event);
return true;
}
@@ -219,9 +226,14 @@
bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) {
SetState(BS_NORMAL);
- KeyEvent key_event(ui::ET_KEY_RELEASED, accelerator.key_code(),
- accelerator.modifiers());
- NotifyClick(key_event);
+ /*
+ ui::KeyEvent key_event(ui::ET_KEY_RELEASED, accelerator.key_code(),
+ accelerator.modifiers());
+ */
+ // TODO(beng): remove once NotifyClick takes ui::Event.
+ views::MouseEvent synthetic_event(
+ ui::ET_MOUSE_RELEASED, 0, 0, ui::EF_LEFT_MOUSE_BUTTON);
+ NotifyClick(synthetic_event);
return true;
}
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698