Chromium Code Reviews| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 } | 360 } |
| 361 | 361 |
| 362 internal::RootWindow* Window::GetRoot() { | 362 internal::RootWindow* Window::GetRoot() { |
| 363 return parent_ ? parent_->GetRoot() : NULL; | 363 return parent_ ? parent_->GetRoot() : NULL; |
| 364 } | 364 } |
| 365 | 365 |
| 366 void Window::SetVisible(bool visible) { | 366 void Window::SetVisible(bool visible) { |
| 367 bool was_visible = IsVisible(); | 367 bool was_visible = IsVisible(); |
| 368 layer_->SetVisible(visible); | 368 layer_->SetVisible(visible); |
| 369 bool is_visible = IsVisible(); | 369 bool is_visible = IsVisible(); |
| 370 if (was_visible != is_visible) | 370 if (was_visible != is_visible) { |
| 371 SchedulePaint(); | 371 SchedulePaint(); |
| 372 if (delegate_) | |
| 373 delegate_->OnWindowVisibilityChanged(is_visible); | |
|
oshima
2011/10/11 00:52:19
how child layers get notifified visibility change?
sadrul
2011/10/11 01:03:18
Child windows don't get notified of the visibility
| |
| 374 } | |
| 372 } | 375 } |
| 373 | 376 |
| 374 void Window::SchedulePaint() { | 377 void Window::SchedulePaint() { |
| 375 SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height())); | 378 SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height())); |
| 376 } | 379 } |
| 377 | 380 |
| 378 bool Window::StopsEventPropagation() const { | 381 bool Window::StopsEventPropagation() const { |
| 379 return stops_event_propagation_ && !children_.empty(); | 382 return stops_event_propagation_ && !children_.empty(); |
| 380 } | 383 } |
| 381 | 384 |
| 382 bool Window::UpdateShowStateAndRestoreBounds( | 385 bool Window::UpdateShowStateAndRestoreBounds( |
| 383 ui::WindowShowState new_show_state) { | 386 ui::WindowShowState new_show_state) { |
| 384 if (show_state_ == new_show_state) | 387 if (show_state_ == new_show_state) |
| 385 return false; | 388 return false; |
| 386 show_state_ = new_show_state; | 389 show_state_ = new_show_state; |
| 387 if (restore_bounds_.IsEmpty()) | 390 if (restore_bounds_.IsEmpty()) |
| 388 restore_bounds_ = bounds(); | 391 restore_bounds_ = bounds(); |
| 389 return true; | 392 return true; |
| 390 } | 393 } |
| 391 | 394 |
| 392 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 395 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
| 393 delegate_->OnPaint(canvas); | 396 delegate_->OnPaint(canvas); |
| 394 } | 397 } |
| 395 | 398 |
| 396 } // namespace aura | 399 } // namespace aura |
| OLD | NEW |