| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "ui/aura/client/capture_client.h" | 16 #include "ui/aura/client/capture_client.h" |
| 17 #include "ui/aura/client/event_client.h" | 17 #include "ui/aura/client/event_client.h" |
| 18 #include "ui/aura/client/focus_client.h" | 18 #include "ui/aura/client/focus_client.h" |
| 19 #include "ui/aura/client/screen_position_client.h" | 19 #include "ui/aura/client/screen_position_client.h" |
| 20 #include "ui/aura/client/stacking_client.h" | |
| 21 #include "ui/aura/client/visibility_client.h" | 20 #include "ui/aura/client/visibility_client.h" |
| 22 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 23 #include "ui/aura/layout_manager.h" | 22 #include "ui/aura/layout_manager.h" |
| 24 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
| 25 #include "ui/aura/window_delegate.h" | 24 #include "ui/aura/window_delegate.h" |
| 26 #include "ui/aura/window_observer.h" | 25 #include "ui/aura/window_observer.h" |
| 27 #include "ui/aura/window_tracker.h" | 26 #include "ui/aura/window_tracker.h" |
| 28 #include "ui/compositor/compositor.h" | 27 #include "ui/compositor/compositor.h" |
| 29 #include "ui/compositor/layer.h" | 28 #include "ui/compositor/layer.h" |
| 30 #include "ui/gfx/animation/multi_animation.h" | 29 #include "ui/gfx/animation/multi_animation.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return layer_->bounds(); | 296 return layer_->bounds(); |
| 298 } | 297 } |
| 299 | 298 |
| 300 void Window::SchedulePaintInRect(const gfx::Rect& rect) { | 299 void Window::SchedulePaintInRect(const gfx::Rect& rect) { |
| 301 if (layer_->SchedulePaint(rect)) { | 300 if (layer_->SchedulePaint(rect)) { |
| 302 FOR_EACH_OBSERVER( | 301 FOR_EACH_OBSERVER( |
| 303 WindowObserver, observers_, OnWindowPaintScheduled(this, rect)); | 302 WindowObserver, observers_, OnWindowPaintScheduled(this, rect)); |
| 304 } | 303 } |
| 305 } | 304 } |
| 306 | 305 |
| 307 void Window::SetDefaultParentByRootWindow(RootWindow* root_window, | |
| 308 const gfx::Rect& bounds_in_screen) { | |
| 309 DCHECK(root_window); | |
| 310 | |
| 311 // Stacking clients are mandatory on RootWindow objects. | |
| 312 client::StackingClient* client = client::GetStackingClient(root_window); | |
| 313 DCHECK(client); | |
| 314 | |
| 315 aura::Window* default_parent = client->GetDefaultParent( | |
| 316 root_window, this, bounds_in_screen); | |
| 317 default_parent->AddChild(this); | |
| 318 } | |
| 319 | |
| 320 void Window::StackChildAtTop(Window* child) { | 306 void Window::StackChildAtTop(Window* child) { |
| 321 if (children_.size() <= 1 || child == children_.back()) | 307 if (children_.size() <= 1 || child == children_.back()) |
| 322 return; // In the front already. | 308 return; // In the front already. |
| 323 StackChildAbove(child, children_.back()); | 309 StackChildAbove(child, children_.back()); |
| 324 } | 310 } |
| 325 | 311 |
| 326 void Window::StackChildAbove(Window* child, Window* target) { | 312 void Window::StackChildAbove(Window* child, Window* target) { |
| 327 StackChildRelativeTo(child, target, STACK_ABOVE); | 313 StackChildRelativeTo(child, target, STACK_ABOVE); |
| 328 } | 314 } |
| 329 | 315 |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 bool contains_mouse = false; | 1131 bool contains_mouse = false; |
| 1146 if (IsVisible()) { | 1132 if (IsVisible()) { |
| 1147 RootWindow* root_window = GetRootWindow(); | 1133 RootWindow* root_window = GetRootWindow(); |
| 1148 contains_mouse = root_window && | 1134 contains_mouse = root_window && |
| 1149 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); | 1135 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); |
| 1150 } | 1136 } |
| 1151 return contains_mouse; | 1137 return contains_mouse; |
| 1152 } | 1138 } |
| 1153 | 1139 |
| 1154 } // namespace aura | 1140 } // namespace aura |
| OLD | NEW |