summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-23 20:44:37 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-23 20:44:37 +0000
commite3225e03e88436787f9e215a24ff5e1d70eeeb65 (patch)
tree5fb7d31be1e76201a49e23e86ccf39b1497c52e2
parent9e00f36137ed67399711010ede7c74315237515f (diff)
downloadchromium_src-e3225e03e88436787f9e215a24ff5e1d70eeeb65.zip
chromium_src-e3225e03e88436787f9e215a24ff5e1d70eeeb65.tar.gz
chromium_src-e3225e03e88436787f9e215a24ff5e1d70eeeb65.tar.bz2
Rename StackingClient -> WindowTreeClient
Remove SetDefaultParentForRootWindow from Window, and replace with new utility function ParentWindowForContext in window_tree_client.h This is part of my current campaign to slim down the aura Window types. I will eventually move WindowTreeClient to a new ui/wm component that I plan to create. R=erg@chromium.org http://crbug.com/308844 Review URL: https://codereview.chromium.org/36473003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230501 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/display/screen_position_controller.cc1
-rw-r--r--ash/display/screen_position_controller_unittest.cc2
-rw-r--r--ash/drag_drop/drag_drop_tracker.cc3
-rw-r--r--ash/root_window_controller.cc2
-rw-r--r--ash/root_window_controller_unittest.cc5
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc2
-rw-r--r--ash/shell/content_client/shell_browser_main_parts.cc1
-rw-r--r--ash/shell_unittest.cc2
-rw-r--r--ash/test/ash_test_base.cc11
-rw-r--r--ash/test/ash_test_base.h2
-rw-r--r--ash/wm/dock/docked_window_layout_manager.cc3
-rw-r--r--ash/wm/dock/docked_window_resizer.cc6
-rw-r--r--ash/wm/drag_window_resizer_unittest.cc14
-rw-r--r--ash/wm/header_painter_unittest.cc5
-rw-r--r--ash/wm/panels/panel_layout_manager.cc6
-rw-r--r--ash/wm/panels/panel_window_resizer.cc19
-rw-r--r--ash/wm/stacking_controller.cc2
-rw-r--r--ash/wm/stacking_controller.h6
-rw-r--r--ash/wm/stacking_controller_unittest.cc2
-rw-r--r--ash/wm/workspace/multi_window_resize_controller_unittest.cc2
-rw-r--r--ash/wm/workspace/workspace_event_handler_unittest.cc2
-rw-r--r--ash/wm/workspace/workspace_layout_manager_unittest.cc2
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc8
-rw-r--r--ash/wm/workspace_controller_unittest.cc22
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views.cc6
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc8
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc36
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc5
-rw-r--r--ui/aura/aura.gyp8
-rw-r--r--ui/aura/client/stacking_client.cc38
-rw-r--r--ui/aura/client/stacking_client.h50
-rw-r--r--ui/aura/client/window_tree_client.cc51
-rw-r--r--ui/aura/client/window_tree_client.h56
-rw-r--r--ui/aura/demo/demo_main.cc31
-rw-r--r--ui/aura/test/aura_test_base.cc13
-rw-r--r--ui/aura/test/aura_test_base.h5
-rw-r--r--ui/aura/test/aura_test_helper.cc4
-rw-r--r--ui/aura/test/aura_test_helper.h4
-rw-r--r--ui/aura/test/test_stacking_client.cc28
-rw-r--r--ui/aura/test/test_stacking_client.h36
-rw-r--r--ui/aura/test/test_window_tree_client.cc28
-rw-r--r--ui/aura/test/test_window_tree_client.h34
-rw-r--r--ui/aura/window.cc14
-rw-r--r--ui/aura/window.h7
-rw-r--r--ui/aura/window_unittest.cc17
-rw-r--r--ui/shell/minimal_shell.cc2
-rw-r--r--ui/shell/minimal_shell.h6
-rw-r--r--ui/views/corewm/shadow_controller_unittest.cc17
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc25
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.h4
-rw-r--r--ui/views/widget/native_widget_aura.cc12
-rw-r--r--ui/views/widget/widget_unittest.cc7
53 files changed, 351 insertions, 333 deletions
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index b416d38..60528ec 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -14,7 +14,6 @@
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/focus_client.h"
-#include "ui/aura/client/stacking_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window_tracker.h"
#include "ui/compositor/dip_util.h"
diff --git a/ash/display/screen_position_controller_unittest.cc b/ash/display/screen_position_controller_unittest.cc
index 680ee83..2cd6133 100644
--- a/ash/display/screen_position_controller_unittest.cc
+++ b/ash/display/screen_position_controller_unittest.cc
@@ -56,7 +56,7 @@ class ScreenPositionControllerTest : public test::AshTestBase {
window_.reset(new aura::Window(&window_delegate_));
window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(window_.get());
+ ParentWindowInPrimaryRootWindow(window_.get());
window_->set_id(1);
}
diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc
index 4fd1de8..f18e0e8 100644
--- a/ash/drag_drop/drag_drop_tracker.cc
+++ b/ash/drag_drop/drag_drop_tracker.cc
@@ -7,6 +7,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/events/event.h"
#include "ui/gfx/screen.h"
@@ -22,7 +23,7 @@ aura::Window* CreateCaptureWindow(aura::RootWindow* context_root,
aura::Window* window = new aura::Window(delegate);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_NOT_DRAWN);
- window->SetDefaultParentByRootWindow(context_root, gfx::Rect());
+ aura::client::ParentWindowWithContext(window, context_root, gfx::Rect());
window->Show();
DCHECK(window->bounds().size().IsEmpty());
return window;
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 946e1e3..0349ab8 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -565,7 +565,7 @@ RootWindowController::RootWindowController(aura::RootWindow* root_window)
screen_dimmer_.reset(new ScreenDimmer(root_window));
stacking_controller_.reset(new StackingController);
- aura::client::SetStackingClient(root_window, stacking_controller_.get());
+ aura::client::SetWindowTreeClient(root_window, stacking_controller_.get());
capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window));
}
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 70d9146..1de918c 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -17,6 +17,7 @@
#include "base/command_line.h"
#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/client/focus_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/event_generator.h"
@@ -573,8 +574,8 @@ TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) {
window1->set_owned_by_parent(false);
observer1.SetWindow(window1);
window1->Init(ui::LAYER_NOT_DRAWN);
- window1->SetDefaultParentByRootWindow(
- Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(
+ window1, Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect());
DestroyedWindowObserver observer2;
aura::Window* window2 = new aura::Window(NULL);
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 93dfc57..9795e0e 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -347,7 +347,7 @@ class ShelfLayoutManagerTest : public ash::test::AshTestBase {
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window);
+ ParentWindowInPrimaryRootWindow(window);
return window;
}
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc
index 46575ae..f8eb434 100644
--- a/ash/shell/content_client/shell_browser_main_parts.cc
+++ b/ash/shell/content_client/shell_browser_main_parts.cc
@@ -21,7 +21,6 @@
#include "content/shell/browser/shell_browser_context.h"
#include "content/shell/browser/shell_net_log.h"
#include "net/base/net_module.h"
-#include "ui/aura/client/stacking_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index 79c64f9b..994f456 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -477,7 +477,7 @@ TEST_F(ShellTest, ToggleAutoHide) {
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window.get());
+ ParentWindowInPrimaryRootWindow(window.get());
window->Show();
wm::ActivateWindow(window.get());
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index dcbc747..b6c10a4 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -20,6 +20,7 @@
#include "content/public/test/web_contents_tester.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_window_delegate.h"
@@ -249,7 +250,7 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType(
window->Show();
if (bounds.IsEmpty()) {
- SetDefaultParentByPrimaryRootWindow(window);
+ ParentWindowInPrimaryRootWindow(window);
} else {
gfx::Display display =
Shell::GetScreen()->GetDisplayMatching(bounds);
@@ -258,15 +259,15 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType(
gfx::Point origin = bounds.origin();
wm::ConvertPointFromScreen(root, &origin);
window->SetBounds(gfx::Rect(origin, bounds.size()));
- window->SetDefaultParentByRootWindow(root, bounds);
+ aura::client::ParentWindowWithContext(window, root, bounds);
}
window->SetProperty(aura::client::kCanMaximizeKey, true);
return window;
}
-void AshTestBase::SetDefaultParentByPrimaryRootWindow(aura::Window* window) {
- window->SetDefaultParentByRootWindow(
- Shell::GetPrimaryRootWindow(), gfx::Rect());
+void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) {
+ aura::client::ParentWindowWithContext(
+ window, Shell::GetPrimaryRootWindow(), gfx::Rect());
}
void AshTestBase::RunAllPendingInMessageLoop() {
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index 281073e..dc2bfe4 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -87,7 +87,7 @@ class AshTestBase : public testing::Test {
const gfx::Rect& bounds);
// Attach |window| to the current shell's root window.
- void SetDefaultParentByPrimaryRootWindow(aura::Window* window);
+ void ParentWindowInPrimaryRootWindow(aura::Window* window);
// Returns the EventGenerator that uses screen coordinates and works
// across multiple displays. It createse a new generator if it
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index e30a94b..f5f5028 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -23,6 +23,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/focus_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
@@ -111,7 +112,7 @@ void UndockWindow(aura::Window* window) {
window->layer()->GetAnimator()->StopAnimating();
gfx::Rect previous_bounds = window->bounds();
aura::Window* previous_parent = window->parent();
- window->SetDefaultParentByRootWindow(window->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(window, window, gfx::Rect());
if (window->parent() != previous_parent)
wm::ReparentTransientChildrenOfChild(window->parent(), window);
// Animate maximize animation from previous window bounds.
diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc
index 218391a..f900818 100644
--- a/ash/wm/dock/docked_window_resizer.cc
+++ b/ash/wm/dock/docked_window_resizer.cc
@@ -22,6 +22,7 @@
#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -270,7 +271,7 @@ void DockedWindowResizer::FinishedDragging() {
wm::ReparentChildWithTransientChildren(dock_container, window);
} else if (window->parent()->id() == kShellWindowId_DockedContainer) {
// Reparent the window back to workspace.
- // We need to be careful to give SetDefaultParentByRootWindow location in
+ // We need to be careful to give ParentWindowWithContext a location in
// the right root window (matching the logic in DragWindowResizer) based
// on which root window a mouse pointer is in. We want to undock into the
// right screen near the edge of a multiscreen setup (based on where the
@@ -278,8 +279,7 @@ void DockedWindowResizer::FinishedDragging() {
gfx::Rect near_last_location(last_location_, gfx::Size());
// Reparenting will cause Relayout and possible dock shrinking.
aura::Window* previous_parent = window->parent();
- window->SetDefaultParentByRootWindow(window->GetRootWindow(),
- near_last_location);
+ aura::client::ParentWindowWithContext(window, window, near_last_location);
if (window->parent() != previous_parent)
wm::ReparentTransientChildrenOfChild(window->parent(), window);
}
diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc
index a17f9b5..5be8a78 100644
--- a/ash/wm/drag_window_resizer_unittest.cc
+++ b/ash/wm/drag_window_resizer_unittest.cc
@@ -48,14 +48,14 @@ class DragWindowResizerTest : public test::AshTestBase {
window_.reset(new aura::Window(&delegate_));
window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(window_.get());
+ ParentWindowInPrimaryRootWindow(window_.get());
window_->set_id(1);
always_on_top_window_.reset(new aura::Window(&delegate2_));
always_on_top_window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true);
always_on_top_window_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(always_on_top_window_.get());
+ ParentWindowInPrimaryRootWindow(always_on_top_window_.get());
always_on_top_window_->set_id(2);
system_modal_window_.reset(new aura::Window(&delegate3_));
@@ -63,26 +63,26 @@ class DragWindowResizerTest : public test::AshTestBase {
system_modal_window_->SetProperty(aura::client::kModalKey,
ui::MODAL_TYPE_SYSTEM);
system_modal_window_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(system_modal_window_.get());
+ ParentWindowInPrimaryRootWindow(system_modal_window_.get());
system_modal_window_->set_id(3);
transient_child_ = new aura::Window(&delegate4_);
transient_child_->SetType(aura::client::WINDOW_TYPE_NORMAL);
transient_child_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(transient_child_);
+ ParentWindowInPrimaryRootWindow(transient_child_);
transient_child_->set_id(4);
transient_parent_.reset(new aura::Window(&delegate5_));
transient_parent_->SetType(aura::client::WINDOW_TYPE_NORMAL);
transient_parent_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(transient_parent_.get());
+ ParentWindowInPrimaryRootWindow(transient_parent_.get());
transient_parent_->AddTransientChild(transient_child_);
transient_parent_->set_id(5);
panel_window_.reset(new aura::Window(&delegate6_));
panel_window_->SetType(aura::client::WINDOW_TYPE_PANEL);
panel_window_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(panel_window_.get());
+ ParentWindowInPrimaryRootWindow(panel_window_.get());
}
virtual void TearDown() OVERRIDE {
@@ -227,7 +227,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysActiveRoot) {
scoped_ptr<aura::Window> window(new aura::Window(&delegate));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window.get());
+ ParentWindowInPrimaryRootWindow(window.get());
window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
Shell::GetScreen()->GetPrimaryDisplay());
window->Show();
diff --git a/ash/wm/header_painter_unittest.cc b/ash/wm/header_painter_unittest.cc
index 4691911..a6e8515 100644
--- a/ash/wm/header_painter_unittest.cc
+++ b/ash/wm/header_painter_unittest.cc
@@ -17,6 +17,7 @@
#include "grit/ash_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window_observer.h"
#include "ui/base/hit_test.h"
@@ -395,8 +396,8 @@ TEST_F(HeaderPainterTest, UseSoloWindowHeaderNotDrawn) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_NOT_DRAWN);
- window->SetDefaultParentByRootWindow(
- widget->GetNativeWindow()->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(window.get(), widget->GetNativeWindow(),
+ gfx::Rect());
window->Show();
// Despite two windows, the first window should still be considered "solo"
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index c646679..56d8e5a 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -25,6 +25,7 @@
#include "third_party/skia/include/core/SkPath.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/focus_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
@@ -352,9 +353,8 @@ void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
// back to appropriate container and ignore it.
// TODO(varkha): Updating bounds during a drag can cause problems and a more
// general solution is needed. See http://crbug.com/251813 .
- child->SetDefaultParentByRootWindow(
- child->GetRootWindow(),
- child->GetRootWindow()->GetBoundsInScreen());
+ aura::client::ParentWindowWithContext(
+ child, child, child->GetRootWindow()->GetBoundsInScreen());
wm::ReparentTransientChildrenOfChild(child->parent(), child);
DCHECK(child->parent()->id() != kShellWindowId_PanelContainer);
return;
diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc
index 03a69f0..49b356c 100644
--- a/ash/wm/panels/panel_window_resizer.cc
+++ b/ash/wm/panels/panel_window_resizer.cc
@@ -17,6 +17,7 @@
#include "ash/wm/window_util.h"
#include "base/memory/weak_ptr.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -195,10 +196,11 @@ void PanelWindowResizer::StartedDragging() {
wm::GetWindowState(GetTarget())->set_panel_attached(true);
// We use root window coordinates to ensure that during the drag the panel
// is reparented to a container in the root window that has that window.
- GetTarget()->SetDefaultParentByRootWindow(
- GetTarget()->GetRootWindow(),
- GetTarget()->GetRootWindow()->GetBoundsInScreen());
- wm::ReparentTransientChildrenOfChild(GetTarget()->parent(), GetTarget());
+ aura::Window* target = GetTarget();
+ aura::RootWindow* target_root = target->GetRootWindow();
+ aura::client::ParentWindowWithContext(
+ target, target_root, target_root->GetBoundsInScreen());
+ wm::ReparentTransientChildrenOfChild(target->parent(), target);
}
}
@@ -209,10 +211,11 @@ void PanelWindowResizer::FinishDragging() {
wm::GetWindowState(GetTarget())->set_panel_attached(should_attach_);
// We use last known location to ensure that after the drag the panel
// is reparented to a container in the root window that has that location.
- GetTarget()->SetDefaultParentByRootWindow(
- GetTarget()->GetRootWindow(),
- gfx::Rect(last_location_, gfx::Size()));
- wm::ReparentTransientChildrenOfChild(GetTarget()->parent(), GetTarget());
+ aura::Window* target = GetTarget();
+ aura::RootWindow* target_root = target->GetRootWindow();
+ aura::client::ParentWindowWithContext(
+ target, target_root, gfx::Rect(last_location_, gfx::Size()));
+ wm::ReparentTransientChildrenOfChild(target->parent(), GetTarget());
}
// If we started the drag in one root window and moved into another root
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 0d23d69..7b211a3 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -67,7 +67,7 @@ StackingController::~StackingController() {
}
////////////////////////////////////////////////////////////////////////////////
-// StackingController, aura::StackingClient implementation:
+// StackingController, aura::client::WindowTreeClient implementation:
aura::Window* StackingController::GetDefaultParent(aura::Window* context,
aura::Window* window,
diff --git a/ash/wm/stacking_controller.h b/ash/wm/stacking_controller.h
index 07003cb..0aa690e 100644
--- a/ash/wm/stacking_controller.h
+++ b/ash/wm/stacking_controller.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/stacking_client.h"
+#include "ui/aura/client/window_tree_client.h"
namespace aura{
class RootWindow;
@@ -21,12 +21,12 @@ namespace internal {
class AlwaysOnTopController;
}
-class ASH_EXPORT StackingController : public aura::client::StackingClient {
+class ASH_EXPORT StackingController : public aura::client::WindowTreeClient {
public:
StackingController();
virtual ~StackingController();
- // 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;
diff --git a/ash/wm/stacking_controller_unittest.cc b/ash/wm/stacking_controller_unittest.cc
index b7b1f1b..e0ccaa1 100644
--- a/ash/wm/stacking_controller_unittest.cc
+++ b/ash/wm/stacking_controller_unittest.cc
@@ -50,7 +50,7 @@ TEST_F(StackingControllerTest, TransientParent) {
scoped_ptr<Window> w1(CreateTestWindow());
w2->AddTransientChild(w1.get());
w1->SetBounds(gfx::Rect(10, 11, 250, 251));
- SetDefaultParentByPrimaryRootWindow(w1.get());
+ ParentWindowInPrimaryRootWindow(w1.get());
w1->Show();
wm::ActivateWindow(w1.get());
diff --git a/ash/wm/workspace/multi_window_resize_controller_unittest.cc b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
index 9a3d43c..a4756aa 100644
--- a/ash/wm/workspace/multi_window_resize_controller_unittest.cc
+++ b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
@@ -42,7 +42,7 @@ class MultiWindowResizeControllerTest : public test::AshTestBase {
aura::Window* window = new aura::Window(delegate);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window);
+ ParentWindowInPrimaryRootWindow(window);
window->SetBounds(bounds);
window->Show();
return window;
diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc
index 843d136..61d55bd 100644
--- a/ash/wm/workspace/workspace_event_handler_unittest.cc
+++ b/ash/wm/workspace/workspace_event_handler_unittest.cc
@@ -37,7 +37,7 @@ class WorkspaceEventHandlerTest : public test::AshTestBase {
aura::Window* window = new aura::Window(delegate);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window);
+ ParentWindowInPrimaryRootWindow(window);
window->SetBounds(bounds);
window->Show();
return window;
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 6194f1c..f735e0c 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -287,7 +287,7 @@ TEST_F(WorkspaceLayoutManagerTest, DontClobberRestoreBounds) {
// NOTE: for this test to exercise the failure the observer needs to be added
// before the parent set. This mimics what BrowserFrameAsh does.
window->AddObserver(&window_observer);
- SetDefaultParentByPrimaryRootWindow(window.get());
+ ParentWindowInPrimaryRootWindow(window.get());
window->Show();
wm::WindowState* window_state = wm::GetWindowState(window.get());
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 9d6969b..f3efaa52 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -119,25 +119,25 @@ class WorkspaceWindowResizerTest : public test::AshTestBase {
window_.reset(new aura::Window(&delegate_));
window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(window_.get());
+ ParentWindowInPrimaryRootWindow(window_.get());
window_->set_id(1);
window2_.reset(new aura::Window(&delegate2_));
window2_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window2_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(window2_.get());
+ ParentWindowInPrimaryRootWindow(window2_.get());
window2_->set_id(2);
window3_.reset(new aura::Window(&delegate3_));
window3_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window3_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(window3_.get());
+ ParentWindowInPrimaryRootWindow(window3_.get());
window3_->set_id(3);
window4_.reset(new aura::Window(&delegate4_));
window4_->SetType(aura::client::WINDOW_TYPE_NORMAL);
window4_->Init(ui::LAYER_NOT_DRAWN);
- SetDefaultParentByPrimaryRootWindow(window4_.get());
+ ParentWindowInPrimaryRootWindow(window4_.get());
window4_->set_id(4);
}
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index ecb8248..14ecd84 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -95,7 +95,7 @@ class WorkspaceControllerTest : public test::AshTestBase {
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window);
+ ParentWindowInPrimaryRootWindow(window);
return window;
}
@@ -241,7 +241,7 @@ TEST_F(WorkspaceControllerTest, ChangeBoundsOfNormalWindow) {
TEST_F(WorkspaceControllerTest, SnapToGrid) {
scoped_ptr<Window> w1(CreateTestWindowUnparented());
w1->SetBounds(gfx::Rect(1, 6, 25, 30));
- SetDefaultParentByPrimaryRootWindow(w1.get());
+ ParentWindowInPrimaryRootWindow(w1.get());
// We are not aligning this anymore this way. When the window gets shown
// the window is expected to be handled differently, but this cannot be
// tested with this test. So the result of this test should be that the
@@ -661,7 +661,7 @@ TEST_F(WorkspaceControllerTest, DontCrashOnChangeAndActivate) {
// window active.
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- SetDefaultParentByPrimaryRootWindow(w1.get());
+ ParentWindowInPrimaryRootWindow(w1.get());
delegate.set_window(w1.get());
w1->Show();
}
@@ -679,7 +679,7 @@ TEST_F(WorkspaceControllerTest, TransientParent) {
scoped_ptr<Window> w1(CreateTestWindowUnparented());
Shell::GetInstance()->GetPrimaryRootWindow()->AddTransientChild(w1.get());
w1->SetBounds(gfx::Rect(10, 11, 250, 251));
- SetDefaultParentByPrimaryRootWindow(w1.get());
+ ParentWindowInPrimaryRootWindow(w1.get());
w1->Show();
wm::ActivateWindow(w1.get());
@@ -703,7 +703,7 @@ TEST_F(WorkspaceControllerTest, TrackedByWorkspace) {
scoped_ptr<Window> w2(CreateTestWindowUnparented());
w2->SetBounds(gfx::Rect(1, 6, 25, 30));
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- SetDefaultParentByPrimaryRootWindow(w2.get());
+ ParentWindowInPrimaryRootWindow(w2.get());
w2->Show();
wm::GetWindowState(w2.get())->SetTrackedByWorkspace(false);
wm::ActivateWindow(w2.get());
@@ -1163,7 +1163,7 @@ TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) {
gfx::Rect(5, 6, 7, 8),
NULL));
browser->SetName("browser");
- SetDefaultParentByPrimaryRootWindow(browser.get());
+ ParentWindowInPrimaryRootWindow(browser.get());
browser->Show();
wm::ActivateWindow(browser.get());
@@ -1179,7 +1179,7 @@ TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) {
gfx::Rect(5, 6, 7, 8),
NULL);
browser->AddTransientChild(status_bubble);
- SetDefaultParentByPrimaryRootWindow(status_bubble);
+ ParentWindowInPrimaryRootWindow(status_bubble);
status_bubble->SetName("status_bubble");
scoped_ptr<Window> app(
@@ -1189,7 +1189,7 @@ TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) {
gfx::Rect(5, 6, 7, 8),
NULL));
app->SetName("app");
- SetDefaultParentByPrimaryRootWindow(app.get());
+ ParentWindowInPrimaryRootWindow(app.get());
aura::Window* parent = browser->parent();
@@ -1282,7 +1282,7 @@ TEST_F(WorkspaceControllerTest, DragFullscreenNonTrackedWindow) {
aura::client::WINDOW_TYPE_NORMAL,
gfx::Rect(5, 6, 7, 8),
NULL));
- SetDefaultParentByPrimaryRootWindow(w1.get());
+ ParentWindowInPrimaryRootWindow(w1.get());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
w1->Show();
wm::ActivateWindow(w1.get());
@@ -1331,7 +1331,7 @@ TEST_F(WorkspaceControllerTest, DragMaximizedNonTrackedWindow) {
aura::client::WINDOW_TYPE_NORMAL,
gfx::Rect(5, 6, 7, 8),
NULL));
- SetDefaultParentByPrimaryRootWindow(w1.get());
+ ParentWindowInPrimaryRootWindow(w1.get());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->Show();
wm::ActivateWindow(w1.get());
@@ -1373,7 +1373,7 @@ TEST_F(WorkspaceControllerTest, SwitchFromModal) {
scoped_ptr<Window> modal_window(CreateTestWindowUnparented());
modal_window->SetBounds(gfx::Rect(10, 11, 21, 22));
modal_window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM);
- SetDefaultParentByPrimaryRootWindow(modal_window.get());
+ ParentWindowInPrimaryRootWindow(modal_window.get());
modal_window->Show();
wm::ActivateWindow(modal_window.get());
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
index 304abda..215eae9 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -48,6 +48,7 @@
#include "ash/wm/window_state.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#endif
@@ -290,8 +291,9 @@ void NativeAppWindowViews::InitializePanelWindow(
preferred_size_.height());
aura::Window* native_window = GetNativeWindow();
ash::wm::GetWindowState(native_window)->set_panel_attached(false);
- native_window->SetDefaultParentByRootWindow(
- native_window->GetRootWindow(), native_window->GetBoundsInScreen());
+ aura::client::ParentWindowWithContext(native_window,
+ native_window->GetRootWindow(),
+ native_window->GetBoundsInScreen());
window_->SetBounds(window_bounds);
}
#else
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index f658bf2..3e6219b 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -243,7 +243,7 @@ void ChromeViewsDelegate::OnBeforeWidgetInit(
params->context = ash::Shell::GetPrimaryRootWindow();
#elif defined(USE_AURA)
// While the majority of the time, context wasn't plumbed through due to the
- // existence of a global StackingClient, if this window is a toplevel, it's
+ // existence of a global WindowTreeClient, if this window is a toplevel, it's
// possible that there is no contextual state that we can use.
if (params->parent == NULL && params->context == NULL && params->top_level) {
// We need to make a decision about where to place this window based on the
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index dab846d..f5fcf85 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -53,8 +53,8 @@
#include "ui/aura/client/cursor_client_observer.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/tooltip_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
@@ -646,9 +646,9 @@ void RenderWidgetHostViewAura::InitAsPopup(
window_->SetName("RenderWidgetHostViewAura");
aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow();
- window_->SetDefaultParentByRootWindow(root, bounds_in_screen);
+ aura::client::ParentWindowWithContext(window_, root, bounds_in_screen);
- // TODO(erg): While I could make sure details of the StackingClient are
+ // TODO(erg): While I could make sure details of the WindowTreeClient are
// hidden behind aura, hiding the details of the ScreenPositionClient will
// take another effort.
aura::client::ScreenPositionClient* screen_position_client =
@@ -684,7 +684,7 @@ void RenderWidgetHostViewAura::InitAsFullscreen(
parent = reference_window->GetRootWindow();
bounds = display.bounds();
}
- window_->SetDefaultParentByRootWindow(parent, bounds);
+ aura::client::ParentWindowWithContext(window_, parent, bounds);
Show();
Focus();
}
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 eb197d6..df3bd29 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
@@ -25,6 +25,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/env.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/root_window.h"
@@ -136,8 +137,9 @@ class RenderWidgetHostViewAuraTest : public testing::Test {
parent_view_ = static_cast<RenderWidgetHostViewAura*>(
RenderWidgetHostView::CreateViewForWidget(parent_host_));
parent_view_->InitAsChild(NULL);
- parent_view_->GetNativeView()->SetDefaultParentByRootWindow(
- aura_test_helper_->root_window(), gfx::Rect());
+ aura::client::ParentWindowWithContext(parent_view_->GetNativeView(),
+ aura_test_helper_->root_window(),
+ gfx::Rect());
widget_host_ = new RenderWidgetHostImpl(
&delegate_, process_host, MSG_ROUTING_NONE, false);
@@ -465,8 +467,10 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) {
TEST_F(RenderWidgetHostViewAuraTest, PhysicalBackingSizeWithScale) {
view_->InitAsChild(NULL);
- view_->GetNativeView()->SetDefaultParentByRootWindow(
- parent_view_->GetNativeView()->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(
+ view_->GetNativeView(),
+ parent_view_->GetNativeView()->GetRootWindow(),
+ gfx::Rect());
sink_->ClearMessages();
view_->SetSize(gfx::Size(100, 100));
EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString());
@@ -523,8 +527,10 @@ TEST_F(RenderWidgetHostViewAuraTest, PhysicalBackingSizeWithScale) {
// to the renderer at the correct times.
TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) {
view_->InitAsChild(NULL);
- view_->GetNativeView()->SetDefaultParentByRootWindow(
- parent_view_->GetNativeView()->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(
+ view_->GetNativeView(),
+ parent_view_->GetNativeView()->GetRootWindow(),
+ gfx::Rect());
view_->SetSize(gfx::Size(100, 100));
aura::test::TestCursorClient cursor_client(
@@ -699,8 +705,10 @@ TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) {
gfx::Rect view_rect(view_size);
view_->InitAsChild(NULL);
- view_->GetNativeView()->SetDefaultParentByRootWindow(
- parent_view_->GetNativeView()->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(
+ view_->GetNativeView(),
+ parent_view_->GetNativeView()->GetRootWindow(),
+ gfx::Rect());
view_->SetSize(view_size);
view_->WasShown();
@@ -787,8 +795,10 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) {
gfx::Size frame_size = view_rect.size();
view_->InitAsChild(NULL);
- view_->GetNativeView()->SetDefaultParentByRootWindow(
- parent_view_->GetNativeView()->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(
+ view_->GetNativeView(),
+ parent_view_->GetNativeView()->GetRootWindow(),
+ gfx::Rect());
view_->SetSize(view_rect.size());
MockWindowObserver observer;
@@ -858,8 +868,10 @@ TEST_F(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange) {
gfx::Size frame_size = view_rect.size();
view_->InitAsChild(NULL);
- view_->GetNativeView()->SetDefaultParentByRootWindow(
- parent_view_->GetNativeView()->GetRootWindow(), gfx::Rect());
+ aura::client::ParentWindowWithContext(
+ view_->GetNativeView(),
+ parent_view_->GetNativeView()->GetRootWindow(),
+ gfx::Rect());
view_->SetSize(view_rect.size());
MockWindowObserver observer;
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 079ed23..71f4f72 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -40,6 +40,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/root_window_observer.h"
@@ -1156,8 +1157,8 @@ void WebContentsViewAura::CreateView(
// explicitly add this WebContentsViewAura to their tree after they create
// us.
if (root_window) {
- window_->SetDefaultParentByRootWindow(
- root_window, root_window->GetBoundsInScreen());
+ aura::client::ParentWindowWithContext(
+ window_.get(), root_window, root_window->GetBoundsInScreen());
}
}
window_->layer()->SetMasksToBounds(true);
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());
diff --git a/ui/shell/minimal_shell.cc b/ui/shell/minimal_shell.cc
index 556c16e..3e01ef6 100644
--- a/ui/shell/minimal_shell.cc
+++ b/ui/shell/minimal_shell.cc
@@ -20,7 +20,7 @@ MinimalShell::MinimalShell(const gfx::Size& default_window_size) {
aura::RootWindow::CreateParams(
gfx::Rect(default_window_size))));
root_window_->Init();
- aura::client::SetStackingClient(root_window_.get(), this);
+ aura::client::SetWindowTreeClient(root_window_.get(), this);
focus_client_.reset(new aura::test::TestFocusClient);
aura::client::SetFocusClient(root_window_.get(), focus_client_.get());
diff --git a/ui/shell/minimal_shell.h b/ui/shell/minimal_shell.h
index f8ae67b..22c160b 100644
--- a/ui/shell/minimal_shell.h
+++ b/ui/shell/minimal_shell.h
@@ -7,7 +7,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/stacking_client.h"
+#include "ui/aura/client/window_tree_client.h"
namespace aura {
class RootWindow;
@@ -36,14 +36,14 @@ namespace shell {
// Creates a minimal environment for running the shell. We can't pull in all of
// ash here, but we can create attach several of the same things we'd find in
// the ash parts of the code.
-class MinimalShell : public aura::client::StackingClient {
+class MinimalShell : public aura::client::WindowTreeClient {
public:
explicit MinimalShell(const gfx::Size& default_window_size);
virtual ~MinimalShell();
aura::RootWindow* root_window() { return root_window_.get(); }
- // Overridden from client::StackingClient:
+ // Overridden from client::WindowTreeClient:
virtual aura::Window* GetDefaultParent(aura::Window* context,
aura::Window* window,
const gfx::Rect& bounds) OVERRIDE;
diff --git a/ui/views/corewm/shadow_controller_unittest.cc b/ui/views/corewm/shadow_controller_unittest.cc
index acfb324..4140f7d 100644
--- a/ui/views/corewm/shadow_controller_unittest.cc
+++ b/ui/views/corewm/shadow_controller_unittest.cc
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/activation_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/window.h"
@@ -56,7 +57,7 @@ TEST_F(ShadowControllerTest, Shadow) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window.get());
+ ParentWindow(window.get());
// We should create the shadow before the window is visible (the shadow's
// layer won't get drawn yet since it's a child of the window's layer).
@@ -92,7 +93,7 @@ TEST_F(ShadowControllerTest, ShadowBounds) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window.get());
+ ParentWindow(window.get());
window->Show();
const gfx::Rect kOldBounds(20, 30, 400, 300);
@@ -121,7 +122,7 @@ TEST_F(ShadowControllerTest, ShadowStyle) {
scoped_ptr<aura::Window> window1(new aura::Window(NULL));
window1->SetType(aura::client::WINDOW_TYPE_NORMAL);
window1->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window1.get());
+ ParentWindow(window1.get());
window1->SetBounds(gfx::Rect(10, 20, 300, 400));
window1->Show();
ActivateWindow(window1.get());
@@ -135,7 +136,7 @@ TEST_F(ShadowControllerTest, ShadowStyle) {
scoped_ptr<aura::Window> window2(new aura::Window(NULL));
window2->SetType(aura::client::WINDOW_TYPE_NORMAL);
window2->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window2.get());
+ ParentWindow(window2.get());
window2->SetBounds(gfx::Rect(11, 21, 301, 401));
window2->Show();
ActivateWindow(window2.get());
@@ -154,7 +155,7 @@ TEST_F(ShadowControllerTest, SmallShadowsForTooltipsAndMenus) {
scoped_ptr<aura::Window> tooltip_window(new aura::Window(NULL));
tooltip_window->SetType(aura::client::WINDOW_TYPE_TOOLTIP);
tooltip_window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(tooltip_window.get());
+ ParentWindow(tooltip_window.get());
tooltip_window->SetBounds(gfx::Rect(10, 20, 300, 400));
tooltip_window->Show();
@@ -165,7 +166,7 @@ TEST_F(ShadowControllerTest, SmallShadowsForTooltipsAndMenus) {
scoped_ptr<aura::Window> menu_window(new aura::Window(NULL));
menu_window->SetType(aura::client::WINDOW_TYPE_MENU);
menu_window->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(menu_window.get());
+ ParentWindow(menu_window.get());
menu_window->SetBounds(gfx::Rect(10, 20, 300, 400));
menu_window->Show();
@@ -182,7 +183,7 @@ TEST_F(ShadowControllerTest, TransientParentKeepsActiveShadow) {
scoped_ptr<aura::Window> window1(new aura::Window(NULL));
window1->SetType(aura::client::WINDOW_TYPE_NORMAL);
window1->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window1.get());
+ ParentWindow(window1.get());
window1->SetBounds(gfx::Rect(10, 20, 300, 400));
window1->Show();
ActivateWindow(window1.get());
@@ -198,7 +199,7 @@ TEST_F(ShadowControllerTest, TransientParentKeepsActiveShadow) {
scoped_ptr<aura::Window> window2(new aura::Window(NULL));
window2->SetType(aura::client::WINDOW_TYPE_NORMAL);
window2->Init(ui::LAYER_TEXTURED);
- SetDefaultParentByPrimaryRootWindow(window2.get());
+ ParentWindow(window2.get());
window2->SetBounds(gfx::Rect(11, 21, 301, 401));
window1->AddTransientChild(window2.get());
aura::client::SetHideOnDeactivate(window2.get(), true);
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 f912a67..8726248 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -9,7 +9,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/focus_client.h"
-#include "ui/aura/client/stacking_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/root_window_host.h"
#include "ui/aura/window.h"
@@ -132,18 +132,19 @@ class DesktopNativeWidgetTopLevelHandler : public aura::WindowObserver {
DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetTopLevelHandler);
};
-class DesktopNativeWidgetAuraStackingClient :
- public aura::client::StackingClient {
+class DesktopNativeWidgetAuraWindowTreeClient :
+ public aura::client::WindowTreeClient {
public:
- explicit DesktopNativeWidgetAuraStackingClient(aura::RootWindow* root_window)
+ explicit DesktopNativeWidgetAuraWindowTreeClient(
+ aura::RootWindow* root_window)
: root_window_(root_window) {
- aura::client::SetStackingClient(root_window_, this);
+ aura::client::SetWindowTreeClient(root_window_, this);
}
- virtual ~DesktopNativeWidgetAuraStackingClient() {
- aura::client::SetStackingClient(root_window_, NULL);
+ virtual ~DesktopNativeWidgetAuraWindowTreeClient() {
+ aura::client::SetWindowTreeClient(root_window_, NULL);
}
- // Overridden from client::StackingClient:
+ // Overridden from client::WindowTreeClient:
virtual aura::Window* GetDefaultParent(aura::Window* context,
aura::Window* window,
const gfx::Rect& bounds) OVERRIDE {
@@ -166,7 +167,7 @@ class DesktopNativeWidgetAuraStackingClient :
private:
aura::RootWindow* root_window_;
- DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAuraStackingClient);
+ DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAuraWindowTreeClient);
};
} // namespace
@@ -232,7 +233,7 @@ void DesktopNativeWidgetAura::OnHostClosed() {
root_window_event_filter_->RemoveHandler(input_method_event_filter_.get());
- stacking_client_.reset(); // Uses root_window_ at destruction.
+ window_tree_client_.reset(); // Uses root_window_ at destruction.
capture_client_.reset(); // Uses root_window_ at destruction.
@@ -352,8 +353,8 @@ void DesktopNativeWidgetAura::InitNativeWidget(
root_window_->AddRootWindowObserver(this);
- stacking_client_.reset(
- new DesktopNativeWidgetAuraStackingClient(root_window_.get()));
+ window_tree_client_.reset(
+ new DesktopNativeWidgetAuraWindowTreeClient(root_window_.get()));
drop_helper_.reset(new DropHelper(
static_cast<internal::RootView*>(GetWidget()->GetRootView())));
aura::client::SetDragDropDelegate(content_window_, this);
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 c07ede9..6c484ef 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -19,7 +19,7 @@
namespace aura {
class RootWindow;
namespace client {
-class StackingClient;
+class WindowTreeClient;
}
}
@@ -258,7 +258,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
internal::NativeWidgetDelegate* native_widget_delegate_;
- scoped_ptr<aura::client::StackingClient> stacking_client_;
+ scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
// Toplevel event filter which dispatches to other event filters.
corewm::CompoundEventFilter* root_window_event_filter_;
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index cfba08a..8366092 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -13,8 +13,8 @@
#include "ui/aura/client/drag_drop_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/window_move_client.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
@@ -152,8 +152,8 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
if (parent) {
parent->AddChild(window_);
} else {
- window_->SetDefaultParentByRootWindow(context->GetRootWindow(),
- window_bounds);
+ aura::client::ParentWindowWithContext(
+ window_, context->GetRootWindow(), window_bounds);
}
// Wait to set the bounds until we have a parent. That way we can know our
@@ -1109,7 +1109,7 @@ void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
} else {
// The following looks weird, but it's the equivalent of what aura has
// always done. (The previous behaviour of aura::Window::SetParent() used
- // NULL as a special value that meant ask the StackingClient where things
+ // NULL as a special value that meant ask the WindowTreeClient where things
// should go.)
//
// This probably isn't strictly correct, but its an invariant that a Window
@@ -1119,8 +1119,8 @@ void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
// matches our previous behaviour; the global stacking client would almost
// always reattach the window to the same RootWindow.
aura::RootWindow* root_window = native_view->GetRootWindow();
- native_view->SetDefaultParentByRootWindow(
- root_window, root_window->GetBoundsInScreen());
+ aura::client::ParentWindowWithContext(
+ native_view, root_window, root_window->GetBoundsInScreen());
}
// And now, notify them that they have a brand new parent.
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index bb6c00f..dcc4f0d 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -27,6 +27,7 @@
#if defined(USE_AURA)
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
@@ -1142,8 +1143,10 @@ class DesktopAuraTopLevelWindowTest
owned_window_->SetType(aura::client::WINDOW_TYPE_MENU);
}
owned_window_->Init(ui::LAYER_TEXTURED);
- owned_window_->SetDefaultParentByRootWindow(
- widget_.GetNativeView()->GetRootWindow(), gfx::Rect(0, 0, 1900, 1600));
+ aura::client::ParentWindowWithContext(
+ owned_window_,
+ widget_.GetNativeView()->GetRootWindow(),
+ gfx::Rect(0, 0, 1900, 1600));
owned_window_->Show();
owned_window_->AddObserver(this);