| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 bool Window::IsVisible() const { | 181 bool Window::IsVisible() const { |
| 182 // Layer visibility can be inconsistent with window visibility, for example | 182 // Layer visibility can be inconsistent with window visibility, for example |
| 183 // when a Window is hidden, we want this function to return false immediately | 183 // when a Window is hidden, we want this function to return false immediately |
| 184 // after, even though the client may decide to animate the hide effect (and | 184 // after, even though the client may decide to animate the hide effect (and |
| 185 // so the layer will be visible for some time after Hide() is called). | 185 // so the layer will be visible for some time after Hide() is called). |
| 186 return visible_ && layer_ && layer_->IsDrawn(); | 186 return visible_ && layer_ && layer_->IsDrawn(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 gfx::Rect Window::GetScreenBounds() const { | 189 gfx::Rect Window::GetScreenBounds() const { |
| 190 // TODO(beng): There may be a better way to handle this, and the existing code | |
| 191 // is likely wrong anyway in a multi-monitor world, but this will | |
| 192 // do for now. | |
| 193 if (!GetRootWindow()) | |
| 194 return bounds(); | |
| 195 gfx::Point origin = bounds().origin(); | 190 gfx::Point origin = bounds().origin(); |
| 196 Window::ConvertPointToWindow(parent_, GetRootWindow(), &origin); | 191 Window::ConvertPointToWindow(parent_, GetRootWindow(), &origin); |
| 197 return gfx::Rect(origin, bounds().size()); | 192 return gfx::Rect(origin, bounds().size()); |
| 198 } | 193 } |
| 199 | 194 |
| 200 void Window::SetTransform(const ui::Transform& transform) { | 195 void Window::SetTransform(const ui::Transform& transform) { |
| 201 RootWindow* root_window = GetRootWindow(); | 196 RootWindow* root_window = GetRootWindow(); |
| 202 bool contained_mouse = IsVisible() && root_window && | 197 bool contained_mouse = IsVisible() && root_window && |
| 203 ContainsPointInRoot(root_window->last_mouse_location()); | 198 ContainsPointInRoot(root_window->last_mouse_location()); |
| 204 layer()->SetTransform(transform); | 199 layer()->SetTransform(transform); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 if (id_ != -1) { | 789 if (id_ != -1) { |
| 795 char id_buf[10]; | 790 char id_buf[10]; |
| 796 base::snprintf(id_buf, sizeof(id_buf), " %d", id_); | 791 base::snprintf(id_buf, sizeof(id_buf), " %d", id_); |
| 797 layer_name.append(id_buf); | 792 layer_name.append(id_buf); |
| 798 } | 793 } |
| 799 layer()->set_name(layer_name); | 794 layer()->set_name(layer_name); |
| 800 #endif | 795 #endif |
| 801 } | 796 } |
| 802 | 797 |
| 803 } // namespace aura | 798 } // namespace aura |
| OLD | NEW |