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/aura/client/dispatcher_client.h" | 7 #include "ui/aura/client/dispatcher_client.h" |
8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.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_cursor_client.h" | 10 #include "ui/aura/desktop/desktop_cursor_client.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 class DesktopScreenPositionClient | 39 class DesktopScreenPositionClient |
40 : public aura::client::ScreenPositionClient { | 40 : public aura::client::ScreenPositionClient { |
41 public: | 41 public: |
42 DesktopScreenPositionClient() {} | 42 DesktopScreenPositionClient() {} |
43 virtual ~DesktopScreenPositionClient() {} | 43 virtual ~DesktopScreenPositionClient() {} |
44 | 44 |
45 // aura::client::ScreenPositionClient overrides: | 45 // aura::client::ScreenPositionClient overrides: |
46 virtual void ConvertPointToScreen(const aura::Window* window, | 46 virtual void ConvertPointToScreen(const aura::Window* window, |
47 gfx::Point* point) OVERRIDE { | 47 gfx::Point* point) OVERRIDE { |
48 const aura::RootWindow* root_window = window->GetRootWindow(); | 48 const aura::RootWindow* root_window = window->GetRootWindow(); |
49 aura::Window::ConvertPointToWindow(window, root_window, point); | 49 aura::Window::ConvertPointToTarget(window, root_window, point); |
50 gfx::Point origin = root_window->GetHostOrigin(); | 50 gfx::Point origin = root_window->GetHostOrigin(); |
51 point->Offset(origin.x(), origin.y()); | 51 point->Offset(origin.x(), origin.y()); |
52 } | 52 } |
53 | 53 |
54 virtual void ConvertPointFromScreen(const aura::Window* window, | 54 virtual void ConvertPointFromScreen(const aura::Window* window, |
55 gfx::Point* point) OVERRIDE { | 55 gfx::Point* point) OVERRIDE { |
56 const aura::RootWindow* root_window = window->GetRootWindow(); | 56 const aura::RootWindow* root_window = window->GetRootWindow(); |
57 gfx::Point origin = root_window->GetHostOrigin(); | 57 gfx::Point origin = root_window->GetHostOrigin(); |
58 point->Offset(-origin.x(), -origin.y()); | 58 point->Offset(-origin.x(), -origin.y()); |
59 aura::Window::ConvertPointToWindow(root_window, window, point); | 59 aura::Window::ConvertPointToTarget(root_window, window, point); |
60 } | 60 } |
61 | 61 |
62 virtual void SetBounds(aura::Window* window, | 62 virtual void SetBounds(aura::Window* window, |
63 const gfx::Rect& bounds) OVERRIDE { | 63 const gfx::Rect& bounds) OVERRIDE { |
64 gfx::Point origin = bounds.origin(); | 64 gfx::Point origin = bounds.origin(); |
65 aura::RootWindow* root = window->GetRootWindow(); | 65 aura::RootWindow* root = window->GetRootWindow(); |
66 aura::Window::ConvertPointToWindow(window->parent(), root, &origin); | 66 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); |
67 | 67 |
68 #if !defined(OS_WIN) | 68 #if !defined(OS_WIN) |
69 if (window->type() == aura::client::WINDOW_TYPE_CONTROL) { | 69 if (window->type() == aura::client::WINDOW_TYPE_CONTROL) { |
70 window->SetBounds(gfx::Rect(origin, bounds.size())); | 70 window->SetBounds(gfx::Rect(origin, bounds.size())); |
71 return; | 71 return; |
72 } else if (window->type() == aura::client::WINDOW_TYPE_POPUP) { | 72 } else if (window->type() == aura::client::WINDOW_TYPE_POPUP) { |
73 // The caller expects windows we consider "embedded" to be placed in the | 73 // The caller expects windows we consider "embedded" to be placed in the |
74 // screen coordinate system. So we need to offset the root window's | 74 // screen coordinate system. So we need to offset the root window's |
75 // position (which is in screen coordinates) from these bounds. | 75 // position (which is in screen coordinates) from these bounds. |
76 gfx::Point host_origin = root->GetHostOrigin(); | 76 gfx::Point host_origin = root->GetHostOrigin(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 root->GetHostSize())); | 240 root->GetHostSize())); |
241 } | 241 } |
242 | 242 |
243 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( | 243 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( |
244 const aura::RootWindow* root) { | 244 const aura::RootWindow* root) { |
245 DCHECK_EQ(root, root_window_.get()); | 245 DCHECK_EQ(root, root_window_.get()); |
246 widget_->GetWidget()->Close(); | 246 widget_->GetWidget()->Close(); |
247 } | 247 } |
248 | 248 |
249 } // namespace views | 249 } // namespace views |
OLD | NEW |