summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorshuchen <shuchen@chromium.org>2015-08-04 02:47:50 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-04 09:49:11 +0000
commit59c2a2cf79038dd2bcae5c45300a6a50de4ac9fd (patch)
tree49ac97bc93ab3c4419c93c7a0dfa8d1ae31440f9 /ash
parentd34042912daf7277cf5f0c6d890be6b0ca54f8cd (diff)
downloadchromium_src-59c2a2cf79038dd2bcae5c45300a6a50de4ac9fd.zip
chromium_src-59c2a2cf79038dd2bcae5c45300a6a50de4ac9fd.tar.gz
chromium_src-59c2a2cf79038dd2bcae5c45300a6a50de4ac9fd.tar.bz2
Refactoring for the InputMethod & InputMethodDelegate interfaces.
1) DispatchKeyEvent returns void type instead of bool, as it is not used. 2) DispatchKeyEventPostIME returns EventDispatchDetails, so that the caller (InputMethod) can know whether its being destroyed after the call of DispatchKeyEventPostIME. 3) Both DispatchKeyEvent & DispatchKeyEventPostIME takes ui::KeyEvent* as the parameter, so that the stopped_propagation() state can be carried over. Note: this cl doesn't try to change any existing behaviors/logics, except one thing: The cl https://codereview.chromium.org/1236923003 may introduce a potential regression which this cl tries to fix: DesktopWindowTreeHostWin::DispatchKeyEventPostIME() always call event->StopPropagation(). However, HWNDMessageHandler::OnKeyEvent() relies on the event.handled() state to correctly call SetMsgHandled(FALSE). This cl remove the StopPropagation() call in DesktopWindowTreeHostWin::DispatchKeyEventPostIME() and let InputMethodWin/RemoteInputMethodWin call it as appropriate. TBR=sky@chromium.org BUG=513917,474828 TEST=Trybots green. Review URL: https://codereview.chromium.org/1257603006 Cr-Commit-Position: refs/heads/master@{#341704}
Diffstat (limited to 'ash')
-rw-r--r--ash/display/window_tree_host_manager.cc3
-rw-r--r--ash/display/window_tree_host_manager.h3
-rw-r--r--ash/host/ash_remote_window_tree_host_win.cc14
-rw-r--r--ash/host/ash_remote_window_tree_host_win.h3
-rw-r--r--ash/host/ash_window_tree_host_ozone.cc17
-rw-r--r--ash/host/ash_window_tree_host_unified.cc14
-rw-r--r--ash/host/ash_window_tree_host_unified.h3
-rw-r--r--ash/host/ash_window_tree_host_win.cc13
-rw-r--r--ash/host/ash_window_tree_host_x11.cc13
-rw-r--r--ash/host/ash_window_tree_host_x11.h3
-rw-r--r--ash/ime/input_method_event_handler.cc2
11 files changed, 43 insertions, 45 deletions
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc
index 77bec60..af7d17c 100644
--- a/ash/display/window_tree_host_manager.cc
+++ b/ash/display/window_tree_host_manager.cc
@@ -862,7 +862,8 @@ void WindowTreeHostManager::PostDisplayConfigurationChange() {
UpdateMouseLocationAfterDisplayChange();
}
-bool WindowTreeHostManager::DispatchKeyEventPostIME(const ui::KeyEvent& event) {
+ui::EventDispatchDetails WindowTreeHostManager::DispatchKeyEventPostIME(
+ ui::KeyEvent* event) {
// Getting the active root window to dispatch the event. This isn't
// significant as the event will be sent to the window resolved by
// aura::client::FocusClient which is FocusController in ash.
diff --git a/ash/display/window_tree_host_manager.h b/ash/display/window_tree_host_manager.h
index 9829b28..5d27699 100644
--- a/ash/display/window_tree_host_manager.h
+++ b/ash/display/window_tree_host_manager.h
@@ -174,7 +174,8 @@ class ASH_EXPORT WindowTreeHostManager
void PostDisplayConfigurationChange() override;
// ui::internal::InputMethodDelegate overrides:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override;
+ ui::EventDispatchDetails DispatchKeyEventPostIME(
+ ui::KeyEvent* event) override;
InputMethodEventHandler* input_method_event_handler() {
return input_method_event_handler_.get();
diff --git a/ash/host/ash_remote_window_tree_host_win.cc b/ash/host/ash_remote_window_tree_host_win.cc
index b51f1a6..f3191b5 100644
--- a/ash/host/ash_remote_window_tree_host_win.cc
+++ b/ash/host/ash_remote_window_tree_host_win.cc
@@ -58,16 +58,14 @@ void AshRemoteWindowTreeHostWin::UpdateRootWindowSize(
transformer_helper_.UpdateWindowSize(host_size);
}
-bool AshRemoteWindowTreeHostWin::DispatchKeyEventPostIME(
- const ui::KeyEvent& event) {
- ui::KeyEvent event_copy(event);
+ui::EventDispatchDetails AshRemoteWindowTreeHostWin::DispatchKeyEventPostIME(
+ ui::KeyEvent* event) {
input_method_handler()->SetPostIME(true);
ui::EventDispatchDetails details =
- event_processor()->OnEventFromSource(&event_copy);
- if (details.dispatcher_destroyed)
- return true;
- input_method_handler()->SetPostIME(false);
- return event_copy.stopped_propagation();
+ event_processor()->OnEventFromSource(event);
+ if (!details.dispatcher_destroyed)
+ input_method_handler()->SetPostIME(false);
+ return details;
}
} // namespace ash
diff --git a/ash/host/ash_remote_window_tree_host_win.h b/ash/host/ash_remote_window_tree_host_win.h
index 97950c4..77ff3c3 100644
--- a/ash/host/ash_remote_window_tree_host_win.h
+++ b/ash/host/ash_remote_window_tree_host_win.h
@@ -39,7 +39,8 @@ class ASH_EXPORT AshRemoteWindowTreeHostWin
void UpdateRootWindowSize(const gfx::Size& host_size) override;
// ui::internal::InputMethodDelegate:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override;
+ ui::EventDispatchDetails DispatchKeyEventPostIME(
+ ui::KeyEvent* event) override;
TransformerHelper transformer_helper_;
diff --git a/ash/host/ash_window_tree_host_ozone.cc b/ash/host/ash_window_tree_host_ozone.cc
index e04e75b..85b3fae 100644
--- a/ash/host/ash_window_tree_host_ozone.cc
+++ b/ash/host/ash_window_tree_host_ozone.cc
@@ -49,7 +49,8 @@ class AshWindowTreeHostOzone : public AshWindowTreeHost,
void DispatchEvent(ui::Event* event) override;
// ui::internal::InputMethodDelegate:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override;
+ ui::EventDispatchDetails DispatchKeyEventPostIME(
+ ui::KeyEvent* event) override;
// Temporarily disable the tap-to-click feature. Used on CrOS.
void SetTapToClickPaused(bool state);
@@ -137,16 +138,14 @@ void AshWindowTreeHostOzone::DispatchEvent(ui::Event* event) {
SendEventToProcessor(event);
}
-bool AshWindowTreeHostOzone::DispatchKeyEventPostIME(
- const ui::KeyEvent& event) {
- ui::KeyEvent event_copy(event);
+ui::EventDispatchDetails AshWindowTreeHostOzone::DispatchKeyEventPostIME(
+ ui::KeyEvent* event) {
input_method_handler()->SetPostIME(true);
ui::EventDispatchDetails details =
- event_processor()->OnEventFromSource(&event_copy);
- if (details.dispatcher_destroyed)
- return true;
- input_method_handler()->SetPostIME(false);
- return event_copy.stopped_propagation();
+ event_processor()->OnEventFromSource(event);
+ if (!details.dispatcher_destroyed)
+ input_method_handler()->SetPostIME(false);
+ return details;
}
void AshWindowTreeHostOzone::SetTapToClickPaused(bool state) {
diff --git a/ash/host/ash_window_tree_host_unified.cc b/ash/host/ash_window_tree_host_unified.cc
index 7e78691..2759af6 100644
--- a/ash/host/ash_window_tree_host_unified.cc
+++ b/ash/host/ash_window_tree_host_unified.cc
@@ -177,16 +177,14 @@ void AshWindowTreeHostUnified::OnWindowDestroying(aura::Window* window) {
mirroring_hosts_.erase(iter);
}
-bool AshWindowTreeHostUnified::DispatchKeyEventPostIME(
- const ui::KeyEvent& event) {
- ui::KeyEvent event_copy(event);
+ui::EventDispatchDetails AshWindowTreeHostUnified::DispatchKeyEventPostIME(
+ ui::KeyEvent* event) {
input_method_handler()->SetPostIME(true);
ui::EventDispatchDetails details =
- event_processor()->OnEventFromSource(&event_copy);
- if (details.dispatcher_destroyed)
- return true;
- input_method_handler()->SetPostIME(false);
- return event_copy.stopped_propagation();
+ event_processor()->OnEventFromSource(event);
+ if (!details.dispatcher_destroyed)
+ input_method_handler()->SetPostIME(false);
+ return details;
}
} // namespace ash
diff --git a/ash/host/ash_window_tree_host_unified.h b/ash/host/ash_window_tree_host_unified.h
index e6dac3c..32557c9 100644
--- a/ash/host/ash_window_tree_host_unified.h
+++ b/ash/host/ash_window_tree_host_unified.h
@@ -65,7 +65,8 @@ class AshWindowTreeHostUnified : public AshWindowTreeHost,
void OnWindowDestroying(aura::Window* window) override;
// ui::internal::InputMethodDelegate:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override;
+ ui::EventDispatchDetails DispatchKeyEventPostIME(
+ ui::KeyEvent* event) override;
std::vector<AshWindowTreeHost*> mirroring_hosts_;
diff --git a/ash/host/ash_window_tree_host_win.cc b/ash/host/ash_window_tree_host_win.cc
index 9419fa4..e69769c 100644
--- a/ash/host/ash_window_tree_host_win.cc
+++ b/ash/host/ash_window_tree_host_win.cc
@@ -104,15 +104,14 @@ class AshWindowTreeHostWin : public AshWindowTreeHost,
}
// ui::internal::InputMethodDelegate:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override {
- ui::KeyEvent event_copy(event);
+ ui::EventDispatchDetails DispatchKeyEventPostIME(
+ ui::KeyEvent* event) override {
input_method_handler()->SetPostIME(true);
ui::EventDispatchDetails details =
- event_processor()->OnEventFromSource(&event_copy);
- if (details.dispatcher_destroyed)
- return true;
- input_method_handler()->SetPostIME(false);
- return event_copy.stopped_propagation();
+ event_processor()->OnEventFromSource(event);
+ if (!details.dispatcher_destroyed)
+ input_method_handler()->SetPostIME(false);
+ return details;
}
bool fullscreen_;
diff --git a/ash/host/ash_window_tree_host_x11.cc b/ash/host/ash_window_tree_host_x11.cc
index 1999052..a6971b5 100644
--- a/ash/host/ash_window_tree_host_x11.cc
+++ b/ash/host/ash_window_tree_host_x11.cc
@@ -236,15 +236,14 @@ void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent(
SendEventToProcessor(event);
}
-bool AshWindowTreeHostX11::DispatchKeyEventPostIME(const ui::KeyEvent& event) {
- ui::KeyEvent event_copy(event);
+ui::EventDispatchDetails AshWindowTreeHostX11::DispatchKeyEventPostIME(
+ ui::KeyEvent* event) {
input_method_handler()->SetPostIME(true);
ui::EventDispatchDetails details =
- event_processor()->OnEventFromSource(&event_copy);
- if (details.dispatcher_destroyed)
- return true;
- input_method_handler()->SetPostIME(false);
- return event_copy.stopped_propagation();
+ event_processor()->OnEventFromSource(event);
+ if (!details.dispatcher_destroyed)
+ input_method_handler()->SetPostIME(false);
+ return details;
}
#if defined(OS_CHROMEOS)
diff --git a/ash/host/ash_window_tree_host_x11.h b/ash/host/ash_window_tree_host_x11.h
index bfe8bcc..f0e30d3 100644
--- a/ash/host/ash_window_tree_host_x11.h
+++ b/ash/host/ash_window_tree_host_x11.h
@@ -52,7 +52,8 @@ class ASH_EXPORT AshWindowTreeHostX11 : public AshWindowTreeHost,
void OnHostInitialized(aura::WindowTreeHost* host) override;
// ui::internal::InputMethodDelegate:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override;
+ ui::EventDispatchDetails DispatchKeyEventPostIME(
+ ui::KeyEvent* event) override;
#if defined(OS_CHROMEOS)
// Set the CrOS touchpad "tap paused" property. It is used to temporarily
diff --git a/ash/ime/input_method_event_handler.cc b/ash/ime/input_method_event_handler.cc
index 8d3c0a8..da7d2fd 100644
--- a/ash/ime/input_method_event_handler.cc
+++ b/ash/ime/input_method_event_handler.cc
@@ -32,7 +32,7 @@ void InputMethodEventHandler::OnKeyEvent(ui::KeyEvent* event) {
return;
if (post_ime_)
return;
- input_method_->DispatchKeyEvent(*event);
+ input_method_->DispatchKeyEvent(event);
event->StopPropagation();
}