| 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/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool Window::IsVisible() const { | 234 bool Window::IsVisible() const { |
| 235 // Layer visibility can be inconsistent with window visibility, for example | 235 // Layer visibility can be inconsistent with window visibility, for example |
| 236 // when a Window is hidden, we want this function to return false immediately | 236 // when a Window is hidden, we want this function to return false immediately |
| 237 // after, even though the client may decide to animate the hide effect (and | 237 // after, even though the client may decide to animate the hide effect (and |
| 238 // so the layer will be visible for some time after Hide() is called). | 238 // so the layer will be visible for some time after Hide() is called). |
| 239 return visible_ && layer_ && layer_->IsDrawn(); | 239 return visible_ && layer_ && layer_->IsDrawn(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 gfx::Rect Window::GetRootWindowBounds() const { | 242 gfx::Rect Window::GetBoundsInRootWindow() const { |
| 243 // TODO(beng): There may be a better way to handle this, and the existing code | 243 // TODO(beng): There may be a better way to handle this, and the existing code |
| 244 // is likely wrong anyway in a multi-display world, but this will | 244 // is likely wrong anyway in a multi-display world, but this will |
| 245 // do for now. | 245 // do for now. |
| 246 if (!GetRootWindow()) | 246 if (!GetRootWindow()) |
| 247 return bounds(); | 247 return bounds(); |
| 248 gfx::Point origin = bounds().origin(); | 248 gfx::Point origin = bounds().origin(); |
| 249 Window::ConvertPointToWindow(parent_, GetRootWindow(), &origin); | 249 Window::ConvertPointToWindow(parent_, GetRootWindow(), &origin); |
| 250 return gfx::Rect(origin, bounds().size()); | 250 return gfx::Rect(origin, bounds().size()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 gfx::Rect Window::GetScreenBounds() const { | 253 gfx::Rect Window::GetBoundsInScreen() const { |
| 254 gfx::Rect bounds(GetRootWindowBounds()); | 254 gfx::Rect bounds(GetBoundsInRootWindow()); |
| 255 const RootWindow* root = GetRootWindow(); | 255 const RootWindow* root = GetRootWindow(); |
| 256 if (root) { | 256 if (root) { |
| 257 aura::client::ScreenPositionClient* screen_position_client = | 257 aura::client::ScreenPositionClient* screen_position_client = |
| 258 aura::client::GetScreenPositionClient(root); | 258 aura::client::GetScreenPositionClient(root); |
| 259 if (screen_position_client) { | 259 if (screen_position_client) { |
| 260 gfx::Point origin = bounds.origin(); | 260 gfx::Point origin = bounds.origin(); |
| 261 screen_position_client->ConvertPointToScreen(root, &origin); | 261 screen_position_client->ConvertPointToScreen(root, &origin); |
| 262 bounds.set_origin(origin); | 262 bounds.set_origin(origin); |
| 263 } | 263 } |
| 264 } | 264 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 288 layout_manager_->OnWindowAddedToLayout(*it); | 288 layout_manager_->OnWindowAddedToLayout(*it); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void Window::SetBounds(const gfx::Rect& new_bounds) { | 291 void Window::SetBounds(const gfx::Rect& new_bounds) { |
| 292 if (parent_ && parent_->layout_manager()) | 292 if (parent_ && parent_->layout_manager()) |
| 293 parent_->layout_manager()->SetChildBounds(this, new_bounds); | 293 parent_->layout_manager()->SetChildBounds(this, new_bounds); |
| 294 else | 294 else |
| 295 SetBoundsInternal(new_bounds); | 295 SetBoundsInternal(new_bounds); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void Window::SetScreenBounds(const gfx::Rect& new_bounds_in_screen) { | 298 void Window::SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen) { |
| 299 RootWindow* root = GetRootWindow(); | 299 RootWindow* root = GetRootWindow(); |
| 300 if (root) { | 300 if (root) { |
| 301 gfx::Point origin = new_bounds_in_screen.origin(); | 301 gfx::Point origin = new_bounds_in_screen.origin(); |
| 302 aura::client::ScreenPositionClient* screen_position_client = | 302 aura::client::ScreenPositionClient* screen_position_client = |
| 303 aura::client::GetScreenPositionClient(root); | 303 aura::client::GetScreenPositionClient(root); |
| 304 screen_position_client->ConvertPointFromScreen( | 304 screen_position_client->ConvertPointFromScreen( |
| 305 parent(), &origin); | 305 parent(), &origin); |
| 306 SetBounds(gfx::Rect(origin, new_bounds_in_screen.size())); | 306 SetBounds(gfx::Rect(origin, new_bounds_in_screen.size())); |
| 307 return; | 307 return; |
| 308 } | 308 } |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 for (Windows::const_reverse_iterator it = children_.rbegin(), | 950 for (Windows::const_reverse_iterator it = children_.rbegin(), |
| 951 rend = children_.rend(); | 951 rend = children_.rend(); |
| 952 it != rend; ++it) { | 952 it != rend; ++it) { |
| 953 Window* child = *it; | 953 Window* child = *it; |
| 954 child->PrintWindowHierarchy(depth + 1); | 954 child->PrintWindowHierarchy(depth + 1); |
| 955 } | 955 } |
| 956 } | 956 } |
| 957 #endif | 957 #endif |
| 958 | 958 |
| 959 } // namespace aura | 959 } // namespace aura |
| OLD | NEW |