| 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" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 if (!window_) | 310 if (!window_) |
| 311 return nullptr; | 311 return nullptr; |
| 312 aura::Window* root_window = window_->GetRootWindow(); | 312 aura::Window* root_window = window_->GetRootWindow(); |
| 313 return root_window ? root_window->GetHost()->GetInputMethod() : nullptr; | 313 return root_window ? root_window->GetHost()->GetInputMethod() : nullptr; |
| 314 } | 314 } |
| 315 | 315 |
| 316 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { | 316 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { |
| 317 if (!window_ || is_parallel_widget_in_window_manager_) | 317 if (!window_ || is_parallel_widget_in_window_manager_) |
| 318 return; | 318 return; |
| 319 | 319 |
| 320 window_->SetProperty(aura::client::kPreferredSize, new gfx::Size(size)); |
| 321 |
| 320 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); | 322 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); |
| 321 // When centering window, we take the intersection of the host and | 323 // When centering window, we take the intersection of the host and |
| 322 // the parent. We assume the root window represents the visible | 324 // the parent. We assume the root window represents the visible |
| 323 // rect of a single screen. | 325 // rect of a single screen. |
| 324 gfx::Rect work_area = display::Screen::GetScreen() | 326 gfx::Rect work_area = display::Screen::GetScreen() |
| 325 ->GetDisplayNearestWindow(window_) | 327 ->GetDisplayNearestWindow(window_) |
| 326 .work_area(); | 328 .work_area(); |
| 327 | 329 |
| 328 aura::client::ScreenPositionClient* screen_position_client = | 330 aura::client::ScreenPositionClient* screen_position_client = |
| 329 aura::client::GetScreenPositionClient(window_->GetRootWindow()); | 331 aura::client::GetScreenPositionClient(window_->GetRootWindow()); |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 gfx::NativeView native_view) { | 1223 gfx::NativeView native_view) { |
| 1222 aura::client::CaptureClient* capture_client = | 1224 aura::client::CaptureClient* capture_client = |
| 1223 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1225 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1224 if (!capture_client) | 1226 if (!capture_client) |
| 1225 return nullptr; | 1227 return nullptr; |
| 1226 return capture_client->GetGlobalCaptureWindow(); | 1228 return capture_client->GetGlobalCaptureWindow(); |
| 1227 } | 1229 } |
| 1228 | 1230 |
| 1229 } // namespace internal | 1231 } // namespace internal |
| 1230 } // namespace views | 1232 } // namespace views |
| OLD | NEW |