OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_AURA_DESKTOP_H_ | 5 #ifndef UI_AURA_DESKTOP_H_ |
6 #define UI_AURA_DESKTOP_H_ | 6 #define UI_AURA_DESKTOP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool OnTouchEvent(const TouchEvent& event); | 72 bool OnTouchEvent(const TouchEvent& event); |
73 | 73 |
74 // Called when the host changes size. | 74 // Called when the host changes size. |
75 void OnHostResized(const gfx::Size& size); | 75 void OnHostResized(const gfx::Size& size); |
76 | 76 |
77 // Compositor we're drawing to. | 77 // Compositor we're drawing to. |
78 ui::Compositor* compositor() { return compositor_.get(); } | 78 ui::Compositor* compositor() { return compositor_.get(); } |
79 | 79 |
80 Window* window() { return window_.get(); } | 80 Window* window() { return window_.get(); } |
81 | 81 |
82 static void set_compositor_factory_for_testing(ui::Compositor*(*factory)()) { | |
83 compositor_factory_ = factory; | |
84 } | |
85 static ui::Compositor* (*compositor_factory())() { | |
86 return compositor_factory_; | |
87 } | |
88 | |
89 // Sets the active window to |window| and the focused window to |to_focus|. | 82 // Sets the active window to |window| and the focused window to |to_focus|. |
90 // If |to_focus| is NULL, |window| is focused. | 83 // If |to_focus| is NULL, |window| is focused. |
91 void SetActiveWindow(Window* window, Window* to_focus); | 84 void SetActiveWindow(Window* window, Window* to_focus); |
92 Window* active_window() { return active_window_; } | 85 Window* active_window() { return active_window_; } |
93 | 86 |
94 // Activates the topmost window. Does nothing if the topmost window is already | 87 // Activates the topmost window. Does nothing if the topmost window is already |
95 // active. | 88 // active. |
96 void ActivateTopmostWindow(); | 89 void ActivateTopmostWindow(); |
97 | 90 |
98 // Deactivates |window| and activates the topmost window. Does nothing if | 91 // Deactivates |window| and activates the topmost window. Does nothing if |
(...skipping 26 matching lines...) Expand all Loading... |
125 | 118 |
126 scoped_ptr<internal::RootWindow> window_; | 119 scoped_ptr<internal::RootWindow> window_; |
127 | 120 |
128 scoped_ptr<DesktopHost> host_; | 121 scoped_ptr<DesktopHost> host_; |
129 | 122 |
130 static Desktop* instance_; | 123 static Desktop* instance_; |
131 | 124 |
132 // Used to schedule painting. | 125 // Used to schedule painting. |
133 base::WeakPtrFactory<Desktop> schedule_paint_factory_; | 126 base::WeakPtrFactory<Desktop> schedule_paint_factory_; |
134 | 127 |
135 // Factory used to create Compositors. Settable by tests. | |
136 static ui::Compositor*(*compositor_factory_)(); | |
137 | |
138 Window* active_window_; | 128 Window* active_window_; |
139 | 129 |
140 // Last location seen in a mouse event. | 130 // Last location seen in a mouse event. |
141 gfx::Point last_mouse_location_; | 131 gfx::Point last_mouse_location_; |
142 | 132 |
143 // Are we in the process of being destroyed? Used to avoid processing during | 133 // Are we in the process of being destroyed? Used to avoid processing during |
144 // destruction. | 134 // destruction. |
145 bool in_destructor_; | 135 bool in_destructor_; |
146 | 136 |
147 ObserverList<DesktopObserver> observers_; | 137 ObserverList<DesktopObserver> observers_; |
148 | 138 |
149 DISALLOW_COPY_AND_ASSIGN(Desktop); | 139 DISALLOW_COPY_AND_ASSIGN(Desktop); |
150 }; | 140 }; |
151 | 141 |
152 } // namespace aura | 142 } // namespace aura |
153 | 143 |
154 #endif // UI_AURA_DESKTOP_H_ | 144 #endif // UI_AURA_DESKTOP_H_ |
OLD | NEW |