Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: ui/aura/desktop.h

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class AURA_EXPORT Desktop : public ui::CompositorDelegate, 42 class AURA_EXPORT Desktop : public ui::CompositorDelegate,
43 public Window, 43 public Window,
44 public internal::FocusManager { 44 public internal::FocusManager {
45 public: 45 public:
46 Desktop(); 46 Desktop();
47 virtual ~Desktop(); 47 virtual ~Desktop();
48 48
49 static Desktop* GetInstance(); 49 static Desktop* GetInstance();
50 static void DeleteInstanceForTesting(); 50 static void DeleteInstanceForTesting();
51 51
52 static void set_compositor_factory_for_testing(ui::Compositor*(*factory)()) {
53 compositor_factory_ = factory;
54 }
55 static ui::Compositor* (*compositor_factory())() {
56 return compositor_factory_;
57 }
58
59 ui::Compositor* compositor() { return compositor_.get(); } 52 ui::Compositor* compositor() { return compositor_.get(); }
60 gfx::Point last_mouse_location() const { return last_mouse_location_; } 53 gfx::Point last_mouse_location() const { return last_mouse_location_; }
61 DesktopDelegate* delegate() { return delegate_.get(); } 54 DesktopDelegate* delegate() { return delegate_.get(); }
62 Window* active_window() { return active_window_; } 55 Window* active_window() { return active_window_; }
63 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } 56 Window* mouse_pressed_handler() { return mouse_pressed_handler_; }
64 Window* capture_window() { return capture_window_; } 57 Window* capture_window() { return capture_window_; }
65 ScreenAura* screen() { return screen_; } 58 ScreenAura* screen() { return screen_; }
66 59
67 void SetDelegate(DesktopDelegate* delegate); 60 void SetDelegate(DesktopDelegate* delegate);
68 61
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 156
164 scoped_ptr<DesktopHost> host_; 157 scoped_ptr<DesktopHost> host_;
165 158
166 scoped_ptr<DesktopDelegate> delegate_; 159 scoped_ptr<DesktopDelegate> delegate_;
167 160
168 static Desktop* instance_; 161 static Desktop* instance_;
169 162
170 // Used to schedule painting. 163 // Used to schedule painting.
171 base::WeakPtrFactory<Desktop> schedule_paint_factory_; 164 base::WeakPtrFactory<Desktop> schedule_paint_factory_;
172 165
173 // Factory used to create Compositors. Settable by tests.
174 static ui::Compositor*(*compositor_factory_)();
175
176 Window* active_window_; 166 Window* active_window_;
177 167
178 // Last location seen in a mouse event. 168 // Last location seen in a mouse event.
179 gfx::Point last_mouse_location_; 169 gfx::Point last_mouse_location_;
180 170
181 // Are we in the process of being destroyed? Used to avoid processing during 171 // Are we in the process of being destroyed? Used to avoid processing during
182 // destruction. 172 // destruction.
183 bool in_destructor_; 173 bool in_destructor_;
184 174
185 ObserverList<DesktopObserver> observers_; 175 ObserverList<DesktopObserver> observers_;
186 176
187 ScreenAura* screen_; 177 ScreenAura* screen_;
188 178
189 // The capture window. When not-null, this window receives all the mouse and 179 // The capture window. When not-null, this window receives all the mouse and
190 // touch events. 180 // touch events.
191 Window* capture_window_; 181 Window* capture_window_;
192 182
193 Window* mouse_pressed_handler_; 183 Window* mouse_pressed_handler_;
194 Window* mouse_moved_handler_; 184 Window* mouse_moved_handler_;
195 Window* focused_window_; 185 Window* focused_window_;
196 Window* touch_event_handler_; 186 Window* touch_event_handler_;
197 187
198 DISALLOW_COPY_AND_ASSIGN(Desktop); 188 DISALLOW_COPY_AND_ASSIGN(Desktop);
199 }; 189 };
200 190
201 } // namespace aura 191 } // namespace aura
202 192
203 #endif // UI_AURA_DESKTOP_H_ 193 #endif // UI_AURA_DESKTOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698