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

Unified Diff: ui/aura/window.cc

Issue 9315015: Adds two new observer methods to allow code to be notified when a Window is added/removed from a ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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_observer.h » ('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 119986)
+++ ui/aura/window.cc (working copy)
@@ -294,8 +294,10 @@
child->OnParentChanged();
RootWindow* root_window = child->GetRootWindow();
- if (root_window)
- root_window->OnWindowAttachedToRootWindow(child);
+ if (root_window) {
+ root_window->OnWindowAddedToRootWindow(child);
+ NotifyAddedToRootWindow();
+ }
}
void Window::AddTransientChild(Window* child) {
@@ -323,8 +325,10 @@
layout_manager_->OnWillRemoveWindowFromLayout(child);
FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child));
RootWindow* root_window = child->GetRootWindow();
- if (root_window)
- root_window->OnWindowDetachingFromRootWindow(child);
+ 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
@@ -519,12 +523,6 @@
return it != children_.end();
}
-void Window::OnWindowDetachingFromRootWindow(aura::Window* window) {
-}
-
-void Window::OnWindowAttachedToRootWindow(aura::Window* window) {
-}
-
void Window::SetBoundsInternal(const gfx::Rect& new_bounds) {
gfx::Rect actual_new_bounds(new_bounds);
@@ -643,6 +641,24 @@
FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowStackingChanged(this));
}
+void Window::NotifyRemovingFromRootWindow() {
+ FOR_EACH_OBSERVER(WindowObserver, observers_,
+ OnWindowRemovingFromRootWindow(this));
+ for (Window::Windows::const_iterator it = children_.begin();
+ it != children_.end(); ++it) {
+ (*it)->NotifyRemovingFromRootWindow();
+ }
+}
+
+void Window::NotifyAddedToRootWindow() {
+ FOR_EACH_OBSERVER(WindowObserver, observers_,
+ OnWindowAddedToRootWindow(this));
+ for (Window::Windows::const_iterator it = children_.begin();
+ it != children_.end(); ++it) {
+ (*it)->NotifyAddedToRootWindow();
+ }
+}
+
void Window::OnPaintLayer(gfx::Canvas* canvas) {
if (delegate_)
delegate_->OnPaint(canvas);
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698