Skip to content

Commit

Permalink
ime: removes unnecessary callbacks
Browse files Browse the repository at this point in the history
These callbacks were added to support mash. Now that mash is no more they
can be removed.

BUG=973079
TEST=covered by tests

Change-Id: I2cb41a7fc6180387643e13cf9dc8047544048da7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660800
Reviewed-by: Shu Chen <shuchen@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670376}
  • Loading branch information
Scott Violet authored and Commit Bot committed Jun 19, 2019
1 parent aee7fa7 commit a734203
Show file tree
Hide file tree
Showing 34 changed files with 105 additions and 520 deletions.
6 changes: 2 additions & 4 deletions ash/display/window_tree_host_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,7 @@ void WindowTreeHostManager::PostDisplayConfigurationChange() {
}

ui::EventDispatchDetails WindowTreeHostManager::DispatchKeyEventPostIME(
ui::KeyEvent* event,
DispatchKeyEventPostIMECallback callback) {
ui::KeyEvent* event) {
aura::Window* root_window = nullptr;
if (event->target()) {
root_window = static_cast<aura::Window*>(event->target())->GetRootWindow();
Expand All @@ -803,8 +802,7 @@ ui::EventDispatchDetails WindowTreeHostManager::DispatchKeyEventPostIME(
root_window = active_window ? active_window->GetRootWindow()
: Shell::GetPrimaryRootWindow();
}
return root_window->GetHost()->DispatchKeyEventPostIME(event,
std::move(callback));
return root_window->GetHost()->DispatchKeyEventPostIME(event);
}

AshWindowTreeHost* WindowTreeHostManager::AddWindowTreeHostForDisplay(
Expand Down
3 changes: 1 addition & 2 deletions ash/display/window_tree_host_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ class ASH_EXPORT WindowTreeHostManager

// ui::internal::InputMethodDelegate overrides:
ui::EventDispatchDetails DispatchKeyEventPostIME(
ui::KeyEvent* event,
DispatchKeyEventPostIMECallback callback) override;
ui::KeyEvent* event) override;

private:
FRIEND_TEST_ALL_PREFIXES(WindowTreeHostManagerTest, BoundsUpdated);
Expand Down
4 changes: 1 addition & 3 deletions ash/display/window_tree_host_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "ash/wm/cursor_manager_test_api.h"
#include "ash/wm/window_state.h"
#include "ash/wm/wm_event.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
Expand Down Expand Up @@ -1708,8 +1707,7 @@ TEST_F(WindowTreeHostManagerTest, KeyEventFromSecondaryDisplay) {
dispatcher_api.set_target(
Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId(
GetSecondaryDisplay().id()));
Shell::Get()->window_tree_host_manager()->DispatchKeyEventPostIME(
&key_event, base::NullCallback());
Shell::Get()->window_tree_host_manager()->DispatchKeyEventPostIME(&key_event);
// As long as nothing crashes, we're good.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
extensions::AppWindowRegistry::Get(profile())->app_windows();
ASSERT_FALSE(app_windows.empty());
app_windows.front()->GetNativeWindow()->GetHost()->DispatchKeyEventPostIME(
&key_event, base::NullCallback());
&key_event);
*output = "mediaKeyDispatched";
return;
}
Expand All @@ -2158,7 +2158,7 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
host = app_windows.front()->GetNativeWindow()->GetHost();
}
ASSERT_TRUE(host);
host->DispatchKeyEventPostIME(&key_event, base::NullCallback());
host->DispatchKeyEventPostIME(&key_event);
*output = "tabKeyDispatched";
return;
}
Expand Down
10 changes: 4 additions & 6 deletions extensions/shell/browser/shell_desktop_controller_aura.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,25 +229,23 @@ void ShellDesktopControllerAura::OnDisplayModeChanged(
#endif

ui::EventDispatchDetails ShellDesktopControllerAura::DispatchKeyEventPostIME(
ui::KeyEvent* key_event,
DispatchKeyEventPostIMECallback callback) {
ui::KeyEvent* key_event) {
if (key_event->target()) {
aura::WindowTreeHost* host = static_cast<aura::Window*>(key_event->target())
->GetRootWindow()
->GetHost();
return host->DispatchKeyEventPostIME(key_event, std::move(callback));
return host->DispatchKeyEventPostIME(key_event);
}

// Send the key event to the focused window.
aura::Window* active_window =
const_cast<aura::Window*>(focus_controller_->GetActiveWindow());
if (active_window) {
return active_window->GetRootWindow()->GetHost()->DispatchKeyEventPostIME(
key_event, std::move(callback));
key_event);
}

return GetPrimaryHost()->DispatchKeyEventPostIME(key_event,
std::move(callback));
return GetPrimaryHost()->DispatchKeyEventPostIME(key_event);
}

void ShellDesktopControllerAura::OnKeepAliveStateChanged(
Expand Down
3 changes: 1 addition & 2 deletions extensions/shell/browser/shell_desktop_controller_aura.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ class ShellDesktopControllerAura

// ui::internal::InputMethodDelegate:
ui::EventDispatchDetails DispatchKeyEventPostIME(
ui::KeyEvent* key_event,
DispatchKeyEventPostIMECallback callback) override;
ui::KeyEvent* key_event) override;

// KeepAliveStateObserver:
void OnKeepAliveStateChanged(bool is_keeping_alive) override;
Expand Down
4 changes: 1 addition & 3 deletions ui/aura/window_tree_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ void WindowTreeHost::SetSharedInputMethod(ui::InputMethod* input_method) {
}

ui::EventDispatchDetails WindowTreeHost::DispatchKeyEventPostIME(
ui::KeyEvent* event,
DispatchKeyEventPostIMECallback callback) {
ui::KeyEvent* event) {
// If dispatch to IME is already disabled we shouldn't reach here.
DCHECK(!dispatcher_->should_skip_ime());
dispatcher_->set_skip_ime(true);
Expand All @@ -269,7 +268,6 @@ ui::EventDispatchDetails WindowTreeHost::DispatchKeyEventPostIME(
event_sink()->OnEventFromSource(event);
if (!dispatch_details.dispatcher_destroyed)
dispatcher_->set_skip_ime(false);
RunDispatchKeyEventPostIMECallback(event, std::move(callback));
return dispatch_details;
}

Expand Down
4 changes: 1 addition & 3 deletions ui/aura/window_tree_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ class AURA_EXPORT WindowTreeHost : public ui::internal::InputMethodDelegate,
void SetSharedInputMethod(ui::InputMethod* input_method);

// Overridden from ui::internal::InputMethodDelegate:
ui::EventDispatchDetails DispatchKeyEventPostIME(
ui::KeyEvent* event,
DispatchKeyEventPostIMECallback callback) final;
ui::EventDispatchDetails DispatchKeyEventPostIME(ui::KeyEvent* event) final;

// Overridden from ui::EventSource:
ui::EventSink* GetEventSink() override;
Expand Down
1 change: 0 additions & 1 deletion ui/base/ime/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jumbo_component("ime") {
"input_method.h",
"input_method_base.cc",
"input_method_base.h",
"input_method_delegate.cc",
"input_method_delegate.h",
"input_method_keyboard_controller.h",
"input_method_keyboard_controller_observer.h",
Expand Down
Loading

0 comments on commit a734203

Please sign in to comment.