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

Unified Diff: ui/aura/window.cc

Issue 8253001: aura: Some changes in Window and Desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« ui/aura/window.h ('K') | « ui/aura/window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 07c48e64fc089fbc2a43102b87cbb791ca4dba68..95c93cb257a71c869445cc2ed0f851c5a898dc78 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -35,6 +35,8 @@ Window::Window(WindowDelegate* delegate)
}
Window::~Window() {
+ FOR_EACH_OBSERVER(Observer, observers_, OnWindowClosing(this));
+
// Let the delegate know we're in the processing of destroying.
if (delegate_)
delegate_->OnWindowDestroying();
@@ -114,10 +116,14 @@ void Window::Restore() {
void Window::Activate() {
// If we support minimization need to ensure this restores the window first.
aura::Desktop::GetInstance()->SetActiveWindow(this, this);
+ FOR_EACH_OBSERVER(Observer, observers_,
+ OnWindowActivationChanged(this, true));
}
void Window::Deactivate() {
aura::Desktop::GetInstance()->Deactivate(this);
+ FOR_EACH_OBSERVER(Observer, observers_,
+ OnWindowActivationChanged(this, false));
}
bool Window::IsActive() const {
@@ -259,6 +265,18 @@ bool Window::OnKeyEvent(KeyEvent* event) {
return IsVisible() && delegate_->OnKeyEvent(event);
}
+void Window::AddObserver(Window::Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void Window::RemoveObserver(Window::Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+bool Window::HasObserver(Window::Observer* observer) {
+ return observers_.HasObserver(observer);
+}
+
bool Window::HitTest(const gfx::Point& point) {
gfx::Rect local_bounds(gfx::Point(), bounds().size());
// TODO(beng): hittest masks.
@@ -371,6 +389,9 @@ void Window::SetVisible(bool visible) {
if (delegate_)
delegate_->OnWindowVisibilityChanged(is_visible);
}
+
+ FOR_EACH_OBSERVER(Observer, observers_,
+ OnWindowVisibilityChanged(this, visible));
}
void Window::SchedulePaint() {
« ui/aura/window.h ('K') | « ui/aura/window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698