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_native_widget_helper_aura.h" | 5 #include "ui/views/widget/desktop_native_widget_helper_aura.h" |
6 | 6 |
7 #include "ui/views/widget/native_widget_aura.h" | 7 #include "ui/views/widget/native_widget_aura.h" |
8 #include "ui/aura/root_window.h" | 8 #include "ui/aura/root_window.h" |
9 #include "ui/aura/desktop/desktop_activation_client.h" | 9 #include "ui/aura/desktop/desktop_activation_client.h" |
10 #include "ui/aura/desktop/desktop_dispatcher_client.h" | 10 #include "ui/aura/desktop/desktop_dispatcher_client.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 void DesktopNativeWidgetHelperAura::ShowRootWindow() { | 43 void DesktopNativeWidgetHelperAura::ShowRootWindow() { |
44 if (root_window_.get()) | 44 if (root_window_.get()) |
45 root_window_->ShowRootWindow(); | 45 root_window_->ShowRootWindow(); |
46 } | 46 } |
47 | 47 |
48 aura::RootWindow* DesktopNativeWidgetHelperAura::GetRootWindow() { | 48 aura::RootWindow* DesktopNativeWidgetHelperAura::GetRootWindow() { |
49 return root_window_.get(); | 49 return root_window_.get(); |
50 } | 50 } |
51 | 51 |
52 gfx::Rect DesktopNativeWidgetHelperAura::ModifyAndSetBounds(gfx::Rect bounds) { | 52 gfx::Rect DesktopNativeWidgetHelperAura::ModifyAndSetBounds( |
53 if (root_window_.get() && !bounds.IsEmpty()) { | 53 const gfx::Rect& bounds) { |
54 root_window_->SetHostBounds(bounds); | 54 gfx::Rect out_bounds = bounds; |
55 bounds.set_x(0); | 55 if (root_window_.get() && !out_bounds.IsEmpty()) { |
56 bounds.set_y(0); | 56 root_window_->SetHostBounds(out_bounds); |
| 57 out_bounds.set_x(0); |
| 58 out_bounds.set_y(0); |
57 } | 59 } |
58 | 60 |
59 return bounds; | 61 return out_bounds; |
| 62 } |
| 63 |
| 64 gfx::Rect DesktopNativeWidgetHelperAura::ChangeRootWindowBoundsToScreenBounds( |
| 65 const gfx::Rect& bounds) { |
| 66 gfx::Rect out_bounds = bounds; |
| 67 if (root_window_.get()) |
| 68 out_bounds.Offset(root_window_->GetHostOrigin()); |
| 69 return out_bounds; |
60 } | 70 } |
61 | 71 |
62 //////////////////////////////////////////////////////////////////////////////// | 72 //////////////////////////////////////////////////////////////////////////////// |
63 // DesktopNativeWidgetHelperAura, aura::RootWindowObserver implementation: | 73 // DesktopNativeWidgetHelperAura, aura::RootWindowObserver implementation: |
64 | 74 |
65 void DesktopNativeWidgetHelperAura::OnRootWindowResized( | 75 void DesktopNativeWidgetHelperAura::OnRootWindowResized( |
66 const aura::RootWindow* root, | 76 const aura::RootWindow* root, |
67 const gfx::Size& old_size) { | 77 const gfx::Size& old_size) { |
68 DCHECK_EQ(root, root_window_.get()); | 78 DCHECK_EQ(root, root_window_.get()); |
69 widget_->SetBounds(gfx::Rect(root->GetHostSize())); | 79 widget_->SetBounds(gfx::Rect(root->GetHostSize())); |
70 } | 80 } |
71 | 81 |
72 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( | 82 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( |
73 const aura::RootWindow* root) { | 83 const aura::RootWindow* root) { |
74 DCHECK_EQ(root, root_window_.get()); | 84 DCHECK_EQ(root, root_window_.get()); |
75 widget_->GetWidget()->Close(); | 85 widget_->GetWidget()->Close(); |
76 } | 86 } |
77 | 87 |
78 } // namespace views | 88 } // namespace views |
OLD | NEW |