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

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

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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
« no previous file with comments | « ui/aura/window_targeter.cc ('k') | ui/aura/window_tree_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef UI_AURA_WINDOW_TREE_HOST_H_ 5 #ifndef UI_AURA_WINDOW_TREE_HOST_H_
6 #define UI_AURA_WINDOW_TREE_HOST_H_ 6 #define UI_AURA_WINDOW_TREE_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/event_types.h" 10 #include "base/event_types.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "ui/aura/aura_export.h" 12 #include "ui/aura/aura_export.h"
13 #include "ui/base/cursor/cursor.h" 13 #include "ui/base/cursor/cursor.h"
14 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 class Insets; 17 class Insets;
18 class Point; 18 class Point;
19 class Rect; 19 class Rect;
20 class Size; 20 class Size;
21 class Transform; 21 class Transform;
22 } 22 }
23 23
24 namespace ui { 24 namespace ui {
25 class Compositor; 25 class Compositor;
26 class ViewProp;
26 } 27 }
27 28
28 namespace aura { 29 namespace aura {
29 class RootWindowTransformer; 30 class RootWindowTransformer;
30 class WindowEventDispatcher; 31 class WindowEventDispatcher;
31 class WindowTreeHostDelegate; 32 class WindowTreeHostDelegate;
32 33
33 // WindowTreeHost bridges between a native window and the embedded RootWindow. 34 // WindowTreeHost bridges between a native window and the embedded RootWindow.
34 // It provides the accelerated widget and maps events from the native os to 35 // It provides the accelerated widget and maps events from the native os to
35 // aura. 36 // aura.
36 class AURA_EXPORT WindowTreeHost { 37 class AURA_EXPORT WindowTreeHost {
37 public: 38 public:
38 virtual ~WindowTreeHost(); 39 virtual ~WindowTreeHost();
39 40
40 // Creates a new WindowTreeHost. The caller owns the returned value. 41 // Creates a new WindowTreeHost. The caller owns the returned value.
41 static WindowTreeHost* Create(const gfx::Rect& bounds); 42 static WindowTreeHost* Create(const gfx::Rect& bounds);
42 43
44 // Returns the WindowTreeHost for the specified accelerated widget, or NULL
45 // if there is none associated.
46 static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget);
47
43 void InitHost(); 48 void InitHost();
44 49
45 void InitCompositor(); 50 void InitCompositor();
46 51
47 // TODO(beng): these will become trivial accessors in a future CL. 52 Window* window() { return window_; }
48 Window* window(); 53 const Window* window() const { return window_; }
49 const Window* window() const;
50 54
51 WindowEventDispatcher* dispatcher() { 55 WindowEventDispatcher* dispatcher() {
52 return const_cast<WindowEventDispatcher*>( 56 return const_cast<WindowEventDispatcher*>(
53 const_cast<const WindowTreeHost*>(this)->dispatcher()); 57 const_cast<const WindowTreeHost*>(this)->dispatcher());
54 } 58 }
55 const WindowEventDispatcher* dispatcher() const { return dispatcher_.get(); } 59 const WindowEventDispatcher* dispatcher() const { return dispatcher_.get(); }
56 60
57 ui::Compositor* compositor() { return compositor_.get(); } 61 ui::Compositor* compositor() { return compositor_.get(); }
58 62
59 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); 63 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 virtual void OnCursorVisibilityChangedNative(bool show) = 0; 190 virtual void OnCursorVisibilityChangedNative(bool show) = 0;
187 191
188 WindowTreeHostDelegate* delegate_; 192 WindowTreeHostDelegate* delegate_;
189 193
190 private: 194 private:
191 // Moves the cursor to the specified location. This method is internally used 195 // Moves the cursor to the specified location. This method is internally used
192 // by MoveCursorTo() and MoveCursorToHostLocation(). 196 // by MoveCursorTo() and MoveCursorToHostLocation().
193 void MoveCursorToInternal(const gfx::Point& root_location, 197 void MoveCursorToInternal(const gfx::Point& root_location,
194 const gfx::Point& host_location); 198 const gfx::Point& host_location);
195 199
200 // We don't use a scoped_ptr for |window_| since we need this ptr to be valid
201 // during its deletion. (Window's dtor notifies observers that may attempt to
202 // reach back up to access this object which will be valid until the end of
203 // the dtor).
204 Window* window_; // Owning.
205
196 scoped_ptr<WindowEventDispatcher> dispatcher_; 206 scoped_ptr<WindowEventDispatcher> dispatcher_;
197 207
198 scoped_ptr<ui::Compositor> compositor_; 208 scoped_ptr<ui::Compositor> compositor_;
199 209
200 scoped_ptr<RootWindowTransformer> transformer_; 210 scoped_ptr<RootWindowTransformer> transformer_;
201 211
202 // Last cursor set. Used for testing. 212 // Last cursor set. Used for testing.
203 gfx::NativeCursor last_cursor_; 213 gfx::NativeCursor last_cursor_;
204 214
215 scoped_ptr<ui::ViewProp> prop_;
216
205 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); 217 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost);
206 }; 218 };
207 219
208 } // namespace aura 220 } // namespace aura
209 221
210 #endif // UI_AURA_WINDOW_TREE_HOST_H_ 222 #endif // UI_AURA_WINDOW_TREE_HOST_H_
OLDNEW
« no previous file with comments | « ui/aura/window_targeter.cc ('k') | ui/aura/window_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698