Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: ui/aura/window.cc

Issue 11421006: Desktop aura: Break aura::Window::SetParent in two. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add parent finding thing to web_contents_view_aura.cc. I guess it was necessary after all? Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 1626947ff0e4d1ce1a4467e89d6e17f8b353ed7b..cc9672bd7565bd8b6b33a904419ac8de0d71ba71 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -33,19 +33,6 @@
namespace aura {
-namespace {
-
-Window* GetParentForWindow(Window* window, Window* suggested_parent) {
- if (suggested_parent)
- return suggested_parent;
- if (client::GetStackingClient())
- return client::GetStackingClient()->GetDefaultParent(
- window, window, gfx::Rect());
- return NULL;
-}
-
-} // namespace
-
Window::TestApi::TestApi(Window* window) : window_(window) {}
bool Window::TestApi::OwnsLayer() const {
@@ -333,8 +320,22 @@ void Window::SetExternalTexture(ui::Texture* texture) {
WindowObserver, observers_, OnWindowPaintScheduled(this, region));
}
-void Window::SetParent(Window* parent) {
- GetParentForWindow(this, parent)->AddChild(this);
+void Window::SetParentTo(Window* parent) {
Ben Goodger (Google) 2012/11/20 23:46:38 Since you're renaming this method, can you just ge
+ DCHECK(parent);
+ parent->AddChild(this);
+}
+
+void Window::SetDefaultParentByTargetRoot(RootWindow* context_root) {
+ // TODO(erg): Enable this DCHECK once it is safe.
+ // DCHECK(context_root);
+
+ // Stacking clients are mandatory on RootWindow objects.
+ client::StackingClient* client = client::GetStackingClient(context_root);
+ DCHECK(client);
+
+ aura::Window* default_parent = client->GetDefaultParent(
+ context_root, this, gfx::Rect());
+ default_parent->AddChild(this);
}
void Window::StackChildAtTop(Window* child) {

Powered by Google App Engine
This is Rietveld 408576698