diff options
28 files changed, 3 insertions, 962 deletions
diff --git a/ash/accelerators/nested_accelerator_delegate.cc b/ash/accelerators/nested_accelerator_delegate.cc deleted file mode 100644 index 2fc3438..0000000 --- a/ash/accelerators/nested_accelerator_delegate.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/accelerators/nested_accelerator_delegate.h" - -#include "ash/accelerators/accelerator_controller.h" -#include "ash/shell.h" -#include "ui/aura/window_event_dispatcher.h" -#include "ui/base/accelerators/accelerator.h" -#include "ui/events/event.h" -#include "ui/events/event_constants.h" -#include "ui/events/event_utils.h" -#include "ui/views/controls/menu/menu_controller.h" - -namespace ash { -namespace { - -bool IsPossibleAcceleratorNotForMenu(const ui::Accelerator& accelerator) { - // For shortcuts generated by Ctrl or Alt plus a letter, number or - // the tab key, we want to exit the context menu first and then - // repost the event. That allows for the shortcut execution after - // the context menu has exited. - if (accelerator.type() == ui::ET_KEY_PRESSED && - (accelerator.modifiers() & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN))) { - const ui::KeyboardCode key_code = accelerator.key_code(); - if ((key_code >= ui::VKEY_A && key_code <= ui::VKEY_Z) || - (key_code >= ui::VKEY_0 && key_code <= ui::VKEY_9) || - (key_code == ui::VKEY_TAB)) { - return true; - } - } - return false; -} - -bool ShouldProcessAcceleratorNow(const ui::Accelerator& accelerator) { - if (!IsPossibleAcceleratorNotForMenu(accelerator)) - return true; - - if (views::MenuController* menu_controller = - views::MenuController::GetActiveInstance()) { - menu_controller->CancelAll(); - return false; - } - return true; -} - -} // namespace - -NestedAcceleratorDelegate::NestedAcceleratorDelegate() { -} - -NestedAcceleratorDelegate::~NestedAcceleratorDelegate() { -} - -NestedAcceleratorDelegate::Result NestedAcceleratorDelegate::ProcessAccelerator( - const ui::Accelerator& accelerator) { - if (!ShouldProcessAcceleratorNow(accelerator)) - return RESULT_PROCESS_LATER; - - ash::AcceleratorController* accelerator_controller = - ash::Shell::GetInstance()->accelerator_controller(); - if (!accelerator_controller) - return RESULT_NOT_PROCESSED; - return accelerator_controller->Process(accelerator) ? RESULT_PROCESSED - : RESULT_NOT_PROCESSED; -} - -} // namespace ash diff --git a/ash/accelerators/nested_accelerator_delegate.h b/ash/accelerators/nested_accelerator_delegate.h deleted file mode 100644 index 2e9b765..0000000 --- a/ash/accelerators/nested_accelerator_delegate.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_ACCELERATORS_NESTED_ACCELERATOR_DELEGATE_H_ -#define ASH_ACCELERATORS_NESTED_ACCELERATOR_DELEGATE_H_ - -#include "base/macros.h" -#include "ui/wm/core/nested_accelerator_delegate.h" - -namespace ash { - -class NestedAcceleratorDelegate : public wm::NestedAcceleratorDelegate { - public: - NestedAcceleratorDelegate(); - ~NestedAcceleratorDelegate() override; - - // wm::AcceleratorDispatcher::Delegate - Result ProcessAccelerator(const ui::Accelerator& accelerator) override; - - private: - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDelegate); -}; - -} // namespace - -#endif // ASH_ACCELERATORS_NESTED_ACCELERATOR_DELEGATE_H_ diff --git a/ash/ash.gyp b/ash/ash.gyp index 32c8b35..ecc162f 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -25,8 +25,6 @@ 'accelerators/key_hold_detector.h', 'accelerators/magnifier_key_scroller.cc', 'accelerators/magnifier_key_scroller.h', - 'accelerators/nested_accelerator_delegate.cc', - 'accelerators/nested_accelerator_delegate.h', 'accelerators/spoken_feedback_toggler.cc', 'accelerators/spoken_feedback_toggler.h', 'accessibility_delegate.h', diff --git a/ash/shell.cc b/ash/shell.cc index 5d4e0c2..53cff3d 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -11,7 +11,6 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_delegate.h" #include "ash/accelerators/focus_manager_factory.h" -#include "ash/accelerators/nested_accelerator_delegate.h" #include "ash/ash_switches.h" #include "ash/autoclick/autoclick_controller.h" #include "ash/desktop_background/desktop_background_controller.h" @@ -109,7 +108,6 @@ #include "ui/wm/core/accelerator_filter.h" #include "ui/wm/core/compound_event_filter.h" #include "ui/wm/core/focus_controller.h" -#include "ui/wm/core/nested_accelerator_controller.h" #include "ui/wm/core/shadow_controller.h" #include "ui/wm/core/visibility_controller.h" #include "ui/wm/core/window_modality_controller.h" @@ -784,7 +782,6 @@ Shell::~Shell() { partial_magnification_controller_.reset(); tooltip_controller_.reset(); event_client_.reset(); - nested_accelerator_controller_.reset(); toplevel_window_event_handler_.reset(); visibility_controller_.reset(); // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be @@ -922,8 +919,6 @@ void Shell::Init(const ShellInitParams& init_params) { cursor_manager_.SetDisplay(gfx::Screen::GetScreen()->GetPrimaryDisplay()); - nested_accelerator_controller_.reset( - new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); accelerator_controller_.reset(new AcceleratorController); maximize_mode_controller_.reset(new MaximizeModeController()); @@ -1131,11 +1126,6 @@ void Shell::InitRootWindow(aura::Window* root_window) { toplevel_window_event_handler_.get()); root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); - - if (nested_accelerator_controller_) { - aura::client::SetDispatcherClient(root_window, - nested_accelerator_controller_.get()); - } } bool Shell::CanWindowReceiveEvents(aura::Window* window) { diff --git a/ash/shell.h b/ash/shell.h index 978efbd..a8d4e75 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -69,7 +69,6 @@ class TooltipController; namespace wm { class AcceleratorFilter; class CompoundEventFilter; -class NestedAcceleratorController; class ShadowController; class VisibilityController; class WindowModalityController; @@ -641,7 +640,6 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, std::vector<WindowAndBoundsPair> to_restore_; scoped_ptr<UserMetricsRecorder> user_metrics_recorder_; - scoped_ptr< ::wm::NestedAcceleratorController> nested_accelerator_controller_; scoped_ptr<AcceleratorController> accelerator_controller_; scoped_ptr<ShellDelegate> delegate_; scoped_ptr<SystemTrayDelegate> system_tray_delegate_; diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc index 57db107..abc84ab 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc @@ -200,8 +200,7 @@ void ChromeShellDelegate::Observe(int type, // we should execute the startup code. // If there are browsers open in the desktop, we create a browser window // and open a new tab page, if session restore is not on. - BrowserList* desktop_list = BrowserList::GetInstance( - chrome::HOST_DESKTOP_TYPE_NATIVE); + BrowserList* desktop_list = BrowserList::GetInstance(); if (desktop_list->empty()) { // We pass a dummy command line here, because the browser is launched in // silent-mode by the metro viewer process, which causes the diff --git a/ui/aura/BUILD.gn b/ui/aura/BUILD.gn index 6276a46..f5a398a 100644 --- a/ui/aura/BUILD.gn +++ b/ui/aura/BUILD.gn @@ -15,8 +15,6 @@ component("aura") { "../wm/public/activation_delegate.h", "../wm/public/animation_host.cc", "../wm/public/animation_host.h", - "../wm/public/dispatcher_client.cc", - "../wm/public/dispatcher_client.h", "../wm/public/drag_drop_client.cc", "../wm/public/drag_drop_client.h", "../wm/public/drag_drop_delegate.cc", diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index 20aeced..a244cbb 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -37,8 +37,6 @@ '../wm/public/activation_delegate.h', '../wm/public/animation_host.cc', '../wm/public/animation_host.h', - '../wm/public/dispatcher_client.cc', - '../wm/public/dispatcher_client.h', '../wm/public/drag_drop_client.cc', '../wm/public/drag_drop_client.h', '../wm/public/drag_drop_delegate.cc', diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index e9074f0..ef14d10 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc @@ -24,10 +24,6 @@ #include "ui/views/controls/menu/submenu_view.h" #include "ui/views/test/views_test_base.h" -#if defined(OS_WIN) -#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" -#endif - #if defined(USE_AURA) #include "ui/aura/scoped_window_targeter.h" #include "ui/aura/window.h" @@ -436,14 +432,7 @@ class MenuControllerTest : public ViewsTestBase { new ui::test::EventGenerator(GetContext(), owner_->GetNativeWindow())); owner_->Show(); -#if defined(OS_WIN) - dispatcher_client_.reset(new DesktopDispatcherClient); - aura::client::SetDispatcherClient(owner_->GetNativeView()->GetRootWindow(), - dispatcher_client_.get()); -#endif - SetupMenuItem(); - SetupMenuController(); } @@ -467,10 +456,6 @@ class MenuControllerTest : public ViewsTestBase { menu_item_->SetController(menu_controller_); } -#if defined(OS_WIN) - scoped_ptr<aura::client::DispatcherClient> dispatcher_client_; -#endif - scoped_ptr<Widget> owner_; scoped_ptr<ui::test::EventGenerator> event_generator_; scoped_ptr<TestMenuItemViewShown> menu_item_; diff --git a/ui/views/controls/menu/menu_message_loop_aura.cc b/ui/views/controls/menu/menu_message_loop_aura.cc index 7c59f2c..09c8105 100644 --- a/ui/views/controls/menu/menu_message_loop_aura.cc +++ b/ui/views/controls/menu/menu_message_loop_aura.cc @@ -19,7 +19,6 @@ #include "ui/views/widget/widget.h" #include "ui/wm/public/activation_change_observer.h" #include "ui/wm/public/activation_client.h" -#include "ui/wm/public/dispatcher_client.h" #include "ui/wm/public/drag_drop_client.h" diff --git a/ui/views/views.gyp b/ui/views/views.gyp index 15acd12..5723d62 100644 --- a/ui/views/views.gyp +++ b/ui/views/views.gyp @@ -414,8 +414,6 @@ 'widget/desktop_aura/desktop_capture_client.cc', 'widget/desktop_aura/desktop_capture_client.h', 'widget/desktop_aura/desktop_cursor_loader_updater.h', - 'widget/desktop_aura/desktop_dispatcher_client.cc', - 'widget/desktop_aura/desktop_dispatcher_client.h', 'widget/desktop_aura/desktop_drop_target_win.cc', 'widget/desktop_aura/desktop_drop_target_win.h', 'widget/desktop_aura/desktop_event_client.cc', diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc deleted file mode 100644 index 409057d..0000000 --- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" - -#include "base/auto_reset.h" -#include "base/bind.h" -#include "base/run_loop.h" -#include "build/build_config.h" - -namespace views { - -DesktopDispatcherClient::DesktopDispatcherClient() { -} - -DesktopDispatcherClient::~DesktopDispatcherClient() { -} - -void DesktopDispatcherClient::PrepareNestedLoopClosures( - base::MessagePumpDispatcher* dispatcher, - base::Closure* run_closure, - base::Closure* quit_closure) { -#if defined(OS_WIN) - scoped_ptr<base::RunLoop> run_loop(new base::RunLoop(dispatcher)); -#else - scoped_ptr<base::RunLoop> run_loop(new base::RunLoop()); -#endif - *quit_closure = run_loop->QuitClosure(); - *run_closure = - base::Bind(&base::RunLoop::Run, base::Owned(run_loop.release())); -} - -} // namespace views diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h deleted file mode 100644 index 3d7f6f4..0000000 --- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_H_ -#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_H_ - -#include "base/callback.h" -#include "base/macros.h" -#include "ui/views/views_export.h" -#include "ui/wm/public/dispatcher_client.h" - -namespace views { - -// TODO(erg): I won't lie to you; I have no idea what this is or what it does. -class VIEWS_EXPORT DesktopDispatcherClient - : public aura::client::DispatcherClient { - public: - DesktopDispatcherClient(); - ~DesktopDispatcherClient() override; - - void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher, - base::Closure* run_closure, - base::Closure* quit_closure) override; - - private: - DISALLOW_COPY_AND_ASSIGN(DesktopDispatcherClient); -}; - -} // namespace views - -#endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_H_ diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index f2c2706..b4b488d 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc @@ -32,7 +32,6 @@ #include "ui/views/view_constants_aura.h" #include "ui/views/widget/desktop_aura/desktop_capture_client.h" #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" -#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" #include "ui/views/widget/desktop_aura/desktop_event_client.h" #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" @@ -341,11 +340,6 @@ void DesktopNativeWidgetAura::OnHostClosed() { void DesktopNativeWidgetAura::OnDesktopWindowTreeHostDestroyed( aura::WindowTreeHost* host) { - // |dispatcher_| is still valid, but DesktopWindowTreeHost is nearly - // destroyed. Do cleanup here of members DesktopWindowTreeHost may also use. - aura::client::SetDispatcherClient(host->window(), NULL); - dispatcher_client_.reset(); - // We explicitly do NOT clear the cursor client property. Since the cursor // manager is a singleton, it can outlive any window hierarchy, and it's // important that objects attached to this destroying window hierarchy have @@ -483,10 +477,6 @@ void DesktopNativeWidgetAura::InitNativeWidget( aura::client::SetActivationClient(host_->window(), focus_controller); host_->window()->AddPreTargetHandler(focus_controller); - dispatcher_client_.reset(new DesktopDispatcherClient); - aura::client::SetDispatcherClient(host_->window(), - dispatcher_client_.get()); - position_client_.reset(new DesktopScreenPositionClient(host_->window())); drag_drop_client_ = desktop_window_tree_host_->CreateDragDropClient( diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h index 2a756d9..f33fa72 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h @@ -42,7 +42,6 @@ namespace corewm { class TooltipController; } class DesktopCaptureClient; -class DesktopDispatcherClient; class DesktopEventClient; class DesktopNativeCursorManager; class DesktopWindowTreeHost; @@ -256,7 +255,6 @@ class VIEWS_EXPORT DesktopNativeWidgetAura internal::NativeWidgetDelegate* native_widget_delegate_; scoped_ptr<wm::FocusController> focus_client_; - scoped_ptr<DesktopDispatcherClient> dispatcher_client_; scoped_ptr<aura::client::ScreenPositionClient> position_client_; scoped_ptr<aura::client::DragDropClient> drag_drop_client_; scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc index 0e928a1..8c638ae 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/macros.h" +#include "base/run_loop.h" #include "build/build_config.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/cursor_client.h" @@ -23,7 +24,6 @@ #include "ui/views/test/widget_test.h" #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" -#include "ui/wm/public/dispatcher_client.h" #if defined(OS_WIN) #include "ui/views/win/hwnd_util.h" @@ -231,15 +231,10 @@ TEST_F(DesktopNativeWidgetAuraTest, WidgetCanBeDestroyedFromNestedLoop) { widget->Init(params); widget->Show(); - aura::Window* window = widget->GetNativeView(); - aura::Window* root = window->GetRootWindow(); - aura::client::DispatcherClient* client = - aura::client::GetDispatcherClient(root); - // Post a task that terminates the nested loop and destroyes the widget. This // task will be executed from the nested loop initiated with the call to // |RunWithDispatcher()| below. - aura::client::DispatcherRunLoop run_loop(client, NULL); + base::RunLoop run_loop; base::Closure quit_runloop = run_loop.QuitClosure(); message_loop()->PostTask(FROM_HERE, base::Bind(&QuitNestedLoopAndCloseWidget, diff --git a/ui/views_content_client/views_content_client_main_parts_chromeos.cc b/ui/views_content_client/views_content_client_main_parts_chromeos.cc index 79e0911..36d2442 100644 --- a/ui/views_content_client/views_content_client_main_parts_chromeos.cc +++ b/ui/views_content_client/views_content_client_main_parts_chromeos.cc @@ -10,29 +10,12 @@ #include "ui/gfx/screen.h" #include "ui/views_content_client/views_content_client.h" #include "ui/views_content_client/views_content_client_main_parts_aura.h" -#include "ui/wm/core/nested_accelerator_controller.h" -#include "ui/wm/core/nested_accelerator_delegate.h" #include "ui/wm/test/wm_test_helper.h" namespace ui { namespace { -// A dummy version of the delegate usually provided by the Ash Shell. -class NestedAcceleratorDelegate : public ::wm::NestedAcceleratorDelegate { - public: - NestedAcceleratorDelegate() {} - ~NestedAcceleratorDelegate() override {} - - // ::wm::NestedAcceleratorDelegate: - Result ProcessAccelerator(const ui::Accelerator& accelerator) override { - return RESULT_NOT_PROCESSED; - } - - private: - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDelegate); -}; - class ViewsContentClientMainPartsChromeOS : public ViewsContentClientMainPartsAura { public: @@ -49,7 +32,6 @@ class ViewsContentClientMainPartsChromeOS // Enable a minimal set of views::corewm to be initialized. scoped_ptr<gfx::Screen> test_screen_; scoped_ptr< ::wm::WMTestHelper> wm_test_helper_; - scoped_ptr< ::wm::NestedAcceleratorController> nested_accelerator_controller_; DISALLOW_COPY_AND_ASSIGN(ViewsContentClientMainPartsChromeOS); }; @@ -75,16 +57,9 @@ void ViewsContentClientMainPartsChromeOS::PreMainMessageLoopRun() { // Ensure Aura knows where to open new windows. aura::Window* root_window = wm_test_helper_->host()->window(); views_content_client()->task().Run(browser_context(), root_window); - - nested_accelerator_controller_.reset( - new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); - aura::client::SetDispatcherClient(root_window, - nested_accelerator_controller_.get()); } void ViewsContentClientMainPartsChromeOS::PostMainMessageLoopRun() { - aura::client::SetDispatcherClient(wm_test_helper_->host()->window(), NULL); - nested_accelerator_controller_.reset(); wm_test_helper_.reset(); test_screen_.reset(); diff --git a/ui/wm/BUILD.gn b/ui/wm/BUILD.gn index 858183e..22fb3c1 100644 --- a/ui/wm/BUILD.gn +++ b/ui/wm/BUILD.gn @@ -35,13 +35,6 @@ component("wm") { "core/masked_window_targeter.h", "core/native_cursor_manager.h", "core/native_cursor_manager_delegate.h", - "core/nested_accelerator_controller.cc", - "core/nested_accelerator_controller.h", - "core/nested_accelerator_delegate.h", - "core/nested_accelerator_dispatcher.cc", - "core/nested_accelerator_dispatcher.h", - "core/nested_accelerator_dispatcher_linux.cc", - "core/nested_accelerator_dispatcher_win.cc", "core/shadow.cc", "core/shadow.h", "core/shadow_controller.cc", @@ -93,16 +86,6 @@ component("wm") { if (use_x11) { configs += [ "//build/config/linux:x11" ] } - - if (is_android) { - sources -= [ - "core/nested_accelerator_controller.cc", - "core/nested_accelerator_controller.h", - "core/nested_accelerator_delegate.h", - "core/nested_accelerator_dispatcher.cc", - "core/nested_accelerator_dispatcher.h", - ] - } } static_library("test_support") { @@ -140,7 +123,6 @@ test("wm_unittests") { "core/cursor_manager_unittest.cc", "core/focus_controller_unittest.cc", "core/image_grid_unittest.cc", - "core/nested_accelerator_controller_unittest.cc", "core/shadow_controller_unittest.cc", "core/shadow_unittest.cc", "core/transient_window_manager_unittest.cc", diff --git a/ui/wm/core/nested_accelerator_controller.cc b/ui/wm/core/nested_accelerator_controller.cc deleted file mode 100644 index 42ace4e..0000000 --- a/ui/wm/core/nested_accelerator_controller.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/core/nested_accelerator_controller.h" - -#include <utility> - -#include "base/auto_reset.h" -#include "base/bind.h" -#include "base/run_loop.h" -#include "ui/wm/core/nested_accelerator_delegate.h" -#include "ui/wm/core/nested_accelerator_dispatcher.h" - -namespace wm { - -NestedAcceleratorController::NestedAcceleratorController( - NestedAcceleratorDelegate* delegate) - : dispatcher_delegate_(delegate) { - DCHECK(delegate); -} - -NestedAcceleratorController::~NestedAcceleratorController() { -} - -void NestedAcceleratorController::PrepareNestedLoopClosures( - base::MessagePumpDispatcher* nested_dispatcher, - base::Closure* run_closure, - base::Closure* quit_closure) { - scoped_ptr<NestedAcceleratorDispatcher> old_accelerator_dispatcher = - std::move(accelerator_dispatcher_); - accelerator_dispatcher_ = NestedAcceleratorDispatcher::Create( - dispatcher_delegate_.get(), nested_dispatcher); - - scoped_ptr<base::RunLoop> run_loop = accelerator_dispatcher_->CreateRunLoop(); - *quit_closure = - base::Bind(&NestedAcceleratorController::QuitNestedMessageLoop, - base::Unretained(this), - run_loop->QuitClosure()); - *run_closure = base::Bind(&NestedAcceleratorController::RunNestedMessageLoop, - base::Unretained(this), - base::Passed(&run_loop), - base::Passed(&old_accelerator_dispatcher)); -} - -void NestedAcceleratorController::RunNestedMessageLoop( - scoped_ptr<base::RunLoop> run_loop, - scoped_ptr<NestedAcceleratorDispatcher> old_accelerator_dispatcher) { - run_loop->Run(); - accelerator_dispatcher_ = std::move(old_accelerator_dispatcher); -} - -void NestedAcceleratorController::QuitNestedMessageLoop( - const base::Closure& quit_runloop) { - quit_runloop.Run(); - accelerator_dispatcher_.reset(); -} - -} // namespace wm diff --git a/ui/wm/core/nested_accelerator_controller.h b/ui/wm/core/nested_accelerator_controller.h deleted file mode 100644 index 27cb8de..0000000 --- a/ui/wm/core/nested_accelerator_controller.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ -#define UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ - -#include "base/callback.h" -#include "base/macros.h" -#include "base/message_loop/message_loop.h" -#include "ui/wm/public/dispatcher_client.h" -#include "ui/wm/wm_export.h" - -namespace wm { - -class NestedAcceleratorDelegate; -class NestedAcceleratorDispatcher; - -// Creates a dispatcher which wraps another dispatcher. -// The outer dispatcher runs first and performs ash specific handling. -// If it does not consume the event it forwards the event to the nested -// dispatcher. -class WM_EXPORT NestedAcceleratorController - : public aura::client::DispatcherClient { - public: - explicit NestedAcceleratorController(NestedAcceleratorDelegate* delegate); - ~NestedAcceleratorController() override; - - // aura::client::DispatcherClient: - void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher, - base::Closure* run_closure, - base::Closure* quit_closure) override; - - private: - void RunNestedMessageLoop(scoped_ptr<base::RunLoop> run_loop, - scoped_ptr<NestedAcceleratorDispatcher> dispatcher); - void QuitNestedMessageLoop(const base::Closure& quit_runloop); - - scoped_ptr<NestedAcceleratorDispatcher> accelerator_dispatcher_; - scoped_ptr<NestedAcceleratorDelegate> dispatcher_delegate_; - - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorController); -}; - -} // namespace wm - -#endif // UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ diff --git a/ui/wm/core/nested_accelerator_controller_unittest.cc b/ui/wm/core/nested_accelerator_controller_unittest.cc deleted file mode 100644 index 0266999..0000000 --- a/ui/wm/core/nested_accelerator_controller_unittest.cc +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/core/nested_accelerator_controller.h" - -#include <stdint.h> - -#include "base/bind.h" -#include "base/event_types.h" -#include "base/macros.h" -#include "base/message_loop/message_loop.h" -#include "build/build_config.h" -#include "ui/aura/test/aura_test_base.h" -#include "ui/aura/test/test_windows.h" -#include "ui/aura/window.h" -#include "ui/aura/window_event_dispatcher.h" -#include "ui/base/accelerators/accelerator.h" -#include "ui/base/accelerators/accelerator.h" -#include "ui/base/accelerators/accelerator_manager.h" -#include "ui/events/event_constants.h" -#include "ui/events/event_utils.h" -#include "ui/events/platform/platform_event_dispatcher.h" -#include "ui/events/platform/platform_event_source.h" -#include "ui/events/platform/scoped_event_dispatcher.h" -#include "ui/wm/core/nested_accelerator_delegate.h" -#include "ui/wm/public/dispatcher_client.h" - -#if defined(USE_X11) -#include <X11/Xlib.h> -#include "ui/aura/test/x11_event_sender.h" -#include "ui/events/test/events_test_utils_x11.h" -#endif // USE_X11 - -namespace wm { -namespace test { - -namespace { - -class MockDispatcher : public ui::PlatformEventDispatcher { - public: - MockDispatcher() : num_key_events_dispatched_(0) {} - - int num_key_events_dispatched() { return num_key_events_dispatched_; } - - private: - // ui::PlatformEventDispatcher: - bool CanDispatchEvent(const ui::PlatformEvent& event) override { - return true; - } - uint32_t DispatchEvent(const ui::PlatformEvent& event) override { - if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED) - num_key_events_dispatched_++; - return ui::POST_DISPATCH_NONE; - } - - int num_key_events_dispatched_; - - DISALLOW_COPY_AND_ASSIGN(MockDispatcher); -}; - -class TestTarget : public ui::AcceleratorTarget { - public: - TestTarget() : accelerator_pressed_count_(0) {} - ~TestTarget() override {} - - int accelerator_pressed_count() const { return accelerator_pressed_count_; } - - // Overridden from ui::AcceleratorTarget: - bool AcceleratorPressed(const ui::Accelerator& accelerator) override { - accelerator_pressed_count_++; - return true; - } - bool CanHandleAccelerators() const override { return true; } - - private: - int accelerator_pressed_count_; - - DISALLOW_COPY_AND_ASSIGN(TestTarget); -}; - -void DispatchKeyReleaseA(aura::Window* root_window) { -// Sending both keydown and keyup is necessary here because the accelerator -// manager only checks a keyup event following a keydown event. See -// ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details. -#if defined(OS_WIN) - aura::WindowTreeHost* host = root_window->GetHost(); - HWND hwnd = host->GetAcceleratedWidget(); - ::PostMessage(hwnd, WM_KEYDOWN, ui::VKEY_A, 0); - ::PostMessage(hwnd, WM_KEYUP, ui::VKEY_A, 0); -#elif defined(USE_X11) - ui::ScopedXI2Event native_event; - native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); - aura::WindowTreeHost* host = root_window->GetHost(); - aura::test::PostEventToWindowTreeHost(*native_event, host); - native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0); - aura::test::PostEventToWindowTreeHost(*native_event, host); -#endif - // Make sure the inner message-loop terminates after dispatching the events. - base::MessageLoop::current()->PostTask( - FROM_HERE, base::MessageLoop::current()->QuitWhenIdleClosure()); -} - -class MockNestedAcceleratorDelegate : public NestedAcceleratorDelegate { - public: - MockNestedAcceleratorDelegate() - : accelerator_manager_(new ui::AcceleratorManager) {} - ~MockNestedAcceleratorDelegate() override {} - - // NestedAcceleratorDelegate: - Result ProcessAccelerator(const ui::Accelerator& accelerator) override { - return accelerator_manager_->Process(accelerator) ? - RESULT_PROCESSED : RESULT_NOT_PROCESSED; - } - - void Register(const ui::Accelerator& accelerator, - ui::AcceleratorTarget* target) { - accelerator_manager_->Register( - accelerator, ui::AcceleratorManager::kNormalPriority, target); - } - - private: - scoped_ptr<ui::AcceleratorManager> accelerator_manager_; - - DISALLOW_COPY_AND_ASSIGN(MockNestedAcceleratorDelegate); -}; - -class NestedAcceleratorTest : public aura::test::AuraTestBase { - public: - NestedAcceleratorTest() {} - ~NestedAcceleratorTest() override {} - - void SetUp() override { - AuraTestBase::SetUp(); - delegate_ = new MockNestedAcceleratorDelegate(); - nested_accelerator_controller_.reset( - new NestedAcceleratorController(delegate_)); - aura::client::SetDispatcherClient(root_window(), - nested_accelerator_controller_.get()); - } - - void TearDown() override { - aura::client::SetDispatcherClient(root_window(), NULL); - AuraTestBase::TearDown(); - delegate_ = NULL; - nested_accelerator_controller_.reset(); - } - - MockNestedAcceleratorDelegate* delegate() { return delegate_; } - - private: - scoped_ptr<NestedAcceleratorController> nested_accelerator_controller_; - MockNestedAcceleratorDelegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorTest); -}; - -} // namespace - -// Aura window above lock screen in z order. -// http://crbug.com/396494 -TEST_F(NestedAcceleratorTest, DISABLED_AssociatedWindowAboveLockScreen) { - // TODO(oshima|sadrul): remove when Win implements PES. - if (!ui::PlatformEventSource::GetInstance()) - return; - MockDispatcher inner_dispatcher; - scoped_ptr<aura::Window> mock_lock_container( - CreateNormalWindow(0, root_window(), NULL)); - aura::test::CreateTestWindowWithId(1, mock_lock_container.get()); - - scoped_ptr<aura::Window> associated_window( - CreateNormalWindow(2, root_window(), NULL)); - EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(), - mock_lock_container.get())); - - DispatchKeyReleaseA(root_window()); - scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher = - ui::PlatformEventSource::GetInstance()->OverrideDispatcher( - &inner_dispatcher); - aura::client::DispatcherRunLoop run_loop( - aura::client::GetDispatcherClient(root_window()), NULL); - run_loop.Run(); - EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched()); -} - -// Test that the nested dispatcher handles accelerators. -// http://crbug.com/396494 -TEST_F(NestedAcceleratorTest, DISABLED_AcceleratorsHandled) { - // TODO(oshima|sadrul): remove when Win implements PES. - if (!ui::PlatformEventSource::GetInstance()) - return; - MockDispatcher inner_dispatcher; - ui::Accelerator accelerator(ui::VKEY_A, ui::EF_NONE); - accelerator.set_type(ui::ET_KEY_RELEASED); - TestTarget target; - delegate()->Register(accelerator, &target); - - DispatchKeyReleaseA(root_window()); - scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher = - ui::PlatformEventSource::GetInstance()->OverrideDispatcher( - &inner_dispatcher); - aura::client::DispatcherRunLoop run_loop( - aura::client::GetDispatcherClient(root_window()), NULL); - run_loop.Run(); - EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); - EXPECT_EQ(1, target.accelerator_pressed_count()); -} - -} // namespace test -} // namespace wm diff --git a/ui/wm/core/nested_accelerator_dispatcher.cc b/ui/wm/core/nested_accelerator_dispatcher.cc deleted file mode 100644 index d37c93c..0000000 --- a/ui/wm/core/nested_accelerator_dispatcher.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/core/nested_accelerator_dispatcher.h" - -#include "base/logging.h" -#include "ui/wm/core/nested_accelerator_delegate.h" - -namespace wm { - -NestedAcceleratorDispatcher::NestedAcceleratorDispatcher( - NestedAcceleratorDelegate* delegate) - : delegate_(delegate) { - DCHECK(delegate); -} - -NestedAcceleratorDispatcher::~NestedAcceleratorDispatcher() { -} - -} // namespace wm diff --git a/ui/wm/core/nested_accelerator_dispatcher.h b/ui/wm/core/nested_accelerator_dispatcher.h deleted file mode 100644 index df5dd08..0000000 --- a/ui/wm/core/nested_accelerator_dispatcher.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_WM_CORE_NESTED_ACCELERATOR_DISPATCHER_H_ -#define UI_WM_CORE_NESTED_ACCELERATOR_DISPATCHER_H_ - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "ui/wm/wm_export.h" - -namespace base { -class MessagePumpDispatcher; -class RunLoop; -} - -namespace ui { -class KeyEvent; -} - -namespace wm { - -class NestedAcceleratorDelegate; - -// Dispatcher for handling accelerators from menu. -// -// Wraps a nested dispatcher to which control is passed if no accelerator key -// has been pressed. If the nested dispatcher is NULL, then the control is -// passed back to the default dispatcher. -// TODO(pkotwicz): Add support for a |nested_dispatcher| which sends -// events to a system IME. -class WM_EXPORT NestedAcceleratorDispatcher { - public: - virtual ~NestedAcceleratorDispatcher(); - - static scoped_ptr<NestedAcceleratorDispatcher> Create( - NestedAcceleratorDelegate* dispatcher_delegate, - base::MessagePumpDispatcher* nested_dispatcher); - - // Creates a base::RunLoop object to run a nested message loop. - virtual scoped_ptr<base::RunLoop> CreateRunLoop() = 0; - - protected: - explicit NestedAcceleratorDispatcher(NestedAcceleratorDelegate* delegate); - - NestedAcceleratorDelegate* - delegate_; // Owned by NestedAcceleratorController. - - private: - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcher); -}; - -} // namespace wm - -#endif // UI_WM_CORE_NESTED_ACCELERATOR_DISPATCHER_H_ diff --git a/ui/wm/core/nested_accelerator_dispatcher_linux.cc b/ui/wm/core/nested_accelerator_dispatcher_linux.cc deleted file mode 100644 index d906004..0000000 --- a/ui/wm/core/nested_accelerator_dispatcher_linux.cc +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/core/nested_accelerator_dispatcher.h" - -#include <stdint.h> - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "base/run_loop.h" -#include "ui/base/accelerators/accelerator.h" -#include "ui/events/event.h" -#include "ui/events/platform/platform_event_dispatcher.h" -#include "ui/events/platform/platform_event_source.h" -#include "ui/events/platform/scoped_event_dispatcher.h" -#include "ui/wm/core/accelerator_filter.h" -#include "ui/wm/core/nested_accelerator_delegate.h" - -#if defined(USE_X11) -#include <X11/Xlib.h> -#endif - -namespace wm { - -namespace { - -#if defined(USE_OZONE) -bool IsKeyEvent(const base::NativeEvent& native_event) { - const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event); - return event->IsKeyEvent(); -} -#elif defined(USE_X11) -bool IsKeyEvent(const XEvent* xev) { - return xev->type == KeyPress || xev->type == KeyRelease; -} -#else -#error Unknown build platform: you should have either use_ozone or use_x11. -#endif - -scoped_ptr<ui::ScopedEventDispatcher> OverrideDispatcher( - ui::PlatformEventDispatcher* dispatcher) { - ui::PlatformEventSource* source = ui::PlatformEventSource::GetInstance(); - return source ? source->OverrideDispatcher(dispatcher) : nullptr; -} - -} // namespace - -class NestedAcceleratorDispatcherLinux : public NestedAcceleratorDispatcher, - public ui::PlatformEventDispatcher { - public: - explicit NestedAcceleratorDispatcherLinux(NestedAcceleratorDelegate* delegate) - : NestedAcceleratorDispatcher(delegate), - restore_dispatcher_(OverrideDispatcher(this)) {} - - ~NestedAcceleratorDispatcherLinux() override {} - - private: - // AcceleratorDispatcher: - scoped_ptr<base::RunLoop> CreateRunLoop() override { - return make_scoped_ptr(new base::RunLoop()); - } - - // ui::PlatformEventDispatcher: - bool CanDispatchEvent(const ui::PlatformEvent& event) override { - return true; - } - - uint32_t DispatchEvent(const ui::PlatformEvent& event) override { - if (IsKeyEvent(event)) { - ui::Accelerator accelerator((ui::KeyEvent(event))); - - switch (delegate_->ProcessAccelerator(accelerator)) { - case NestedAcceleratorDelegate::RESULT_PROCESS_LATER: -#if defined(USE_X11) - XPutBackEvent(event->xany.display, event); -#else - NOTIMPLEMENTED(); -#endif - return ui::POST_DISPATCH_NONE; - case NestedAcceleratorDelegate::RESULT_PROCESSED: - return ui::POST_DISPATCH_NONE; - case NestedAcceleratorDelegate::RESULT_NOT_PROCESSED: - break; - } - } - ui::PlatformEventDispatcher* prev = *restore_dispatcher_; - - uint32_t perform_default = ui::POST_DISPATCH_PERFORM_DEFAULT; - return prev ? prev->DispatchEvent(event) : perform_default; - } - - scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_; - - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherLinux); -}; - -scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( - NestedAcceleratorDelegate* delegate, - base::MessagePumpDispatcher* nested_dispatcher) { - return make_scoped_ptr(new NestedAcceleratorDispatcherLinux(delegate)); -} - -} // namespace wm diff --git a/ui/wm/core/nested_accelerator_dispatcher_win.cc b/ui/wm/core/nested_accelerator_dispatcher_win.cc deleted file mode 100644 index 1b59d68..0000000 --- a/ui/wm/core/nested_accelerator_dispatcher_win.cc +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/core/nested_accelerator_dispatcher.h" - -#include <stdint.h> - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_pump_dispatcher.h" -#include "base/run_loop.h" -#include "ui/base/accelerators/accelerator.h" -#include "ui/events/event.h" -#include "ui/wm/core/accelerator_filter.h" -#include "ui/wm/core/nested_accelerator_delegate.h" - -using base::MessagePumpDispatcher; - -namespace wm { - -namespace { - -bool IsKeyEvent(const MSG& msg) { - return msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN || - msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP; -} - -} // namespace - -class NestedAcceleratorDispatcherWin : public NestedAcceleratorDispatcher, - public MessagePumpDispatcher { - public: - NestedAcceleratorDispatcherWin(NestedAcceleratorDelegate* delegate, - MessagePumpDispatcher* nested) - : NestedAcceleratorDispatcher(delegate), nested_dispatcher_(nested) {} - ~NestedAcceleratorDispatcherWin() override {} - - private: - // NestedAcceleratorDispatcher: - scoped_ptr<base::RunLoop> CreateRunLoop() override { - return make_scoped_ptr(new base::RunLoop(this)); - } - - // MessagePumpDispatcher: - uint32_t Dispatch(const MSG& event) override { - if (IsKeyEvent(event)) { - ui::Accelerator accelerator((ui::KeyEvent(event))); - - switch (delegate_->ProcessAccelerator(accelerator)) { - case NestedAcceleratorDelegate::RESULT_PROCESS_LATER: - return POST_DISPATCH_QUIT_LOOP; - case NestedAcceleratorDelegate::RESULT_PROCESSED: - return POST_DISPATCH_NONE; - case NestedAcceleratorDelegate::RESULT_NOT_PROCESSED: - break; - } - } - - return nested_dispatcher_ ? nested_dispatcher_->Dispatch(event) - : POST_DISPATCH_PERFORM_DEFAULT; - } - - MessagePumpDispatcher* nested_dispatcher_; - - DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherWin); -}; - -scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( - NestedAcceleratorDelegate* delegate, - MessagePumpDispatcher* nested_dispatcher) { - return make_scoped_ptr( - new NestedAcceleratorDispatcherWin(delegate, nested_dispatcher)); -} - -} // namespace wm diff --git a/ui/wm/public/dispatcher_client.cc b/ui/wm/public/dispatcher_client.cc deleted file mode 100644 index e3be7ca..0000000 --- a/ui/wm/public/dispatcher_client.cc +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/public/dispatcher_client.h" - -#include "base/callback.h" -#include "ui/aura/window.h" -#include "ui/aura/window_property.h" - -DECLARE_WINDOW_PROPERTY_TYPE(aura::client::DispatcherClient*); - -namespace aura { -namespace client { - -DispatcherRunLoop::DispatcherRunLoop(DispatcherClient* client, - base::MessagePumpDispatcher* dispatcher) { - client->PrepareNestedLoopClosures(dispatcher, &run_closure_, &quit_closure_); -} - -DispatcherRunLoop::~DispatcherRunLoop() { -} - -void DispatcherRunLoop::Run() { - base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); - base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); - run_closure_.Run(); -} - -base::Closure DispatcherRunLoop::QuitClosure() { - return quit_closure_; -} - -void DispatcherRunLoop::Quit() { - quit_closure_.Run(); -} - -DEFINE_LOCAL_WINDOW_PROPERTY_KEY(DispatcherClient*, kDispatcherClientKey, NULL); - -void SetDispatcherClient(Window* root_window, DispatcherClient* client) { - DCHECK_EQ(root_window->GetRootWindow(), root_window); - root_window->SetProperty(kDispatcherClientKey, client); -} - -DispatcherClient* GetDispatcherClient(Window* root_window) { - if (root_window) - DCHECK_EQ(root_window->GetRootWindow(), root_window); - return root_window ? root_window->GetProperty(kDispatcherClientKey) : NULL; -} - -} // namespace client -} // namespace aura diff --git a/ui/wm/public/dispatcher_client.h b/ui/wm/public/dispatcher_client.h deleted file mode 100644 index a301e92..0000000 --- a/ui/wm/public/dispatcher_client.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_WM_PUBLIC_DISPATCHER_CLIENT_H_ -#define UI_WM_PUBLIC_DISPATCHER_CLIENT_H_ - -#include "base/callback.h" -#include "base/macros.h" -#include "base/message_loop/message_pump_dispatcher.h" -#include "ui/aura/aura_export.h" - -namespace aura { -class Window; -namespace client { - -class DispatcherClient; - -// A base::RunLoop like object for running a nested message-loop with a -// specified DispatcherClient and a MessagePumpDispatcher. -class AURA_EXPORT DispatcherRunLoop { - public: - DispatcherRunLoop(DispatcherClient* client, - base::MessagePumpDispatcher* dispatcher); - ~DispatcherRunLoop(); - - void Run(); - base::Closure QuitClosure(); - void Quit(); - - private: - base::Closure run_closure_; - base::Closure quit_closure_; - - DISALLOW_COPY_AND_ASSIGN(DispatcherRunLoop); -}; - -// An interface implemented by an object which handles nested dispatchers. -class AURA_EXPORT DispatcherClient { - public: - virtual ~DispatcherClient() {} - - protected: - friend class DispatcherRunLoop; - - virtual void PrepareNestedLoopClosures( - base::MessagePumpDispatcher* dispatcher, - base::Closure* run_closure, - base::Closure* quit_closure) = 0; -}; - -AURA_EXPORT void SetDispatcherClient(Window* root_window, - DispatcherClient* client); -AURA_EXPORT DispatcherClient* GetDispatcherClient(Window* root_window); - -} // namespace client -} // namespace aura - -#endif // UI_WM_PUBLIC_DISPATCHER_CLIENT_H_ diff --git a/ui/wm/wm.gyp b/ui/wm/wm.gyp index 28a8cb2..685c976 100644 --- a/ui/wm/wm.gyp +++ b/ui/wm/wm.gyp @@ -60,13 +60,6 @@ 'core/masked_window_targeter.h', 'core/native_cursor_manager.h', 'core/native_cursor_manager_delegate.h', - 'core/nested_accelerator_controller.cc', - 'core/nested_accelerator_controller.h', - 'core/nested_accelerator_delegate.h', - 'core/nested_accelerator_dispatcher.cc', - 'core/nested_accelerator_dispatcher.h', - 'core/nested_accelerator_dispatcher_linux.cc', - 'core/nested_accelerator_dispatcher_win.cc', 'core/shadow.cc', 'core/shadow.h', 'core/shadow_controller.cc', @@ -100,15 +93,6 @@ '../../build/linux/system.gyp:x11', ], }], - ['OS=="android"', { - 'sources!': [ - 'core/nested_accelerator_controller.cc', - 'core/nested_accelerator_controller.h', - 'core/nested_accelerator_delegate.h', - 'core/nested_accelerator_dispatcher.cc', - 'core/nested_accelerator_dispatcher.h', - ], - }], ], }, { @@ -154,7 +138,6 @@ 'core/cursor_manager_unittest.cc', 'core/focus_controller_unittest.cc', 'core/image_grid_unittest.cc', - 'core/nested_accelerator_controller_unittest.cc', 'core/shadow_controller_unittest.cc', 'core/shadow_unittest.cc', 'core/transient_window_manager_unittest.cc', |