OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 const WindowTreeHost* Window::GetHost() const { | 321 const WindowTreeHost* Window::GetHost() const { |
322 const Window* root_window = GetRootWindow(); | 322 const Window* root_window = GetRootWindow(); |
323 return root_window ? root_window->host_ : NULL; | 323 return root_window ? root_window->host_ : NULL; |
324 } | 324 } |
325 | 325 |
326 void Window::Show() { | 326 void Window::Show() { |
327 DCHECK_EQ(visible_, layer()->GetTargetVisibility()); | 327 DCHECK_EQ(visible_, layer()->GetTargetVisibility()); |
328 // It is not allowed that a window is visible but the layers alpha is fully | 328 // It is not allowed that a window is visible but the layers alpha is fully |
329 // transparent since the window would still be considered to be active but | 329 // transparent since the window would still be considered to be active but |
330 // could not be seen. | 330 // could not be seen. |
331 DCHECK_IMPLIES(visible_, layer()->GetTargetOpacity() > 0.0f); | 331 DCHECK(!visible_ || layer()->GetTargetOpacity() > 0.0f); |
332 SetVisible(true); | 332 SetVisible(true); |
333 } | 333 } |
334 | 334 |
335 void Window::Hide() { | 335 void Window::Hide() { |
336 // RootWindow::OnVisibilityChanged will call ReleaseCapture. | 336 // RootWindow::OnVisibilityChanged will call ReleaseCapture. |
337 SetVisible(false); | 337 SetVisible(false); |
338 } | 338 } |
339 | 339 |
340 bool Window::IsVisible() const { | 340 bool Window::IsVisible() const { |
341 // Layer visibility can be inconsistent with window visibility, for example | 341 // Layer visibility can be inconsistent with window visibility, for example |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 return window; | 1401 return window; |
1402 if (offset) | 1402 if (offset) |
1403 *offset += window->bounds().OffsetFromOrigin(); | 1403 *offset += window->bounds().OffsetFromOrigin(); |
1404 } | 1404 } |
1405 if (offset) | 1405 if (offset) |
1406 *offset = gfx::Vector2d(); | 1406 *offset = gfx::Vector2d(); |
1407 return NULL; | 1407 return NULL; |
1408 } | 1408 } |
1409 | 1409 |
1410 } // namespace aura | 1410 } // namespace aura |
OLD | NEW |