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/window_properties.h" | 8 #include "ash/wm/window_properties.h" |
8 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
9 #include "ui/aura/ui_controls_aura.h" | 10 #include "ui/aura/ui_controls_aura.h" |
10 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
11 #include "ui/ui_controls/ui_controls_aura.h" | 12 #include "ui/ui_controls/ui_controls_aura.h" |
12 | 13 |
13 namespace ash { | 14 namespace ash { |
14 namespace internal { | 15 namespace internal { |
15 namespace { | 16 namespace { |
16 | 17 |
17 // Returns the UIControls object for RootWindow. | 18 // Returns the UIControls object for RootWindow. |
18 // kUIControlsKey is owned property and UIControls object | 19 // kUIControlsKey is owned property and UIControls object |
19 // will be deleted when the root window is deleted. | 20 // will be deleted when the root window is deleted. |
20 ui_controls::UIControlsAura* GetUIControlsForRootWindow( | 21 ui_controls::UIControlsAura* GetUIControlsForRootWindow( |
21 aura::RootWindow* root_window) { | 22 aura::RootWindow* root_window) { |
22 ui_controls::UIControlsAura* native_ui_control = | 23 ui_controls::UIControlsAura* native_ui_control = |
23 root_window->GetProperty(kUIControlsKey); | 24 root_window->GetProperty(kUIControlsKey); |
24 if (!native_ui_control) { | 25 if (!native_ui_control) { |
25 native_ui_control = aura::CreateUIControlsAura(root_window); | 26 native_ui_control = aura::CreateUIControlsAura(root_window); |
26 // Pass the ownership to the |root_window|. | 27 // Pass the ownership to the |root_window|. |
27 root_window->SetProperty(kUIControlsKey, native_ui_control); | 28 root_window->SetProperty(kUIControlsKey, native_ui_control); |
28 } | 29 } |
29 return native_ui_control; | 30 return native_ui_control; |
30 } | 31 } |
31 | 32 |
32 // Returns the UIControls object for the RootWindow at the |point| in | 33 // Returns the UIControls object for the RootWindow at the |point| in |
33 // absolute screen coordinates. NULL if there is no RootWindow under the | 34 // absolute screen coordinates. NULL if there is no RootWindow under the |
34 // |point|. | 35 // |point|. |
35 ui_controls::UIControlsAura* GetUIControlsAt(const gfx::Point& point) { | 36 ui_controls::UIControlsAura* GetUIControlsAt(const gfx::Point& point) { |
36 aura::RootWindow* root = Shell::GetRootWindowAt(point); | 37 aura::RootWindow* root = wm::GetRootWindowAt(point); |
37 return root ? GetUIControlsForRootWindow(root) : NULL; | 38 return root ? GetUIControlsForRootWindow(root) : NULL; |
38 } | 39 } |
39 | 40 |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 class UIControlsAsh : public ui_controls::UIControlsAura { | 43 class UIControlsAsh : public ui_controls::UIControlsAura { |
43 public: | 44 public: |
44 UIControlsAsh() { | 45 UIControlsAsh() { |
45 } | 46 } |
46 virtual ~UIControlsAsh() { | 47 virtual ~UIControlsAsh() { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 private: | 123 private: |
123 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); | 124 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); |
124 }; | 125 }; |
125 | 126 |
126 ui_controls::UIControlsAura* CreateUIControls() { | 127 ui_controls::UIControlsAura* CreateUIControls() { |
127 return new UIControlsAsh(); | 128 return new UIControlsAsh(); |
128 } | 129 } |
129 | 130 |
130 } // namespace internal | 131 } // namespace internal |
131 } // namespace ash | 132 } // namespace ash |
OLD | NEW |