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

Unified Diff: ui/keyboard/keyboard_util.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First cut for review/trybots Created 7 years, 2 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
Index: ui/keyboard/keyboard_util.cc
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc
index 8b0d817b990eb1645e14d2a51b7cba90dd6411a1..dfceb605f418a78632c1e5ce9c7163e21cc031c7 100644
--- a/ui/keyboard/keyboard_util.cc
+++ b/ui/keyboard/keyboard_util.cc
@@ -23,11 +23,12 @@ namespace {
const char kKeyDown[] ="keydown";
const char kKeyUp[] = "keyup";
-void SendProcessKeyEvent(ui::EventType type, aura::RootWindow* root_window) {
+void SendProcessKeyEvent(ui::EventType type,
+ aura::WindowEventDispatcher* dispatcher) {
ui::TranslatedKeyEvent event(type == ui::ET_KEY_PRESSED,
ui::VKEY_PROCESSKEY,
ui::EF_NONE);
- root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event);
+ dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&event);
}
} // namespace
@@ -39,7 +40,7 @@ bool IsKeyboardEnabled() {
switches::kEnableVirtualKeyboard);
}
-bool InsertText(const base::string16& text, aura::RootWindow* root_window) {
+bool InsertText(const base::string16& text, aura::Window* root_window) {
if (!root_window)
return false;
@@ -63,8 +64,8 @@ bool InsertText(const base::string16& text, aura::RootWindow* root_window) {
// ui::TextInputClient from that (see above in InsertText()).
bool MoveCursor(int swipe_direction,
int modifier_flags,
- aura::RootWindow* root_window) {
- if (!root_window)
+ aura::WindowEventDispatcher* dispatcher) {
+ if (!dispatcher)
return false;
ui::KeyboardCode codex = ui::VKEY_UNKNOWN;
ui::KeyboardCode codey = ui::VKEY_UNKNOWN;
@@ -81,17 +82,17 @@ bool MoveCursor(int swipe_direction,
// First deal with the x movement.
if (codex != ui::VKEY_UNKNOWN) {
ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codex, modifier_flags, 0);
- root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event);
+ dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event);
ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codex, modifier_flags, 0);
- root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event);
+ dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event);
}
// Then deal with the y movement.
if (codey != ui::VKEY_UNKNOWN) {
ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codey, modifier_flags, 0);
- root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event);
+ dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event);
ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codey, modifier_flags, 0);
- root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event);
+ dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event);
}
return true;
}
@@ -100,7 +101,7 @@ bool SendKeyEvent(const std::string type,
int key_value,
int key_code,
bool shift_modifier,
- aura::RootWindow* root_window) {
+ aura::WindowEventDispatcher* dispatcher) {
ui::EventType event_type = ui::ET_UNKNOWN;
if (type == kKeyDown)
event_type = ui::ET_KEY_PRESSED;
@@ -119,16 +120,16 @@ bool SendKeyEvent(const std::string type,
// Handling of special printable characters (e.g. accented characters) for
// which there is no key code.
if (event_type == ui::ET_KEY_RELEASED) {
- ui::InputMethod* input_method = root_window->GetProperty(
+ ui::InputMethod* input_method = dispatcher->GetProperty(
aura::client::kRootWindowInputMethodKey);
if (!input_method)
return false;
ui::TextInputClient* tic = input_method->GetTextInputClient();
- SendProcessKeyEvent(ui::ET_KEY_PRESSED, root_window);
+ SendProcessKeyEvent(ui::ET_KEY_PRESSED, dispatcher);
tic->InsertChar(static_cast<uint16>(key_value), ui::EF_NONE);
- SendProcessKeyEvent(ui::ET_KEY_RELEASED, root_window);
+ SendProcessKeyEvent(ui::ET_KEY_RELEASED, dispatcher);
}
} else {
if (event_type == ui::ET_KEY_RELEASED) {
@@ -147,7 +148,7 @@ bool SendKeyEvent(const std::string type,
}
ui::KeyEvent event(event_type, code, flags, false);
- root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event);
+ dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&event);
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698