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

Unified Diff: ui/aura/window.cc

Issue 10854124: Revert 151293 - Makes Window not change focus and send out notifications when moving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
===================================================================
--- ui/aura/window.cc (revision 151297)
+++ ui/aura/window.cc (working copy)
@@ -349,12 +349,10 @@
}
void Window::AddChild(Window* child) {
- RootWindow* old_root = child->GetRootWindow();
-
DCHECK(std::find(children_.begin(), children_.end(), child) ==
children_.end());
if (child->parent())
- child->parent()->RemoveChildImpl(child, this);
+ child->parent()->RemoveChild(child);
child->parent_ = this;
layer_->Add(child->layer_);
@@ -365,8 +363,8 @@
FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowAdded(child));
child->OnParentChanged();
- RootWindow* root_window = GetRootWindow();
- if (root_window && old_root != root_window) {
+ RootWindow* root_window = child->GetRootWindow();
+ if (root_window) {
root_window->OnWindowAddedToRootWindow(child);
child->NotifyAddedToRootWindow();
}
@@ -391,7 +389,26 @@
}
void Window::RemoveChild(Window* child) {
- RemoveChildImpl(child, NULL);
+ Windows::iterator i = std::find(children_.begin(), children_.end(), child);
+ DCHECK(i != children_.end());
+ if (layout_manager_.get())
+ layout_manager_->OnWillRemoveWindowFromLayout(child);
+ FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child));
+ RootWindow* root_window = child->GetRootWindow();
+ if (root_window) {
+ root_window->OnWindowRemovedFromRootWindow(child);
+ child->NotifyRemovingFromRootWindow();
+ }
+ child->parent_ = NULL;
+ // We should only remove the child's layer if the child still owns that layer.
+ // Someone else may have acquired ownership of it via AcquireLayer() and may
+ // expect the hierarchy to go unchanged as the Window is destroyed.
+ if (child->layer_owner_.get())
+ layer_->Remove(child->layer_);
+ children_.erase(i);
+ child->OnParentChanged();
+ if (layout_manager_.get())
+ layout_manager_->OnWindowRemovedFromLayout(child);
}
bool Window::Contains(const Window* other) const {
@@ -759,30 +776,6 @@
return delegate_ ? this : NULL;
}
-void Window::RemoveChildImpl(Window* child, Window* new_parent) {
- Windows::iterator i = std::find(children_.begin(), children_.end(), child);
- DCHECK(i != children_.end());
- if (layout_manager_.get())
- layout_manager_->OnWillRemoveWindowFromLayout(child);
- FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child));
- RootWindow* root_window = child->GetRootWindow();
- if (root_window &&
- (!new_parent || new_parent->GetRootWindow() != root_window)) {
- root_window->OnWindowRemovedFromRootWindow(child);
- child->NotifyRemovingFromRootWindow();
- }
- child->parent_ = NULL;
- // We should only remove the child's layer if the child still owns that layer.
- // Someone else may have acquired ownership of it via AcquireLayer() and may
- // expect the hierarchy to go unchanged as the Window is destroyed.
- if (child->layer_owner_.get())
- layer_->Remove(child->layer_);
- children_.erase(i);
- child->OnParentChanged();
- if (layout_manager_.get())
- layout_manager_->OnWindowRemovedFromLayout(child);
-}
-
void Window::OnParentChanged() {
FOR_EACH_OBSERVER(
WindowObserver, observers_, OnWindowParentChanged(this, parent_));
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698