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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/shell_factory.h" | 6 #include "ash/shell_factory.h" |
7 #include "ash/wm/coordinate_conversion.h" | 7 #include "ash/wm/coordinate_conversion.h" |
8 #include "ash/wm/window_properties.h" | 8 #include "ash/wm/window_properties.h" |
9 #include "ui/aura/client/capture_client.h" | 9 #include "ui/aura/client/capture_client.h" |
10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 ui_controls::UIControlsAura* native_ui_control = | 25 ui_controls::UIControlsAura* native_ui_control = |
26 root_window->GetProperty(kUIControlsKey); | 26 root_window->GetProperty(kUIControlsKey); |
27 if (!native_ui_control) { | 27 if (!native_ui_control) { |
28 native_ui_control = aura::CreateUIControlsAura(root_window); | 28 native_ui_control = aura::CreateUIControlsAura(root_window); |
29 // Pass the ownership to the |root_window|. | 29 // Pass the ownership to the |root_window|. |
30 root_window->SetProperty(kUIControlsKey, native_ui_control); | 30 root_window->SetProperty(kUIControlsKey, native_ui_control); |
31 } | 31 } |
32 return native_ui_control; | 32 return native_ui_control; |
33 } | 33 } |
34 | 34 |
35 // Returns the UIControls object for the RootWindow at the |point| in | 35 // Returns the UIControls object for the RootWindow at the |point_in_screen| |
36 // virtual screen coordinates, and updates the |point| relative to the | 36 // in virtual screen coordinates, and updates the |point| relative to the |
37 // UIControlsAura's root window. NULL if there is no RootWindow under | 37 // UIControlsAura's root window. NULL if there is no RootWindow under |
38 // the |point|. | 38 // the |point_in_screen|. |
39 ui_controls::UIControlsAura* GetUIControlsAt(gfx::Point* point) { | 39 ui_controls::UIControlsAura* GetUIControlsAt(gfx::Point* point_in_screen) { |
40 // If there is a capture events must be relative to it. | 40 // TODO(mazda): Support the case passive grab is taken. |
41 aura::client::CaptureClient* capture_client = | 41 aura::RootWindow* root = wm::GetRootWindowAt(*point_in_screen); |
42 GetCaptureClient(ash::Shell::GetInstance()->GetPrimaryRootWindow()); | |
43 aura::RootWindow* root = NULL; | |
44 if (capture_client && capture_client->GetCaptureWindow()) | |
45 root = capture_client->GetCaptureWindow()->GetRootWindow(); | |
46 else | |
47 root = wm::GetRootWindowAt(*point); | |
48 | 42 |
49 aura::client::ScreenPositionClient* screen_position_client = | 43 aura::client::ScreenPositionClient* screen_position_client = |
50 aura::client::GetScreenPositionClient(root); | 44 aura::client::GetScreenPositionClient(root); |
51 if (screen_position_client) | 45 if (screen_position_client) |
52 screen_position_client->ConvertPointFromScreen(root, point); | 46 screen_position_client->ConvertPointFromScreen(root, point_in_screen); |
53 | 47 |
54 return GetUIControlsForRootWindow(root); | 48 return GetUIControlsForRootWindow(root); |
55 } | 49 } |
56 | 50 |
57 } // namespace | 51 } // namespace |
58 | 52 |
59 class UIControlsAsh : public ui_controls::UIControlsAura { | 53 class UIControlsAsh : public ui_controls::UIControlsAura { |
60 public: | 54 public: |
61 UIControlsAsh() { | 55 UIControlsAsh() { |
62 } | 56 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 private: | 133 private: |
140 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); | 134 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); |
141 }; | 135 }; |
142 | 136 |
143 ui_controls::UIControlsAura* CreateUIControls() { | 137 ui_controls::UIControlsAura* CreateUIControls() { |
144 return new UIControlsAsh(); | 138 return new UIControlsAsh(); |
145 } | 139 } |
146 | 140 |
147 } // namespace internal | 141 } // namespace internal |
148 } // namespace ash | 142 } // namespace ash |
OLD | NEW |