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

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: rebase 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
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | ui/shell_dialogs/select_file_dialog_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_util.cc
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc
index 14e156a5f83524ac35ff51c5e76a291594d43879..c5a491acec3b4eae905bc16bbe345c9ac9a479bc 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
@@ -42,7 +43,7 @@ bool IsKeyboardEnabled() {
}
-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;
@@ -66,8 +67,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;
@@ -84,17 +85,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;
}
@@ -103,7 +104,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;
@@ -122,16 +123,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) {
@@ -150,7 +151,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;
}
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | ui/shell_dialogs/select_file_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698