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/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/client/activation_client.h" | 8 #include "ui/aura/client/activation_client.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/stacking_client.h" | 10 #include "ui/aura/client/stacking_client.h" |
11 #include "ui/aura/focus_manager.h" | 11 #include "ui/aura/focus_manager.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/aura/root_window_host.h" | 13 #include "ui/aura/root_window_host.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
16 #include "ui/aura/window_property.h" | 16 #include "ui/aura/window_property.h" |
17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
18 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
19 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/display.h" |
| 21 #include "ui/gfx/point_conversions.h" |
| 22 #include "ui/gfx/screen.h" |
| 23 #include "ui/gfx/size_conversions.h" |
20 #include "ui/native_theme/native_theme.h" | 24 #include "ui/native_theme/native_theme.h" |
21 #include "ui/views/corewm/compound_event_filter.h" | 25 #include "ui/views/corewm/compound_event_filter.h" |
22 #include "ui/views/corewm/corewm_switches.h" | 26 #include "ui/views/corewm/corewm_switches.h" |
23 #include "ui/views/corewm/input_method_event_filter.h" | 27 #include "ui/views/corewm/input_method_event_filter.h" |
24 #include "ui/views/corewm/shadow_controller.h" | 28 #include "ui/views/corewm/shadow_controller.h" |
25 #include "ui/views/corewm/shadow_types.h" | 29 #include "ui/views/corewm/shadow_types.h" |
26 #include "ui/views/corewm/tooltip_controller.h" | 30 #include "ui/views/corewm/tooltip_controller.h" |
27 #include "ui/views/corewm/visibility_controller.h" | 31 #include "ui/views/corewm/visibility_controller.h" |
28 #include "ui/views/corewm/window_modality_controller.h" | 32 #include "ui/views/corewm/window_modality_controller.h" |
29 #include "ui/views/drag_utils.h" | 33 #include "ui/views/drag_utils.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 398 |
395 gfx::Rect DesktopNativeWidgetAura::GetClientAreaBoundsInScreen() const { | 399 gfx::Rect DesktopNativeWidgetAura::GetClientAreaBoundsInScreen() const { |
396 return desktop_root_window_host_->GetClientAreaBoundsInScreen(); | 400 return desktop_root_window_host_->GetClientAreaBoundsInScreen(); |
397 } | 401 } |
398 | 402 |
399 gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const { | 403 gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const { |
400 return desktop_root_window_host_->GetRestoredBounds(); | 404 return desktop_root_window_host_->GetRestoredBounds(); |
401 } | 405 } |
402 | 406 |
403 void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) { | 407 void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
404 desktop_root_window_host_->AsRootWindowHost()->SetBounds(bounds); | 408 float scale = 1; |
| 409 aura::RootWindow* root = root_window_.get(); |
| 410 if (root) { |
| 411 scale = gfx::Screen::GetScreenFor(root)-> |
| 412 GetDisplayNearestWindow(root).device_scale_factor(); |
| 413 } |
| 414 gfx::Rect bounds_in_pixels( |
| 415 gfx::ToCeiledPoint(gfx::ScalePoint(bounds.origin(), scale)), |
| 416 gfx::ToFlooredSize(gfx::ScaleSize(bounds.size(), scale))); |
| 417 desktop_root_window_host_->AsRootWindowHost()->SetBounds(bounds_in_pixels); |
405 } | 418 } |
406 | 419 |
407 void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) { | 420 void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) { |
408 desktop_root_window_host_->SetSize(size); | 421 desktop_root_window_host_->SetSize(size); |
409 } | 422 } |
410 | 423 |
411 void DesktopNativeWidgetAura::StackAbove(gfx::NativeView native_view) { | 424 void DesktopNativeWidgetAura::StackAbove(gfx::NativeView native_view) { |
412 } | 425 } |
413 | 426 |
414 void DesktopNativeWidgetAura::StackAtTop() { | 427 void DesktopNativeWidgetAura::StackAtTop() { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 drop_helper_->OnDragExit(); | 831 drop_helper_->OnDragExit(); |
819 } | 832 } |
820 | 833 |
821 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 834 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
822 DCHECK(drop_helper_.get() != NULL); | 835 DCHECK(drop_helper_.get() != NULL); |
823 return drop_helper_->OnDrop(event.data(), event.location(), | 836 return drop_helper_->OnDrop(event.data(), event.location(), |
824 last_drop_operation_); | 837 last_drop_operation_); |
825 } | 838 } |
826 | 839 |
827 } // namespace views | 840 } // namespace views |
OLD | NEW |