summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 19:46:22 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 19:46:22 +0000
commit995d3145768f6f2c171546853be7359e46e1f444 (patch)
treef89bc85f412afa25452c3e28e328fa36cdd8ba5f
parent7c34d000dcd44dcf76f43aaa97c684f37c43b526 (diff)
downloadchromium_src-995d3145768f6f2c171546853be7359e46e1f444.zip
chromium_src-995d3145768f6f2c171546853be7359e46e1f444.tar.gz
chromium_src-995d3145768f6f2c171546853be7359e46e1f444.tar.bz2
Revert 266616 "Move DefaultActivationClient to wm/core"
> Move DefaultActivationClient to wm/core > > Several tests are using AuraTestHelper and were relying on it to set up the DefaultActivationClient, so I had to have them instantiate the DAC directly after calling SetUp() on the helper. I also had to make the DAC delete itself after the root window it's bound to is destroyed. > > R=sky@chromium.org > http://crbug.com/308710 > > Review URL: https://codereview.chromium.org/250113002 TBR=ben@chromium.org Review URL: https://codereview.chromium.org/259103003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266632 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc2
-rw-r--r--chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc2
-rw-r--r--chrome/test/base/browser_with_test_window_test.cc2
-rw-r--r--chrome/test/base/view_event_test_base.cc2
-rw-r--r--content/DEPS2
-rw-r--r--content/browser/media/capture/desktop_capture_device_aura_unittest.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc2
-rw-r--r--content/content_tests.gypi2
-rw-r--r--content/public/test/test_renderer_host.cc2
-rw-r--r--content/shell/browser/shell_platform_data_aura.cc5
-rw-r--r--content/shell/browser/shell_platform_data_aura.h2
-rw-r--r--mojo/examples/launcher/DEPS1
-rw-r--r--mojo/examples/launcher/launcher.cc6
-rw-r--r--mojo/mojo_examples.gypi1
-rw-r--r--ui/aura/aura.gyp2
-rw-r--r--ui/aura/client/default_activation_client.cc (renamed from ui/wm/core/default_activation_client.cc)85
-rw-r--r--ui/aura/client/default_activation_client.h69
-rw-r--r--ui/aura/test/aura_test_helper.cc4
-rw-r--r--ui/aura/test/aura_test_helper.h2
-rw-r--r--ui/keyboard/keyboard.gyp1
-rw-r--r--ui/keyboard/keyboard_controller_unittest.cc2
-rw-r--r--ui/snapshot/DEPS1
-rw-r--r--ui/snapshot/snapshot.gyp1
-rw-r--r--ui/snapshot/snapshot_aura_unittest.cc2
-rw-r--r--ui/views/test/views_test_base.cc2
-rw-r--r--ui/wm/core/default_activation_client.h73
-rw-r--r--ui/wm/test/wm_test_helper.cc5
-rw-r--r--ui/wm/test/wm_test_helper.h2
-rw-r--r--ui/wm/wm.gyp2
29 files changed, 120 insertions, 166 deletions
diff --git a/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc
index 49328c7..3c4ffbf 100644
--- a/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc
+++ b/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc
@@ -35,7 +35,6 @@
#include "ui/aura/test/aura_test_helper.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/wm/core/default_activation_client.h"
#endif
using base::ASCIIToUTF16;
@@ -114,7 +113,6 @@ class AccessibilityEventRouterViewsTest
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
#endif // USE_AURA
EnableAccessibilityAndListenToFocusNotifications();
}
diff --git a/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc b/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
index ace30ac..7bac67cb 100644
--- a/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
+++ b/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
@@ -10,7 +10,6 @@
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/views/controls/webview/webview.h"
-#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/easy_resize_window_targeter.h"
class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase {
@@ -29,7 +28,6 @@ class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase {
protected:
virtual void SetUp() OVERRIDE {
aura::test::AuraTestBase::SetUp();
- new wm::DefaultActivationClient(root_window());
widget_.reset(new views::Widget);
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
params.remove_standard_frame = true;
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc
index e5de4b2..c45f7fa 100644
--- a/chrome/test/base/browser_with_test_window_test.cc
+++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -20,7 +20,6 @@
#if defined(USE_AURA)
#include "ui/aura/test/aura_test_helper.h"
#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/wm/core/default_activation_client.h"
#endif
#if defined(USE_ASH)
@@ -71,7 +70,6 @@ void BrowserWithTestWindowTest::SetUp() {
aura_test_helper_.reset(new aura::test::AuraTestHelper(
base::MessageLoopForUI::current()));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
#endif // USE_AURA
#if defined(TOOLKIT_VIEWS)
views_delegate_.reset(CreateViewsDelegate());
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc
index aae31d9..d2ace62 100644
--- a/chrome/test/base/view_event_test_base.cc
+++ b/chrome/test/base/view_event_test_base.cc
@@ -24,7 +24,6 @@
#include "ui/message_center/message_center.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
-#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/wm_state.h"
#if defined(USE_ASH)
@@ -141,7 +140,6 @@ void ViewEventTestBase::SetUp() {
aura_test_helper_.reset(
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
context = aura_test_helper_->root_window();
#endif // !USE_ASH && USE_AURA
diff --git a/content/DEPS b/content/DEPS
index d02ee64..11f13d0 100644
--- a/content/DEPS
+++ b/content/DEPS
@@ -91,7 +91,7 @@ include_rules = [
"+ui/shell_dialogs",
"+ui/snapshot",
"+ui/surface",
- "+ui/wm",
+ "+ui/wm/public",
# Content knows about grd files, but the specifics of how to get a resource
# given its id is left to the embedder.
"-ui/base/l10n",
diff --git a/content/browser/media/capture/desktop_capture_device_aura_unittest.cc b/content/browser/media/capture/desktop_capture_device_aura_unittest.cc
index 608c574..99577d6 100644
--- a/content/browser/media/capture/desktop_capture_device_aura_unittest.cc
+++ b/content/browser/media/capture/desktop_capture_device_aura_unittest.cc
@@ -15,7 +15,6 @@
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/wm/core/default_activation_client.h"
using ::testing::_;
using ::testing::AnyNumber;
@@ -66,7 +65,6 @@ class DesktopCaptureDeviceAuraTest : public testing::Test {
ui::InitializeContextFactoryForTests(enable_pixel_output);
helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
helper_->SetUp();
- new wm::DefaultActivationClient(helper_->root_window());
// We need a window to cover desktop area so that DesktopCaptureDeviceAura
// can use gfx::NativeWindow::GetWindowAtScreenPoint() to locate the
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 5821f40..31474d4 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -45,7 +45,6 @@
#include "ui/compositor/test/in_process_context_factory.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
-#include "ui/wm/core/default_activation_client.h"
using testing::_;
@@ -206,7 +205,6 @@ class RenderWidgetHostViewAuraTest : public testing::Test {
scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory));
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
browser_context_.reset(new TestBrowserContext);
process_host_ = new MockRenderProcessHost(browser_context_.get());
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 8334124..602a964 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -305,7 +305,6 @@
'dependencies': [
'../ui/aura/aura.gyp:aura_test_support',
'../ui/resources/ui_resources.gyp:ui_test_pak',
- '../ui/wm/wm.gyp:wm',
],
}],
['use_aura==1 or OS=="mac"', {
@@ -859,7 +858,6 @@
['use_aura==1', {
'dependencies': [
'../ui/aura/aura.gyp:aura',
- '../ui/wm/wm.gyp:wm',
]
}],
['use_aura==1 or toolkit_views==1', {
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc
index abaa4ce..dc323ca 100644
--- a/content/public/test/test_renderer_host.cc
+++ b/content/public/test/test_renderer_host.cc
@@ -25,7 +25,6 @@
#if defined(USE_AURA)
#include "ui/aura/test/aura_test_helper.h"
#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/wm/core/default_activation_client.h"
#endif
namespace content {
@@ -175,7 +174,6 @@ void RenderViewHostTestHarness::SetUp() {
aura_test_helper_.reset(
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
#endif
DCHECK(!browser_context_);
diff --git a/content/shell/browser/shell_platform_data_aura.cc b/content/shell/browser/shell_platform_data_aura.cc
index 33b8073..0a63279 100644
--- a/content/shell/browser/shell_platform_data_aura.cc
+++ b/content/shell/browser/shell_platform_data_aura.cc
@@ -6,6 +6,7 @@
#include "content/shell/browser/shell.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/default_activation_client.h"
#include "ui/aura/client/default_capture_client.h"
#include "ui/aura/env.h"
#include "ui/aura/layout_manager.h"
@@ -17,7 +18,6 @@
#include "ui/base/ime/input_method_delegate.h"
#include "ui/base/ime/input_method_factory.h"
#include "ui/gfx/screen.h"
-#include "ui/wm/core/default_activation_client.h"
namespace content {
@@ -121,7 +121,8 @@ ShellPlatformDataAura::ShellPlatformDataAura(const gfx::Size& initial_size) {
focus_client_.reset(new aura::test::TestFocusClient());
aura::client::SetFocusClient(host_->window(), focus_client_.get());
- new wm::DefaultActivationClient(host_->window());
+ activation_client_.reset(
+ new aura::client::DefaultActivationClient(host_->window()));
capture_client_.reset(
new aura::client::DefaultCaptureClient(host_->window()));
window_tree_client_.reset(
diff --git a/content/shell/browser/shell_platform_data_aura.h b/content/shell/browser/shell_platform_data_aura.h
index bc45ec6..4027bc3 100644
--- a/content/shell/browser/shell_platform_data_aura.h
+++ b/content/shell/browser/shell_platform_data_aura.h
@@ -10,6 +10,7 @@
namespace aura {
namespace client {
+class DefaultActivationClient;
class DefaultCaptureClient;
class FocusClient;
class WindowTreeClient;
@@ -39,6 +40,7 @@ class ShellPlatformDataAura {
private:
scoped_ptr<aura::WindowTreeHost> host_;
scoped_ptr<aura::client::FocusClient> focus_client_;
+ scoped_ptr<aura::client::DefaultActivationClient> activation_client_;
scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
scoped_ptr<ui::EventHandler> ime_filter_;
diff --git a/mojo/examples/launcher/DEPS b/mojo/examples/launcher/DEPS
index 270ff3a..6242444 100644
--- a/mojo/examples/launcher/DEPS
+++ b/mojo/examples/launcher/DEPS
@@ -8,6 +8,5 @@ include_rules = [
"+ui/gfx",
"+ui/gl",
"+ui/views",
- "+ui/wm",
"+webkit/common/gpu",
]
diff --git a/mojo/examples/launcher/launcher.cc b/mojo/examples/launcher/launcher.cc
index 042a7bdb..11baf57 100644
--- a/mojo/examples/launcher/launcher.cc
+++ b/mojo/examples/launcher/launcher.cc
@@ -23,6 +23,7 @@
#include "mojo/public/interfaces/shell/shell.mojom.h"
#include "mojo/services/native_viewport/native_viewport.mojom.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/default_activation_client.h"
#include "ui/aura/client/default_capture_client.h"
#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/env.h"
@@ -44,7 +45,6 @@
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
-#include "ui/wm/core/default_activation_client.h"
#include "url/gurl.h"
#if defined(WIN32)
@@ -244,7 +244,8 @@ class LauncherImpl : public Application,
focus_client_.reset(new aura::test::TestFocusClient());
aura::client::SetFocusClient(window_tree_host_->window(),
focus_client_.get());
- new wm::DefaultActivationClient(window_tree_host_->window());
+ activation_client_.reset(
+ new aura::client::DefaultActivationClient(window_tree_host_->window()));
capture_client_.reset(
new aura::client::DefaultCaptureClient(window_tree_host_->window()));
ime_filter_.reset(new MinimalInputEventFilter(window_tree_host_->window()));
@@ -262,6 +263,7 @@ class LauncherImpl : public Application,
scoped_ptr<DemoScreen> screen_;
scoped_ptr<LauncherWindowTreeClient> window_tree_client_;
+ scoped_ptr<aura::client::DefaultActivationClient> activation_client_;
scoped_ptr<aura::client::FocusClient> focus_client_;
scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
scoped_ptr<ui::EventHandler> ime_filter_;
diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi
index 00d5e81..5bece9b 100644
--- a/mojo/mojo_examples.gypi
+++ b/mojo/mojo_examples.gypi
@@ -255,7 +255,6 @@
'../ui/gfx/gfx.gyp:gfx',
'../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/views/views.gyp:views',
- '../ui/wm/wm.gyp:wm',
'../url/url.gyp:url_lib',
'mojo_aura_demo_support',
'mojo_common_lib',
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index a8900f8..9ddb104 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -36,6 +36,8 @@
'client/cursor_client.h',
'client/cursor_client_observer.h',
'client/cursor_client_observer.cc',
+ 'client/default_activation_client.cc',
+ 'client/default_activation_client.h',
'client/default_capture_client.cc',
'client/default_capture_client.h',
'client/event_client.cc',
diff --git a/ui/wm/core/default_activation_client.cc b/ui/aura/client/default_activation_client.cc
index 222c9ac..b11d7bf 100644
--- a/ui/wm/core/default_activation_client.cc
+++ b/ui/aura/client/default_activation_client.cc
@@ -2,64 +2,44 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/wm/core/default_activation_client.h"
+#include "ui/aura/client/default_activation_client.h"
#include "ui/aura/window.h"
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_delegate.h"
-namespace wm {
-
-// Takes care of observing root window destruction & destroying the client.
-class DefaultActivationClient::Deleter : public aura::WindowObserver {
- public:
- Deleter(DefaultActivationClient* client, aura::Window* root_window)
- : client_(client),
- root_window_(root_window) {
- root_window_->AddObserver(this);
- }
-
- private:
- virtual ~Deleter() {}
-
- // Overridden from WindowObserver:
- virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {
- DCHECK_EQ(window, root_window_);
- root_window_->RemoveObserver(this);
- delete client_;
- delete this;
- }
-
- DefaultActivationClient* client_;
- aura::Window* root_window_;
-
- DISALLOW_COPY_AND_ASSIGN(Deleter);
-};
+namespace aura {
+namespace client {
////////////////////////////////////////////////////////////////////////////////
// DefaultActivationClient, public:
-DefaultActivationClient::DefaultActivationClient(aura::Window* root_window)
+DefaultActivationClient::DefaultActivationClient(Window* root_window)
: last_active_(NULL) {
- aura::client::SetActivationClient(root_window, this);
- new Deleter(this, root_window);
+ client::SetActivationClient(root_window, this);
+}
+
+DefaultActivationClient::~DefaultActivationClient() {
+ for (unsigned int i = 0; i < active_windows_.size(); ++i) {
+ active_windows_[i]->RemoveObserver(this);
+ }
}
////////////////////////////////////////////////////////////////////////////////
// DefaultActivationClient, client::ActivationClient implementation:
void DefaultActivationClient::AddObserver(
- aura::client::ActivationChangeObserver* observer) {
+ client::ActivationChangeObserver* observer) {
observers_.AddObserver(observer);
}
void DefaultActivationClient::RemoveObserver(
- aura::client::ActivationChangeObserver* observer) {
+ client::ActivationChangeObserver* observer) {
observers_.RemoveObserver(observer);
}
-void DefaultActivationClient::ActivateWindow(aura::Window* window) {
- aura::Window* last_active = GetActiveWindow();
+void DefaultActivationClient::ActivateWindow(Window* window) {
+ Window* last_active = GetActiveWindow();
if (last_active == window)
return;
@@ -69,7 +49,7 @@ void DefaultActivationClient::ActivateWindow(aura::Window* window) {
window->parent()->StackChildAtTop(window);
window->AddObserver(this);
- FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver,
+ FOR_EACH_OBSERVER(client::ActivationChangeObserver,
observers_,
OnWindowActivated(window, last_active));
@@ -82,7 +62,7 @@ void DefaultActivationClient::ActivateWindow(aura::Window* window) {
observer->OnWindowActivated(window, last_active);
}
-void DefaultActivationClient::DeactivateWindow(aura::Window* window) {
+void DefaultActivationClient::DeactivateWindow(Window* window) {
aura::client::ActivationChangeObserver* observer =
aura::client::GetActivationChangeObserver(window);
if (observer)
@@ -91,40 +71,39 @@ void DefaultActivationClient::DeactivateWindow(aura::Window* window) {
ActivateWindow(last_active_);
}
-aura::Window* DefaultActivationClient::GetActiveWindow() {
+Window* DefaultActivationClient::GetActiveWindow() {
if (active_windows_.empty())
return NULL;
return active_windows_.back();
}
-aura::Window* DefaultActivationClient::GetActivatableWindow(
- aura::Window* window) {
+Window* DefaultActivationClient::GetActivatableWindow(Window* window) {
return NULL;
}
-aura::Window* DefaultActivationClient::GetToplevelWindow(aura::Window* window) {
+Window* DefaultActivationClient::GetToplevelWindow(Window* window) {
return NULL;
}
-bool DefaultActivationClient::OnWillFocusWindow(aura::Window* window,
+bool DefaultActivationClient::OnWillFocusWindow(Window* window,
const ui::Event* event) {
return true;
}
-bool DefaultActivationClient::CanActivateWindow(aura::Window* window) const {
+bool DefaultActivationClient::CanActivateWindow(Window* window) const {
return true;
}
////////////////////////////////////////////////////////////////////////////////
-// DefaultActivationClient, aura::WindowObserver implementation:
+// DefaultActivationClient, WindowObserver implementation:
-void DefaultActivationClient::OnWindowDestroyed(aura::Window* window) {
+void DefaultActivationClient::OnWindowDestroyed(Window* window) {
if (window == last_active_)
last_active_ = NULL;
if (window == GetActiveWindow()) {
active_windows_.pop_back();
- aura::Window* next_active = GetActiveWindow();
+ Window* next_active = GetActiveWindow();
if (next_active && aura::client::GetActivationChangeObserver(next_active)) {
aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated(
next_active, NULL);
@@ -135,16 +114,7 @@ void DefaultActivationClient::OnWindowDestroyed(aura::Window* window) {
RemoveActiveWindow(window);
}
-////////////////////////////////////////////////////////////////////////////////
-// DefaultActivationClient, private:
-
-DefaultActivationClient::~DefaultActivationClient() {
- for (unsigned int i = 0; i < active_windows_.size(); ++i) {
- active_windows_[i]->RemoveObserver(this);
- }
-}
-
-void DefaultActivationClient::RemoveActiveWindow(aura::Window* window) {
+void DefaultActivationClient::RemoveActiveWindow(Window* window) {
for (unsigned int i = 0; i < active_windows_.size(); ++i) {
if (active_windows_[i] == window) {
active_windows_.erase(active_windows_.begin() + i);
@@ -154,4 +124,5 @@ void DefaultActivationClient::RemoveActiveWindow(aura::Window* window) {
}
}
-} // namespace wm
+} // namespace client
+} // namespace aura
diff --git a/ui/aura/client/default_activation_client.h b/ui/aura/client/default_activation_client.h
new file mode 100644
index 0000000..47e19dbc
--- /dev/null
+++ b/ui/aura/client/default_activation_client.h
@@ -0,0 +1,69 @@
+// Copyright 2013 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_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
+#define UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
+
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/observer_list.h"
+#include "ui/aura/aura_export.h"
+#include "ui/aura/window_observer.h"
+#include "ui/wm/public/activation_client.h"
+
+namespace aura {
+namespace client {
+class ActivationChangeObserver;
+}
+
+namespace client {
+
+// Simple ActivationClient implementation for use by tests and other targets
+// that just need basic behavior (e.g. activate windows whenever requested,
+// restack windows at the top when they're activated, etc.).
+class AURA_EXPORT DefaultActivationClient : public client::ActivationClient,
+ public WindowObserver {
+ public:
+ explicit DefaultActivationClient(Window* root_window);
+ virtual ~DefaultActivationClient();
+
+ // Overridden from client::ActivationClient:
+ virtual void AddObserver(client::ActivationChangeObserver* observer) OVERRIDE;
+ virtual void RemoveObserver(
+ client::ActivationChangeObserver* observer) OVERRIDE;
+ virtual void ActivateWindow(Window* window) OVERRIDE;
+ virtual void DeactivateWindow(Window* window) OVERRIDE;
+ virtual Window* GetActiveWindow() OVERRIDE;
+ virtual Window* GetActivatableWindow(Window* window) OVERRIDE;
+ virtual Window* GetToplevelWindow(Window* window) OVERRIDE;
+ virtual bool OnWillFocusWindow(Window* window,
+ const ui::Event* event) OVERRIDE;
+ virtual bool CanActivateWindow(Window* window) const OVERRIDE;
+
+ // Overridden from WindowObserver:
+ virtual void OnWindowDestroyed(Window* window) OVERRIDE;
+
+ private:
+ void RemoveActiveWindow(Window* window);
+
+ // This class explicitly does NOT store the active window in a window property
+ // to make sure that ActivationChangeObserver is not treated as part of the
+ // aura API. Assumptions to that end will cause tests that use this client to
+ // fail.
+ std::vector<Window*> active_windows_;
+
+ // The window which was active before the currently active one.
+ Window* last_active_;
+
+ ObserverList<client::ActivationChangeObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient);
+};
+
+} // namespace client
+} // namespace aura
+
+#endif // UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc
index 34183db..b300dcf 100644
--- a/ui/aura/test/aura_test_helper.cc
+++ b/ui/aura/test/aura_test_helper.cc
@@ -7,6 +7,7 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/default_activation_client.h"
#include "ui/aura/client/default_capture_client.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/env.h"
@@ -70,6 +71,8 @@ void AuraTestHelper::SetUp() {
focus_client_.reset(new TestFocusClient);
client::SetFocusClient(root_window(), focus_client_.get());
stacking_client_.reset(new TestWindowTreeClient(root_window()));
+ activation_client_.reset(
+ new client::DefaultActivationClient(root_window()));
capture_client_.reset(new client::DefaultCaptureClient(root_window()));
test_input_method_.reset(new ui::DummyInputMethod);
root_window()->SetProperty(
@@ -85,6 +88,7 @@ void AuraTestHelper::TearDown() {
teardown_called_ = true;
test_input_method_.reset();
stacking_client_.reset();
+ activation_client_.reset();
capture_client_.reset();
focus_client_.reset();
client::SetFocusClient(root_window(), NULL);
diff --git a/ui/aura/test/aura_test_helper.h b/ui/aura/test/aura_test_helper.h
index 05d59ab..f79ca76 100644
--- a/ui/aura/test/aura_test_helper.h
+++ b/ui/aura/test/aura_test_helper.h
@@ -22,6 +22,7 @@ class ScopedAnimationDurationScaleMode;
namespace aura {
class TestScreen;
namespace client {
+class DefaultActivationClient;
class DefaultCaptureClient;
class FocusClient;
}
@@ -59,6 +60,7 @@ class AuraTestHelper {
bool owns_host_;
scoped_ptr<WindowTreeHost> host_;
scoped_ptr<TestWindowTreeClient> stacking_client_;
+ scoped_ptr<client::DefaultActivationClient> activation_client_;
scoped_ptr<client::DefaultCaptureClient> capture_client_;
scoped_ptr<ui::InputMethod> test_input_method_;
scoped_ptr<client::FocusClient> focus_client_;
diff --git a/ui/keyboard/keyboard.gyp b/ui/keyboard/keyboard.gyp
index c4ca714..153b38c 100644
--- a/ui/keyboard/keyboard.gyp
+++ b/ui/keyboard/keyboard.gyp
@@ -91,7 +91,6 @@
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
'../resources/ui_resources.gyp:ui_test_pak',
- '../wm/wm.gyp:wm',
'keyboard',
],
'sources': [
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index 62b0d73..4333c84 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -28,7 +28,6 @@
#include "ui/keyboard/keyboard_controller_proxy.h"
#include "ui/keyboard/keyboard_switches.h"
#include "ui/keyboard/keyboard_util.h"
-#include "ui/wm/core/default_activation_client.h"
namespace keyboard {
namespace {
@@ -169,7 +168,6 @@ class KeyboardControllerTest : public testing::Test {
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
ui::SetUpInputMethodFactoryForTesting();
focus_controller_.reset(new TestFocusController(root_window()));
proxy_ = new TestKeyboardControllerProxy();
diff --git a/ui/snapshot/DEPS b/ui/snapshot/DEPS
index f6768d1..08ad30c 100644
--- a/ui/snapshot/DEPS
+++ b/ui/snapshot/DEPS
@@ -8,5 +8,4 @@ include_rules = [
"+ui/compositor",
"+ui/gfx",
"+ui/gl",
- "+ui/wm",
]
diff --git a/ui/snapshot/snapshot.gyp b/ui/snapshot/snapshot.gyp
index e34b0c2..1f0c645 100644
--- a/ui/snapshot/snapshot.gyp
+++ b/ui/snapshot/snapshot.gyp
@@ -68,7 +68,6 @@
'../aura/aura.gyp:aura_test_support',
'../compositor/compositor.gyp:compositor',
'../compositor/compositor.gyp:compositor_test_support',
- '../wm/wm.gyp:wm',
],
}],
# See http://crbug.com/162998#c4 for why this is needed.
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc
index eee20b3..b000ad1 100644
--- a/ui/snapshot/snapshot_aura_unittest.cc
+++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -23,7 +23,6 @@
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/transform.h"
#include "ui/gl/gl_implementation.h"
-#include "ui/wm/core/default_activation_client.h"
namespace ui {
namespace {
@@ -94,7 +93,6 @@ class SnapshotAuraTest : public testing::Test {
helper_.reset(
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
helper_->SetUp();
- new ::wm::DefaultActivationClient(helper_->root_window());
}
virtual void TearDown() OVERRIDE {
diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc
index 1a7f3aa..4bf036c 100644
--- a/ui/views/test/views_test_base.cc
+++ b/ui/views/test/views_test_base.cc
@@ -12,7 +12,6 @@
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/wm/core/capture_controller.h"
-#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/wm_state.h"
namespace views {
@@ -40,7 +39,6 @@ void ViewsTestBase::SetUp() {
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp();
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
wm_state_.reset(new ::wm::WMState);
ui::InitializeInputMethodForTesting();
}
diff --git a/ui/wm/core/default_activation_client.h b/ui/wm/core/default_activation_client.h
deleted file mode 100644
index 3b6bffc..0000000
--- a/ui/wm/core/default_activation_client.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2013 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_DEFAULT_ACTIVATION_CLIENT_H_
-#define UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_
-
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "base/observer_list.h"
-#include "ui/aura/window_observer.h"
-#include "ui/wm/public/activation_client.h"
-#include "ui/wm/wm_export.h"
-
-namespace aura {
-namespace client {
-class ActivationChangeObserver;
-}
-}
-
-namespace wm {
-
-// Simple ActivationClient implementation for use by tests and other targets
-// that just need basic behavior (e.g. activate windows whenever requested,
-// restack windows at the top when they're activated, etc.). This object deletes
-// itself when the root window it is associated with is destroyed.
-class WM_EXPORT DefaultActivationClient : public aura::client::ActivationClient,
- public aura::WindowObserver {
- public:
- explicit DefaultActivationClient(aura::Window* root_window);
-
- // Overridden from aura::client::ActivationClient:
- virtual void AddObserver(
- aura::client::ActivationChangeObserver* observer) OVERRIDE;
- virtual void RemoveObserver(
- aura::client::ActivationChangeObserver* observer) OVERRIDE;
- virtual void ActivateWindow(aura::Window* window) OVERRIDE;
- virtual void DeactivateWindow(aura::Window* window) OVERRIDE;
- virtual aura::Window* GetActiveWindow() OVERRIDE;
- virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE;
- virtual aura::Window* GetToplevelWindow(aura::Window* window) OVERRIDE;
- virtual bool OnWillFocusWindow(aura::Window* window,
- const ui::Event* event) OVERRIDE;
- virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE;
-
- // Overridden from WindowObserver:
- virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
-
- private:
- class Deleter;
-
- virtual ~DefaultActivationClient();
- void RemoveActiveWindow(aura::Window* window);
-
- // This class explicitly does NOT store the active window in a window property
- // to make sure that ActivationChangeObserver is not treated as part of the
- // aura API. Assumptions to that end will cause tests that use this client to
- // fail.
- std::vector<aura::Window*> active_windows_;
-
- // The window which was active before the currently active one.
- aura::Window* last_active_;
-
- ObserverList<aura::client::ActivationChangeObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient);
-};
-
-} // namespace wm
-
-#endif // UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_
diff --git a/ui/wm/test/wm_test_helper.cc b/ui/wm/test/wm_test_helper.cc
index 8a3eba1..1982be5 100644
--- a/ui/wm/test/wm_test_helper.cc
+++ b/ui/wm/test/wm_test_helper.cc
@@ -4,12 +4,12 @@
#include "ui/wm/test/wm_test_helper.h"
+#include "ui/aura/client/default_activation_client.h"
#include "ui/aura/client/default_capture_client.h"
#include "ui/aura/env.h"
#include "ui/aura/test/test_focus_client.h"
#include "ui/aura/window.h"
#include "ui/wm/core/compound_event_filter.h"
-#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/input_method_event_filter.h"
namespace wm {
@@ -31,7 +31,8 @@ WMTestHelper::WMTestHelper(const gfx::Size& default_window_size) {
input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window());
root_window_event_filter_->AddHandler(input_method_filter_.get());
- new wm::DefaultActivationClient(host_->window());
+ activation_client_.reset(
+ new aura::client::DefaultActivationClient(host_->window()));
capture_client_.reset(
new aura::client::DefaultCaptureClient(host_->window()));
diff --git a/ui/wm/test/wm_test_helper.h b/ui/wm/test/wm_test_helper.h
index 52707a4..1a3dd09 100644
--- a/ui/wm/test/wm_test_helper.h
+++ b/ui/wm/test/wm_test_helper.h
@@ -14,6 +14,7 @@ namespace aura {
class Window;
class WindowTreeHost;
namespace client {
+class DefaultActivationClient;
class DefaultCaptureClient;
class FocusClient;
}
@@ -50,6 +51,7 @@ class WMTestHelper : public aura::client::WindowTreeClient {
scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
+ scoped_ptr<aura::client::DefaultActivationClient> activation_client_;
scoped_ptr<aura::client::FocusClient> focus_client_;
DISALLOW_COPY_AND_ASSIGN(WMTestHelper);
diff --git a/ui/wm/wm.gyp b/ui/wm/wm.gyp
index 537f67a..17ceaa36 100644
--- a/ui/wm/wm.gyp
+++ b/ui/wm/wm.gyp
@@ -34,8 +34,6 @@
'core/compound_event_filter.h',
'core/cursor_manager.cc',
'core/cursor_manager.h',
- 'core/default_activation_client.cc',
- 'core/default_activation_client.h',
'core/easy_resize_window_targeter.cc',
'core/easy_resize_window_targeter.h',
'core/focus_controller.cc',