OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/desktop.h" | 10 #include "ui/aura/desktop.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 ui::MultiAnimation* multi_animation = new ui::MultiAnimation(parts); | 370 ui::MultiAnimation* multi_animation = new ui::MultiAnimation(parts); |
371 multi_animation->set_continuous(false); | 371 multi_animation->set_continuous(false); |
372 return multi_animation; | 372 return multi_animation; |
373 } | 373 } |
374 | 374 |
375 internal::RootWindow* Window::GetRoot() { | 375 internal::RootWindow* Window::GetRoot() { |
376 return parent_ ? parent_->GetRoot() : NULL; | 376 return parent_ ? parent_->GetRoot() : NULL; |
377 } | 377 } |
378 | 378 |
379 void Window::SetVisible(bool visible) { | 379 void Window::SetVisible(bool visible) { |
| 380 if (visible == layer_->visible()) |
| 381 return; // No change. |
| 382 |
380 bool was_visible = IsVisible(); | 383 bool was_visible = IsVisible(); |
381 layer_->SetVisible(visible); | 384 layer_->SetVisible(visible); |
382 bool is_visible = IsVisible(); | 385 bool is_visible = IsVisible(); |
383 if (was_visible != is_visible) { | 386 if (was_visible != is_visible) { |
384 SchedulePaint(); | 387 SchedulePaint(); |
385 if (delegate_) | 388 if (delegate_) |
386 delegate_->OnWindowVisibilityChanged(is_visible); | 389 delegate_->OnWindowVisibilityChanged(is_visible); |
387 } | 390 } |
| 391 FOR_EACH_OBSERVER(WindowObserver, observers_, |
| 392 OnWindowVisibilityChanged(this, is_visible)); |
388 } | 393 } |
389 | 394 |
390 void Window::SchedulePaint() { | 395 void Window::SchedulePaint() { |
391 SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height())); | 396 SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height())); |
392 } | 397 } |
393 | 398 |
394 bool Window::StopsEventPropagation() const { | 399 bool Window::StopsEventPropagation() const { |
395 return stops_event_propagation_ && !children_.empty(); | 400 return stops_event_propagation_ && !children_.empty(); |
396 } | 401 } |
397 | 402 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 442 } |
438 | 443 |
439 return delegate_ ? this : NULL; | 444 return delegate_ ? this : NULL; |
440 } | 445 } |
441 | 446 |
442 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 447 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
443 delegate_->OnPaint(canvas); | 448 delegate_->OnPaint(canvas); |
444 } | 449 } |
445 | 450 |
446 } // namespace aura | 451 } // namespace aura |
OLD | NEW |