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

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: cleanup Created 9 years, 2 months 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bool OnKeyEvent(const KeyEvent& event); 63 bool OnKeyEvent(const KeyEvent& event);
64 64
65 // Called when the host changes size. 65 // Called when the host changes size.
66 void OnHostResized(const gfx::Size& size); 66 void OnHostResized(const gfx::Size& size);
67 67
68 // Compositor we're drawing to. 68 // Compositor we're drawing to.
69 ui::Compositor* compositor() { return compositor_.get(); } 69 ui::Compositor* compositor() { return compositor_.get(); }
70 70
71 Window* window() { return window_.get(); } 71 Window* window() { return window_.get(); }
72 72
73 static void set_compositor_factory_for_testing(ui::Compositor*(*factory)()) { 73 static void set_compositor_factory_for_testing(
74 ui::Compositor*(*factory)(ui::CompositorDelegate* owner)) {
74 compositor_factory_ = factory; 75 compositor_factory_ = factory;
75 } 76 }
76 static ui::Compositor* (*compositor_factory())() { 77 static ui::Compositor* (*compositor_factory())(
78 ui::CompositorDelegate *owner) {
77 return compositor_factory_; 79 return compositor_factory_;
78 } 80 }
danakj 2011/10/14 15:15:13 Since this is in ui::Compositor now, it can just u
79 81
80 // 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|.
81 // If |to_focus| is NULL, |window| is focused. 83 // If |to_focus| is NULL, |window| is focused.
82 void SetActiveWindow(Window* window, Window* to_focus); 84 void SetActiveWindow(Window* window, Window* to_focus);
83 Window* active_window() { return active_window_; } 85 Window* active_window() { return active_window_; }
84 86
85 // 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
86 // active. 88 // active.
87 void ActivateTopmostWindow(); 89 void ActivateTopmostWindow();
88 90
(...skipping 24 matching lines...) Expand all
113 scoped_ptr<internal::RootWindow> window_; 115 scoped_ptr<internal::RootWindow> window_;
114 116
115 scoped_ptr<DesktopHost> host_; 117 scoped_ptr<DesktopHost> host_;
116 118
117 static Desktop* instance_; 119 static Desktop* instance_;
118 120
119 // Used to schedule painting. 121 // Used to schedule painting.
120 base::WeakPtrFactory<Desktop> schedule_paint_factory_; 122 base::WeakPtrFactory<Desktop> schedule_paint_factory_;
121 123
122 // Factory used to create Compositors. Settable by tests. 124 // Factory used to create Compositors. Settable by tests.
123 static ui::Compositor*(*compositor_factory_)(); 125 static ui::Compositor*(*compositor_factory_)(ui::CompositorDelegate* owner);
124 126
125 Window* active_window_; 127 Window* active_window_;
126 128
127 // Are we in the process of being destroyed? Used to avoid processing during 129 // Are we in the process of being destroyed? Used to avoid processing during
128 // destruction. 130 // destruction.
129 bool in_destructor_; 131 bool in_destructor_;
130 132
131 DISALLOW_COPY_AND_ASSIGN(Desktop); 133 DISALLOW_COPY_AND_ASSIGN(Desktop);
132 }; 134 };
133 135
134 } // namespace aura 136 } // namespace aura
135 137
136 #endif // UI_AURA_DESKTOP_H_ 138 #endif // UI_AURA_DESKTOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698