| 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/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 14 #include "third_party/skia/include/core/SkRegion.h" | 15 #include "third_party/skia/include/core/SkRegion.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/client/capture_client.h" | 17 #include "ui/aura/client/capture_client.h" |
| 17 #include "ui/aura/client/cursor_client.h" | 18 #include "ui/aura/client/cursor_client.h" |
| 18 #include "ui/aura/client/drag_drop_client.h" | 19 #include "ui/aura/client/drag_drop_client.h" |
| 19 #include "ui/aura/client/focus_client.h" | 20 #include "ui/aura/client/focus_client.h" |
| 20 #include "ui/aura/client/screen_position_client.h" | 21 #include "ui/aura/client/screen_position_client.h" |
| 21 #include "ui/aura/client/window_parenting_client.h" | 22 #include "ui/aura/client/window_parenting_client.h" |
| 22 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
| 23 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 if (!window_) | 307 if (!window_) |
| 307 return nullptr; | 308 return nullptr; |
| 308 aura::Window* root_window = window_->GetRootWindow(); | 309 aura::Window* root_window = window_->GetRootWindow(); |
| 309 return root_window ? root_window->GetHost()->GetInputMethod() : nullptr; | 310 return root_window ? root_window->GetHost()->GetInputMethod() : nullptr; |
| 310 } | 311 } |
| 311 | 312 |
| 312 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { | 313 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { |
| 313 if (!window_) | 314 if (!window_) |
| 314 return; | 315 return; |
| 315 | 316 |
| 317 window_->SetProperty(aura::client::kPreferredSize, new gfx::Size(size)); |
| 318 |
| 316 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); | 319 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); |
| 317 // When centering window, we take the intersection of the host and | 320 // When centering window, we take the intersection of the host and |
| 318 // the parent. We assume the root window represents the visible | 321 // the parent. We assume the root window represents the visible |
| 319 // rect of a single screen. | 322 // rect of a single screen. |
| 320 gfx::Rect work_area = display::Screen::GetScreen() | 323 gfx::Rect work_area = display::Screen::GetScreen() |
| 321 ->GetDisplayNearestWindow(window_) | 324 ->GetDisplayNearestWindow(window_) |
| 322 .work_area(); | 325 .work_area(); |
| 323 | 326 |
| 324 aura::client::ScreenPositionClient* screen_position_client = | 327 aura::client::ScreenPositionClient* screen_position_client = |
| 325 aura::client::GetScreenPositionClient(window_->GetRootWindow()); | 328 aura::client::GetScreenPositionClient(window_->GetRootWindow()); |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 gfx::NativeView native_view) { | 1216 gfx::NativeView native_view) { |
| 1214 aura::client::CaptureClient* capture_client = | 1217 aura::client::CaptureClient* capture_client = |
| 1215 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1218 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1216 if (!capture_client) | 1219 if (!capture_client) |
| 1217 return nullptr; | 1220 return nullptr; |
| 1218 return capture_client->GetGlobalCaptureWindow(); | 1221 return capture_client->GetGlobalCaptureWindow(); |
| 1219 } | 1222 } |
| 1220 | 1223 |
| 1221 } // namespace internal | 1224 } // namespace internal |
| 1222 } // namespace views | 1225 } // namespace views |
| OLD | NEW |