diff options
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/aura.gyp | 8 | ||||
-rw-r--r-- | ui/aura/client/stacking_client.cc | 38 | ||||
-rw-r--r-- | ui/aura/client/stacking_client.h | 50 | ||||
-rw-r--r-- | ui/aura/client/window_tree_client.cc | 51 | ||||
-rw-r--r-- | ui/aura/client/window_tree_client.h | 56 | ||||
-rw-r--r-- | ui/aura/demo/demo_main.cc | 31 | ||||
-rw-r--r-- | ui/aura/test/aura_test_base.cc | 13 | ||||
-rw-r--r-- | ui/aura/test/aura_test_base.h | 5 | ||||
-rw-r--r-- | ui/aura/test/aura_test_helper.cc | 4 | ||||
-rw-r--r-- | ui/aura/test/aura_test_helper.h | 4 | ||||
-rw-r--r-- | ui/aura/test/test_stacking_client.cc | 28 | ||||
-rw-r--r-- | ui/aura/test/test_stacking_client.h | 36 | ||||
-rw-r--r-- | ui/aura/test/test_window_tree_client.cc | 28 | ||||
-rw-r--r-- | ui/aura/test/test_window_tree_client.h | 34 | ||||
-rw-r--r-- | ui/aura/window.cc | 14 | ||||
-rw-r--r-- | ui/aura/window.h | 7 | ||||
-rw-r--r-- | ui/aura/window_unittest.cc | 17 |
17 files changed, 208 insertions, 216 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index 954d8de..b062883 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -62,8 +62,6 @@ 'client/focus_client.h', 'client/screen_position_client.cc', 'client/screen_position_client.h', - 'client/stacking_client.cc', - 'client/stacking_client.h', 'client/tooltip_client.cc', 'client/tooltip_client.h', 'client/user_action_client.cc', @@ -72,6 +70,8 @@ 'client/visibility_client.h', 'client/window_move_client.cc', 'client/window_move_client.h', + 'client/window_tree_client.cc', + 'client/window_tree_client.h', 'client/window_types.h', 'device_list_updater_aurax11.cc', 'device_list_updater_aurax11.h', @@ -166,8 +166,8 @@ 'test/test_focus_client.h', 'test/test_screen.cc', 'test/test_screen.h', - 'test/test_stacking_client.cc', - 'test/test_stacking_client.h', + 'test/test_window_tree_client.cc', + 'test/test_window_tree_client.h', 'test/test_windows.cc', 'test/test_windows.h', 'test/test_window_delegate.cc', diff --git a/ui/aura/client/stacking_client.cc b/ui/aura/client/stacking_client.cc deleted file mode 100644 index 5d93d98..0000000 --- a/ui/aura/client/stacking_client.cc +++ /dev/null @@ -1,38 +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/aura/client/stacking_client.h" - -#include "ui/aura/env.h" -#include "ui/aura/root_window.h" -#include "ui/aura/window_property.h" - -DECLARE_WINDOW_PROPERTY_TYPE(aura::client::StackingClient*) - -namespace aura { -namespace client { - -DEFINE_WINDOW_PROPERTY_KEY( - StackingClient*, kRootWindowStackingClientKey, NULL); - -void SetStackingClient(Window* window, StackingClient* stacking_client) { - DCHECK(window); - - RootWindow* root_window = window->GetRootWindow(); - DCHECK(root_window); - root_window->SetProperty(kRootWindowStackingClientKey, stacking_client); -} - -StackingClient* GetStackingClient(Window* window) { - DCHECK(window); - RootWindow* root_window = window->GetRootWindow(); - DCHECK(root_window); - StackingClient* root_window_stacking_client = - root_window->GetProperty(kRootWindowStackingClientKey); - DCHECK(root_window_stacking_client); - return root_window_stacking_client; -} - -} // namespace client -} // namespace aura diff --git a/ui/aura/client/stacking_client.h b/ui/aura/client/stacking_client.h deleted file mode 100644 index 89f83eb..0000000 --- a/ui/aura/client/stacking_client.h +++ /dev/null @@ -1,50 +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_AURA_CLIENT_STACKING_CLIENT_H_ -#define UI_AURA_CLIENT_STACKING_CLIENT_H_ - -#include "ui/aura/aura_export.h" - -namespace gfx { -class Rect; -} - -namespace aura { -class Window; -namespace client { - -// An interface implemented by an object that stacks windows. -class AURA_EXPORT StackingClient { - public: - virtual ~StackingClient() {} - - // Called by the Window when it looks for a default parent. Returns the - // window that |window| should be added to instead. |context| provides a - // Window (generally a RootWindow) that can be used to determine which - // desktop type the default parent should be chosen from. NOTE: this may - // have side effects. It should only be used when |window| is going to be - // immediately added. - // - // TODO(erg): Remove |context|, and maybe after oshima's patch lands, - // |bounds|. - virtual Window* GetDefaultParent( - Window* context, - Window* window, - const gfx::Rect& bounds) = 0; -}; - -// Set/Get a stacking client for a specific window. Setting the stacking client -// sets the stacking client on the window's RootWindow, not the window itself. -// Likewise getting obtains it from the window's RootWindow. If |window| is -// non-NULL it must be in a RootWindow. If |window| is NULL, the default -// stacking client is used. -AURA_EXPORT void SetStackingClient(Window* window, - StackingClient* stacking_client); -StackingClient* GetStackingClient(Window* window); - -} // namespace client -} // namespace aura - -#endif // UI_AURA_CLIENT_STACKING_CLIENT_H_ diff --git a/ui/aura/client/window_tree_client.cc b/ui/aura/client/window_tree_client.cc new file mode 100644 index 0000000..b2ea10f --- /dev/null +++ b/ui/aura/client/window_tree_client.cc @@ -0,0 +1,51 @@ +// Copyright (c) 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. + +#include "ui/aura/client/window_tree_client.h" + +#include "ui/aura/env.h" +#include "ui/aura/root_window.h" +#include "ui/aura/window_property.h" + +DECLARE_WINDOW_PROPERTY_TYPE(aura::client::WindowTreeClient*) + +namespace aura { +namespace client { + +DEFINE_WINDOW_PROPERTY_KEY( + WindowTreeClient*, kRootWindowWindowTreeClientKey, NULL); + +void SetWindowTreeClient(Window* window, WindowTreeClient* window_tree_client) { + DCHECK(window); + + RootWindow* root_window = window->GetRootWindow(); + DCHECK(root_window); + root_window->SetProperty(kRootWindowWindowTreeClientKey, window_tree_client); +} + +WindowTreeClient* GetWindowTreeClient(Window* window) { + DCHECK(window); + RootWindow* root_window = window->GetRootWindow(); + DCHECK(root_window); + WindowTreeClient* client = + root_window->GetProperty(kRootWindowWindowTreeClientKey); + DCHECK(client); + return client; +} + +void ParentWindowWithContext(Window* window, + Window* context, + const gfx::Rect& screen_bounds) { + DCHECK(context); + + // |context| must be attached to a hierarchy with a WindowTreeClient. + WindowTreeClient* client = GetWindowTreeClient(context); + DCHECK(client); + Window* default_parent = + client->GetDefaultParent(context, window, screen_bounds); + default_parent->AddChild(window); +} + +} // namespace client +} // namespace aura diff --git a/ui/aura/client/window_tree_client.h b/ui/aura/client/window_tree_client.h new file mode 100644 index 0000000..59cb132 --- /dev/null +++ b/ui/aura/client/window_tree_client.h @@ -0,0 +1,56 @@ +// Copyright (c) 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_WINDOW_TREE_CLIENT_H_ +#define UI_AURA_CLIENT_WINDOW_TREE_CLIENT_H_ + +#include "ui/aura/aura_export.h" + +namespace gfx { +class Rect; +} + +namespace aura { +class Window; +namespace client { + +// Implementations of this object are used to help locate a default parent for +// NULL-parented Windows. +class AURA_EXPORT WindowTreeClient { + public: + virtual ~WindowTreeClient() {} + + // Called by the Window when it looks for a default parent. Returns the + // window that |window| should be added to instead. |context| provides a + // Window (generally a RootWindow) that can be used to determine which + // desktop type the default parent should be chosen from. NOTE: this may + // have side effects. It should only be used when |window| is going to be + // immediately added. + // + // TODO(erg): Remove |context|, and maybe after oshima's patch lands, + // |bounds|. + virtual Window* GetDefaultParent( + Window* context, + Window* window, + const gfx::Rect& bounds) = 0; +}; + +// Set/Get a window tree client for the RootWindow containing |window|. |window| +// must not be NULL. +AURA_EXPORT void SetWindowTreeClient(Window* window, + WindowTreeClient* window_tree_client); +WindowTreeClient* GetWindowTreeClient(Window* window); + +// Adds |window| to an appropriate parent by consulting an implementation of +// WindowTreeClient attached at the root Window containing |context|. The final +// location may be a window hierarchy other than the one supplied via +// |context|, which must not be NULL. |screen_bounds| may be empty. +AURA_EXPORT void ParentWindowWithContext(Window* window, + Window* context, + const gfx::Rect& screen_bounds); + +} // namespace client +} // namespace aura + +#endif // UI_AURA_CLIENT_WINDOW_TREE_CLIENT_H_ diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index abdd514..f9d8986 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc @@ -9,7 +9,7 @@ #include "base/message_loop/message_loop.h" #include "third_party/skia/include/core/SkXfermode.h" #include "ui/aura/client/default_capture_client.h" -#include "ui/aura/client/stacking_client.h" +#include "ui/aura/client/window_tree_client.h" #include "ui/aura/env.h" #include "ui/aura/root_window.h" #include "ui/aura/test/test_focus_client.h" @@ -77,34 +77,33 @@ class DemoWindowDelegate : public aura::WindowDelegate { DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); }; -class DemoStackingClient : public aura::client::StackingClient { +class DemoWindowTreeClient : public aura::client::WindowTreeClient { public: - explicit DemoStackingClient(aura::RootWindow* root_window) - : root_window_(root_window) { - aura::client::SetStackingClient(root_window_, this); + explicit DemoWindowTreeClient(aura::Window* window) : window_(window) { + aura::client::SetWindowTreeClient(window_, this); } - virtual ~DemoStackingClient() { - aura::client::SetStackingClient(root_window_, NULL); + virtual ~DemoWindowTreeClient() { + aura::client::SetWindowTreeClient(window_, NULL); } - // Overridden from aura::client::StackingClient: + // Overridden from aura::client::WindowTreeClient: virtual aura::Window* GetDefaultParent(aura::Window* context, aura::Window* window, const gfx::Rect& bounds) OVERRIDE { if (!capture_client_) { capture_client_.reset( - new aura::client::DefaultCaptureClient(root_window_)); + new aura::client::DefaultCaptureClient(window_->GetRootWindow())); } - return root_window_; + return window_; } private: - aura::RootWindow* root_window_; + aura::Window* window_; scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; - DISALLOW_COPY_AND_ASSIGN(DemoStackingClient); + DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); }; int DemoMain() { @@ -120,7 +119,7 @@ int DemoMain() { gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); scoped_ptr<aura::RootWindow> root_window( test_screen->CreateRootWindowForPrimaryDisplay()); - scoped_ptr<DemoStackingClient> stacking_client(new DemoStackingClient( + scoped_ptr<DemoWindowTreeClient> window_tree_client(new DemoWindowTreeClient( root_window.get())); aura::test::TestFocusClient focus_client; aura::client::SetFocusClient(root_window.get(), &focus_client); @@ -132,7 +131,8 @@ int DemoMain() { window1.Init(ui::LAYER_TEXTURED); window1.SetBounds(gfx::Rect(100, 100, 400, 400)); window1.Show(); - window1.SetDefaultParentByRootWindow(root_window.get(), gfx::Rect()); + aura::client::ParentWindowWithContext( + &window1, root_window.get(), gfx::Rect()); DemoWindowDelegate window_delegate2(SK_ColorRED); aura::Window window2(&window_delegate2); @@ -140,7 +140,8 @@ int DemoMain() { window2.Init(ui::LAYER_TEXTURED); window2.SetBounds(gfx::Rect(200, 200, 350, 350)); window2.Show(); - window2.SetDefaultParentByRootWindow(root_window.get(), gfx::Rect()); + aura::client::ParentWindowWithContext( + &window2, root_window.get(), gfx::Rect()); DemoWindowDelegate window_delegate3(SK_ColorGREEN); aura::Window window3(&window_delegate3); diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc index 3a0290d..d5263e4 100644 --- a/ui/aura/test/aura_test_base.cc +++ b/ui/aura/test/aura_test_base.cc @@ -4,9 +4,10 @@ #include "ui/aura/test/aura_test_base.h" +#include "ui/aura/client/window_tree_client.h" +#include "ui/aura/root_window.h" #include "ui/aura/test/aura_test_helper.h" #include "ui/aura/test/test_window_delegate.h" -#include "ui/aura/window.h" #include "ui/base/ime/input_method_initializer.h" #include "ui/events/gestures/gesture_configuration.h" @@ -100,18 +101,18 @@ Window* AuraTestBase::CreateTransientChild(int id, Window* parent) { window->set_id(id); window->SetType(aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_TEXTURED); - window->SetDefaultParentByRootWindow(root_window(), gfx::Rect()); + aura::client::ParentWindowWithContext(window, root_window(), gfx::Rect()); parent->AddTransientChild(window); return window; } -void AuraTestBase::SetDefaultParentByPrimaryRootWindow(aura::Window* window) { - window->SetDefaultParentByRootWindow(root_window(), gfx::Rect()); -} - void AuraTestBase::RunAllPendingInMessageLoop() { helper_->RunAllPendingInMessageLoop(); } +void AuraTestBase::ParentWindow(Window* window) { + client::ParentWindowWithContext(window, root_window(), gfx::Rect()); +} + } // namespace test } // namespace aura diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h index 791b955..3441deb 100644 --- a/ui/aura/test/aura_test_base.h +++ b/ui/aura/test/aura_test_base.h @@ -35,12 +35,11 @@ class AuraTestBase : public testing::Test { // Creates a transient window that is transient to |parent|. aura::Window* CreateTransientChild(int id, aura::Window* parent); - // Attach |window| to the current shell's root window. - void SetDefaultParentByPrimaryRootWindow(aura::Window* window); - protected: void RunAllPendingInMessageLoop(); + void ParentWindow(Window* window); + RootWindow* root_window() { return helper_->root_window(); } private: diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc index 36274c7..217ed23 100644 --- a/ui/aura/test/aura_test_helper.cc +++ b/ui/aura/test/aura_test_helper.cc @@ -16,7 +16,7 @@ #include "ui/aura/test/env_test_helper.h" #include "ui/aura/test/test_focus_client.h" #include "ui/aura/test/test_screen.h" -#include "ui/aura/test/test_stacking_client.h" +#include "ui/aura/test/test_window_tree_client.h" #include "ui/base/ime/dummy_input_method.h" #include "ui/compositor/compositor.h" #include "ui/compositor/layer_animator.h" @@ -79,7 +79,7 @@ void AuraTestHelper::SetUp() { focus_client_.reset(new TestFocusClient); client::SetFocusClient(root_window_.get(), focus_client_.get()); - stacking_client_.reset(new TestStackingClient(root_window_.get())); + stacking_client_.reset(new TestWindowTreeClient(root_window_.get())); activation_client_.reset( new client::DefaultActivationClient(root_window_.get())); capture_client_.reset(new client::DefaultCaptureClient(root_window_.get())); diff --git a/ui/aura/test/aura_test_helper.h b/ui/aura/test/aura_test_helper.h index 02f9c31..27cd442 100644 --- a/ui/aura/test/aura_test_helper.h +++ b/ui/aura/test/aura_test_helper.h @@ -30,7 +30,7 @@ class DefaultCaptureClient; class FocusClient; } namespace test { -class TestStackingClient; +class TestWindowTreeClient; // A helper class owned by tests that does common initialization required for // Aura use. This class creates a root window with clients and other objects @@ -60,7 +60,7 @@ class AuraTestHelper { bool teardown_called_; bool owns_root_window_; scoped_ptr<RootWindow> root_window_; - scoped_ptr<TestStackingClient> stacking_client_; + scoped_ptr<TestWindowTreeClient> stacking_client_; scoped_ptr<client::DefaultActivationClient> activation_client_; scoped_ptr<client::DefaultCaptureClient> capture_client_; scoped_ptr<ui::InputMethod> test_input_method_; diff --git a/ui/aura/test/test_stacking_client.cc b/ui/aura/test/test_stacking_client.cc deleted file mode 100644 index 746ad6c..0000000 --- a/ui/aura/test/test_stacking_client.cc +++ /dev/null @@ -1,28 +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/aura/test/test_stacking_client.h" - -#include "ui/aura/root_window.h" - -namespace aura { -namespace test { - -TestStackingClient::TestStackingClient(RootWindow* root_window) - : root_window_(root_window) { - client::SetStackingClient(root_window_, this); -} - -TestStackingClient::~TestStackingClient() { - client::SetStackingClient(root_window_, NULL); -} - -Window* TestStackingClient::GetDefaultParent(Window* context, - Window* window, - const gfx::Rect& bounds) { - return root_window_; -} - -} // namespace test -} // namespace aura diff --git a/ui/aura/test/test_stacking_client.h b/ui/aura/test/test_stacking_client.h deleted file mode 100644 index 7c9747b..0000000 --- a/ui/aura/test/test_stacking_client.h +++ /dev/null @@ -1,36 +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_AURA_TEST_TEST_STACKING_CLIENT_H_ -#define UI_AURA_TEST_TEST_STACKING_CLIENT_H_ - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "ui/aura/aura_export.h" -#include "ui/aura/client/stacking_client.h" - -namespace aura { -class RootWindow; -namespace test { - -class TestStackingClient : public client::StackingClient { - public: - explicit TestStackingClient(RootWindow* root_window); - virtual ~TestStackingClient(); - - // Overridden from client::StackingClient: - virtual Window* GetDefaultParent(Window* context, - Window* window, - const gfx::Rect& bounds) OVERRIDE; - - private: - RootWindow* root_window_; - - DISALLOW_COPY_AND_ASSIGN(TestStackingClient); -}; - -} // namespace test -} // namespace aura - -#endif // UI_AURA_TEST_TEST_STACKING_CLIENT_H_ diff --git a/ui/aura/test/test_window_tree_client.cc b/ui/aura/test/test_window_tree_client.cc new file mode 100644 index 0000000..41faa9d --- /dev/null +++ b/ui/aura/test/test_window_tree_client.cc @@ -0,0 +1,28 @@ +// Copyright (c) 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. + +#include "ui/aura/test/test_window_tree_client.h" + +#include "ui/aura/window.h" + +namespace aura { +namespace test { + +TestWindowTreeClient::TestWindowTreeClient(Window* root_window) + : root_window_(root_window) { + client::SetWindowTreeClient(root_window_, this); +} + +TestWindowTreeClient::~TestWindowTreeClient() { + client::SetWindowTreeClient(root_window_, NULL); +} + +Window* TestWindowTreeClient::GetDefaultParent(Window* context, + Window* window, + const gfx::Rect& bounds) { + return root_window_; +} + +} // namespace test +} // namespace aura diff --git a/ui/aura/test/test_window_tree_client.h b/ui/aura/test/test_window_tree_client.h new file mode 100644 index 0000000..7b3c5ee --- /dev/null +++ b/ui/aura/test/test_window_tree_client.h @@ -0,0 +1,34 @@ +// Copyright (c) 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_TEST_TEST_WINDOW_TREE_CLIENT_H_ +#define UI_AURA_TEST_TEST_WINDOW_TREE_CLIENT_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ui/aura/aura_export.h" +#include "ui/aura/client/window_tree_client.h" + +namespace aura { +namespace test { + +class TestWindowTreeClient : public client::WindowTreeClient { + public: + explicit TestWindowTreeClient(Window* root_window); + virtual ~TestWindowTreeClient(); + + // Overridden from client::WindowTreeClient: + virtual Window* GetDefaultParent(Window* context, + Window* window, + const gfx::Rect& bounds) OVERRIDE; + private: + Window* root_window_; + + DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); +}; + +} // namespace test +} // namespace aura + +#endif // UI_AURA_TEST_TEST_WINDOW_TREE_CLIENT_H_ diff --git a/ui/aura/window.cc b/ui/aura/window.cc index d761dae..cbe02b2 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -17,7 +17,6 @@ #include "ui/aura/client/event_client.h" #include "ui/aura/client/focus_client.h" #include "ui/aura/client/screen_position_client.h" -#include "ui/aura/client/stacking_client.h" #include "ui/aura/client/visibility_client.h" #include "ui/aura/env.h" #include "ui/aura/layout_manager.h" @@ -291,19 +290,6 @@ void Window::SchedulePaintInRect(const gfx::Rect& rect) { } } -void Window::SetDefaultParentByRootWindow(RootWindow* root_window, - const gfx::Rect& bounds_in_screen) { - DCHECK(root_window); - - // Stacking clients are mandatory on RootWindow objects. - client::StackingClient* client = client::GetStackingClient(root_window); - DCHECK(client); - - aura::Window* default_parent = client->GetDefaultParent( - root_window, this, bounds_in_screen); - default_parent->AddChild(this); -} - void Window::StackChildAtTop(Window* child) { if (children_.size() <= 1 || child == children_.back()) return; // In the front already. diff --git a/ui/aura/window.h b/ui/aura/window.h index 18c50e3..e908de4 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -159,13 +159,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate, // Marks the a portion of window as needing to be painted. void SchedulePaintInRect(const gfx::Rect& rect); - // Places this window per |root_window|'s stacking client. The final location - // may be a RootWindow other than the one passed in. |root_window| may not be - // NULL. |bounds_in_screen| may be empty; it is more optional context that - // may, but isn't necessarily used. - void SetDefaultParentByRootWindow(RootWindow* root_window, - const gfx::Rect& bounds_in_screen); - // Stacks the specified child of this Window at the front of the z-order. void StackChildAtTop(Window* child); diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 620130a..dfe8a9c 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -15,8 +15,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/client/focus_change_observer.h" -#include "ui/aura/client/stacking_client.h" #include "ui/aura/client/visibility_client.h" +#include "ui/aura/client/window_tree_client.h" #include "ui/aura/layout_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/root_window_host.h" @@ -67,11 +67,6 @@ class WindowTest : public AuraTestBase { set_max_separation_for_gesture_touches_in_pixels(max_separation_); } - // Adds |window| to |root_window_|, through the StackingClient. - void SetDefaultParentByPrimaryRootWindow(aura::Window* window) { - window->SetDefaultParentByRootWindow(root_window(), gfx::Rect()); - } - private: int max_separation_; @@ -480,7 +475,7 @@ TEST_F(WindowTest, HitTest) { w1.Init(ui::LAYER_TEXTURED); w1.SetBounds(gfx::Rect(10, 20, 50, 60)); w1.Show(); - SetDefaultParentByPrimaryRootWindow(&w1); + ParentWindow(&w1); // Points are in the Window's coordinates. EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1))); @@ -512,7 +507,7 @@ TEST_F(WindowTest, HitTestMask) { w1.Init(ui::LAYER_NOT_DRAWN); w1.SetBounds(gfx::Rect(10, 20, 50, 60)); w1.Show(); - SetDefaultParentByPrimaryRootWindow(&w1); + ParentWindow(&w1); // Points inside the mask. EXPECT_TRUE(w1.HitTest(gfx::Point(5, 6))); // top-left @@ -2645,7 +2640,7 @@ TEST_F(WindowTest, RootWindowAttachment) { w1->Init(ui::LAYER_NOT_DRAWN); w1->AddObserver(&observer); - SetDefaultParentByPrimaryRootWindow(w1.get()); + ParentWindow(w1.get()); EXPECT_EQ(1, observer.added_count()); EXPECT_EQ(0, observer.removed_count()); @@ -2665,7 +2660,7 @@ TEST_F(WindowTest, RootWindowAttachment) { EXPECT_EQ(0, observer.added_count()); EXPECT_EQ(0, observer.removed_count()); - SetDefaultParentByPrimaryRootWindow(w1.get()); + ParentWindow(w1.get()); EXPECT_EQ(1, observer.added_count()); EXPECT_EQ(0, observer.removed_count()); @@ -2691,7 +2686,7 @@ TEST_F(WindowTest, RootWindowAttachment) { EXPECT_EQ(0, observer.added_count()); EXPECT_EQ(0, observer.removed_count()); - SetDefaultParentByPrimaryRootWindow(w1.get()); + ParentWindow(w1.get()); EXPECT_EQ(2, observer.added_count()); EXPECT_EQ(0, observer.removed_count()); |