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

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

Issue 72503002: Remove some pass-thrus on RootWindow API in favor of exposing the RootWindowHost again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura/window_tree_host_delegate.h » ('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_ROOT_WINDOW_HOST_H_ 5 #ifndef UI_AURA_ROOT_WINDOW_HOST_H_
6 #define UI_AURA_ROOT_WINDOW_HOST_H_ 6 #define UI_AURA_ROOT_WINDOW_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 11 matching lines...) Expand all
22 namespace aura { 22 namespace aura {
23 23
24 class RootWindow; 24 class RootWindow;
25 class RootWindowHostDelegate; 25 class RootWindowHostDelegate;
26 26
27 // RootWindowHost bridges between a native window and the embedded RootWindow. 27 // RootWindowHost bridges between a native window and the embedded RootWindow.
28 // It provides the accelerated widget and maps events from the native os to 28 // It provides the accelerated widget and maps events from the native os to
29 // aura. 29 // aura.
30 class AURA_EXPORT RootWindowHost { 30 class AURA_EXPORT RootWindowHost {
31 public: 31 public:
32 virtual ~RootWindowHost() {} 32 virtual ~RootWindowHost();
33 33
34 // Creates a new RootWindowHost. The caller owns the returned value. 34 // Creates a new RootWindowHost. The caller owns the returned value.
35 static RootWindowHost* Create(const gfx::Rect& bounds); 35 static RootWindowHost* Create(const gfx::Rect& bounds);
36 36
37 // Returns the actual size of the screen. 37 // Returns the actual size of the screen.
38 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) 38 // (gfx::Screen only reports on the virtual desktop exposed by Aura.)
39 static gfx::Size GetNativeScreenSize(); 39 static gfx::Size GetNativeScreenSize();
40 40
41 // Sets the delegate, which is normally done by the root window. 41 void set_delegate(RootWindowHostDelegate* delegate) {
42 virtual void SetDelegate(RootWindowHostDelegate* delegate) = 0; 42 delegate_ = delegate;
43 }
43 44
44 virtual RootWindow* GetRootWindow() = 0; 45 virtual RootWindow* GetRootWindow() = 0;
45 46
46 // Returns the accelerated widget. 47 // Returns the accelerated widget.
47 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; 48 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
48 49
49 // Shows the RootWindowHost. 50 // Shows the RootWindowHost.
50 virtual void Show() = 0; 51 virtual void Show() = 0;
51 52
52 // Hides the RootWindowHost. 53 // Hides the RootWindowHost.
53 virtual void Hide() = 0; 54 virtual void Hide() = 0;
54 55
55 // Toggles the host's full screen state. 56 // Toggles the host's full screen state.
56 virtual void ToggleFullScreen() = 0; 57 virtual void ToggleFullScreen() = 0;
57 58
58 // Gets/Sets the size of the RootWindowHost. 59 // Gets/Sets the size of the RootWindowHost.
59 virtual gfx::Rect GetBounds() const = 0; 60 virtual gfx::Rect GetBounds() const = 0;
60 virtual void SetBounds(const gfx::Rect& bounds) = 0; 61 virtual void SetBounds(const gfx::Rect& bounds) = 0;
61 62
62 // Sets/Gets the insets that specifies the effective root window area 63 // Sets/Gets the insets that specifies the effective root window area
63 // in the host window. 64 // in the host window.
64 virtual gfx::Insets GetInsets() const = 0; 65 virtual gfx::Insets GetInsets() const = 0;
65 virtual void SetInsets(const gfx::Insets& insets) = 0; 66 virtual void SetInsets(const gfx::Insets& insets) = 0;
66 67
67 // Returns the location of the RootWindow on native screen. 68 // Converts |point| from the root window's coordinate system to native
68 virtual gfx::Point GetLocationOnNativeScreen() const = 0; 69 // screen's.
70 void ConvertPointToNativeScreen(gfx::Point* point) const;
71
72 // Converts |point| from native screen coordinate system to the root window's.
73 void ConvertPointFromNativeScreen(gfx::Point* point) const;
69 74
70 // Sets the OS capture to the root window. 75 // Sets the OS capture to the root window.
71 virtual void SetCapture() = 0; 76 virtual void SetCapture() = 0;
72 77
73 // Releases OS capture of the root window. 78 // Releases OS capture of the root window.
74 virtual void ReleaseCapture() = 0; 79 virtual void ReleaseCapture() = 0;
75 80
76 // Sets the currently displayed cursor. 81 // Sets the currently displayed cursor.
77 virtual void SetCursor(gfx::NativeCursor cursor) = 0; 82 virtual void SetCursor(gfx::NativeCursor cursor) = 0;
78 83
79 // Queries the mouse's current position relative to the host window and sets 84 // Queries the mouse's current position relative to the host window and sets
80 // it in |location_return|. Returns true if the cursor is within the host 85 // it in |location_return|. Returns true if the cursor is within the host
81 // window. The position set to |location_return| is constrained within the 86 // window. The position set to |location_return| is constrained within the
82 // host window. If the cursor is disabled, returns false and (0, 0) is set to 87 // host window. If the cursor is disabled, returns false and (0, 0) is set to
83 // |location_return|. 88 // |location_return|.
84 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint(). 89 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint().
85 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0; 90 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0;
86 91
87 // Clips the cursor to the bounds of the root window until UnConfineCursor(). 92 // Clips the cursor to the bounds of the root window until UnConfineCursor().
93 // We would like to be able to confine the cursor to that window. However,
94 // currently, we do not have such functionality in X. So we just confine
95 // to the root window. This is ok because this option is currently only
96 // being used in fullscreen mode, so root_window bounds = window bounds.
88 virtual bool ConfineCursorToRootWindow() = 0; 97 virtual bool ConfineCursorToRootWindow() = 0;
89 virtual void UnConfineCursor() = 0; 98 virtual void UnConfineCursor() = 0;
90 99
91 // Called when the cursor visibility has changed. 100 // Called when the cursor visibility has changed.
92 virtual void OnCursorVisibilityChanged(bool show) = 0; 101 virtual void OnCursorVisibilityChanged(bool show) = 0;
93 102
94 // Moves the cursor to the specified location relative to the root window. 103 // Moves the cursor to the specified location relative to the root window.
95 virtual void MoveCursorTo(const gfx::Point& location) = 0; 104 virtual void MoveCursorTo(const gfx::Point& location) = 0;
96 105
97 // Sets if the window should be focused when shown.
98 virtual void SetFocusWhenShown(bool focus_when_shown) = 0;
99
100 // Posts |native_event| to the platform's event queue. 106 // Posts |native_event| to the platform's event queue.
101 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; 107 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0;
102 108
103 // Called when the device scale factor of the root window has chagned. 109 // Called when the device scale factor of the root window has chagned.
104 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; 110 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0;
105 111
106 // Stop listening events in preparation for shutdown. 112 // Stop listening events in preparation for shutdown.
107 virtual void PrepareForShutdown() = 0; 113 virtual void PrepareForShutdown() = 0;
114
115 protected:
116 RootWindowHost();
117
118 // Returns the location of the RootWindow on native screen.
119 virtual gfx::Point GetLocationOnNativeScreen() const = 0;
120
121 RootWindowHostDelegate* delegate_;
122
123 private:
124 DISALLOW_COPY_AND_ASSIGN(RootWindowHost);
108 }; 125 };
109 126
110 } // namespace aura 127 } // namespace aura
111 128
112 #endif // UI_AURA_ROOT_WINDOW_HOST_H_ 129 #endif // UI_AURA_ROOT_WINDOW_HOST_H_
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura/window_tree_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698