Skip to content

Commit

Permalink
Move DefaultActivationClient to wm/core
Browse files Browse the repository at this point in the history
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

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266616

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266975

Review URL: https://codereview.chromium.org/250113002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267065 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ben@chromium.org committed Apr 30, 2014
1 parent 946cdb6 commit f3b1efd
Show file tree
Hide file tree
Showing 33 changed files with 177 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#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;
Expand Down Expand Up @@ -113,6 +114,7 @@ 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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#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 {
Expand All @@ -28,6 +29,7 @@ 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;
Expand Down
2 changes: 2 additions & 0 deletions chrome/test/base/browser_with_test_window_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#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)
Expand Down Expand Up @@ -70,6 +71,7 @@ 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());
Expand Down
2 changes: 2 additions & 0 deletions chrome/test/base/view_event_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#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)
Expand Down Expand Up @@ -140,6 +141,7 @@ 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

Expand Down
2 changes: 1 addition & 1 deletion content/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ include_rules = [
"+ui/shell_dialogs",
"+ui/snapshot",
"+ui/surface",
"+ui/wm/public",
"+ui/wm",
# 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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#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;
Expand Down Expand Up @@ -65,6 +66,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#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::_;

Expand Down Expand Up @@ -207,6 +208,7 @@ 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());
Expand Down
2 changes: 2 additions & 0 deletions content/content_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
'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"', {
Expand Down Expand Up @@ -859,6 +860,7 @@
['use_aura==1', {
'dependencies': [
'../ui/aura/aura.gyp:aura',
'../ui/wm/wm.gyp:wm',
]
}],
['use_aura==1 or toolkit_views==1', {
Expand Down
2 changes: 2 additions & 0 deletions content/public/test/test_renderer_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#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 {
Expand Down Expand Up @@ -174,6 +175,7 @@ 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_);
Expand Down
5 changes: 2 additions & 3 deletions content/shell/browser/shell_platform_data_aura.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#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"
Expand All @@ -18,6 +17,7 @@
#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 {

Expand Down Expand Up @@ -121,8 +121,7 @@ ShellPlatformDataAura::ShellPlatformDataAura(const gfx::Size& initial_size) {
focus_client_.reset(new aura::test::TestFocusClient());
aura::client::SetFocusClient(host_->window(), focus_client_.get());

activation_client_.reset(
new aura::client::DefaultActivationClient(host_->window()));
new wm::DefaultActivationClient(host_->window());
capture_client_.reset(
new aura::client::DefaultCaptureClient(host_->window()));
window_tree_client_.reset(
Expand Down
2 changes: 0 additions & 2 deletions content/shell/browser/shell_platform_data_aura.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace aura {
namespace client {
class DefaultActivationClient;
class DefaultCaptureClient;
class FocusClient;
class WindowTreeClient;
Expand Down Expand Up @@ -40,7 +39,6 @@ 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_;
Expand Down
1 change: 1 addition & 0 deletions mojo/examples/launcher/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ include_rules = [
"+ui/gfx",
"+ui/gl",
"+ui/views",
"+ui/wm",
"+webkit/common/gpu",
]
6 changes: 2 additions & 4 deletions mojo/examples/launcher/launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#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"
Expand All @@ -45,6 +44,7 @@
#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)
Expand Down Expand Up @@ -244,8 +244,7 @@ class LauncherImpl : public Application,
focus_client_.reset(new aura::test::TestFocusClient());
aura::client::SetFocusClient(window_tree_host_->window(),
focus_client_.get());
activation_client_.reset(
new aura::client::DefaultActivationClient(window_tree_host_->window()));
new wm::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()));
Expand All @@ -263,7 +262,6 @@ 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_;
Expand Down
1 change: 1 addition & 0 deletions mojo/mojo_examples.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
'../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',
Expand Down
2 changes: 0 additions & 2 deletions ui/aura/aura.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
'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',
Expand Down
69 changes: 0 additions & 69 deletions ui/aura/client/default_activation_client.h

This file was deleted.

4 changes: 0 additions & 4 deletions ui/aura/test/aura_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#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"
Expand Down Expand Up @@ -71,8 +70,6 @@ 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(
Expand All @@ -88,7 +85,6 @@ 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);
Expand Down
2 changes: 0 additions & 2 deletions ui/aura/test/aura_test_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ScopedAnimationDurationScaleMode;
namespace aura {
class TestScreen;
namespace client {
class DefaultActivationClient;
class DefaultCaptureClient;
class FocusClient;
}
Expand Down Expand Up @@ -60,7 +59,6 @@ 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_;
Expand Down
1 change: 1 addition & 0 deletions ui/keyboard/keyboard.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
'../resources/ui_resources.gyp:ui_test_pak',
'../wm/wm.gyp:wm',
'keyboard',
],
'sources': [
Expand Down
2 changes: 2 additions & 0 deletions ui/keyboard/keyboard_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#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 {
Expand Down Expand Up @@ -168,6 +169,7 @@ 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();
Expand Down
1 change: 1 addition & 0 deletions ui/snapshot/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ include_rules = [
"+ui/compositor",
"+ui/gfx",
"+ui/gl",
"+ui/wm",
]
1 change: 1 addition & 0 deletions ui/snapshot/snapshot.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
'../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.
Expand Down
Loading

0 comments on commit f3b1efd

Please sign in to comment.