OLD | NEW |
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_REMOTE_WINDOW_TREE_HOST_WIN_H_ | 5 #ifndef UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ |
6 #define UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ | 6 #define UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // WindowTreeHost implementaton that receives events from a different | 101 // WindowTreeHost implementaton that receives events from a different |
102 // process. In the case of Windows this is the Windows 8 (aka Metro) | 102 // process. In the case of Windows this is the Windows 8 (aka Metro) |
103 // frontend process, which forwards input events to this class. | 103 // frontend process, which forwards input events to this class. |
104 class AURA_EXPORT RemoteWindowTreeHostWin | 104 class AURA_EXPORT RemoteWindowTreeHostWin |
105 : public WindowTreeHost, | 105 : public WindowTreeHost, |
106 public ui::EventSource, | 106 public ui::EventSource, |
107 public ui::internal::RemoteInputMethodDelegateWin { | 107 public ui::internal::RemoteInputMethodDelegateWin { |
108 public: | 108 public: |
109 // Returns the only RemoteWindowTreeHostWin, if this is the first time | 109 // Returns the only RemoteWindowTreeHostWin, if this is the first time |
110 // this function is called, it will call Create() wiht empty bounds. | 110 // this function is called and the instance have never set by SetInstance, |
| 111 // it will call Create() wiht empty bounds. |
111 static RemoteWindowTreeHostWin* Instance(); | 112 static RemoteWindowTreeHostWin* Instance(); |
112 static RemoteWindowTreeHostWin* Create(const gfx::Rect& bounds); | 113 |
| 114 // Manually sets the instance to be used as a return value of |Instance()| |
| 115 // method above. This should not be called if the instance has already |
| 116 // been set or created, and doing so will result in CHECK failure. |
| 117 static void SetInstance(RemoteWindowTreeHostWin* instance); |
113 | 118 |
114 // Returns true if there is a RemoteWindowTreeHostWin and it has a valid | 119 // Returns true if there is a RemoteWindowTreeHostWin and it has a valid |
115 // HWND. A return value of false typically indicates we're not in metro mode. | 120 // HWND. A return value of false typically indicates we're not in metro mode. |
116 static bool IsValid(); | 121 static bool IsValid(); |
117 | 122 |
118 // Sets the handle to the remote window. The |remote_window| is the actual | 123 // Sets the handle to the remote window. The |remote_window| is the actual |
119 // window owned by the viewer process. Call this before Connected() for some | 124 // window owned by the viewer process. Call this before Connected() for some |
120 // customers like input method initialization which needs the handle. | 125 // customers like input method initialization which needs the handle. |
121 void SetRemoteWindowHandle(HWND remote_window); | 126 void SetRemoteWindowHandle(HWND remote_window); |
122 | 127 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 169 |
165 void HandleWindowSizeChanged(uint32 width, uint32 height); | 170 void HandleWindowSizeChanged(uint32 width, uint32 height); |
166 | 171 |
167 // Returns the active ASH root window. | 172 // Returns the active ASH root window. |
168 Window* GetAshWindow(); | 173 Window* GetAshWindow(); |
169 | 174 |
170 // Returns true if the remote window is the foreground window according to the | 175 // Returns true if the remote window is the foreground window according to the |
171 // OS. | 176 // OS. |
172 bool IsForegroundWindow(); | 177 bool IsForegroundWindow(); |
173 | 178 |
174 private: | 179 protected: |
175 explicit RemoteWindowTreeHostWin(const gfx::Rect& bounds); | 180 explicit RemoteWindowTreeHostWin(const gfx::Rect& bounds); |
176 virtual ~RemoteWindowTreeHostWin(); | 181 virtual ~RemoteWindowTreeHostWin(); |
177 | 182 |
| 183 private: |
178 // IPC message handing methods: | 184 // IPC message handing methods: |
179 void OnMouseMoved(int32 x, int32 y, int32 flags); | 185 void OnMouseMoved(int32 x, int32 y, int32 flags); |
180 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params); | 186 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params); |
181 void OnKeyDown(uint32 vkey, | 187 void OnKeyDown(uint32 vkey, |
182 uint32 repeat_count, | 188 uint32 repeat_count, |
183 uint32 scan_code, | 189 uint32 scan_code, |
184 uint32 flags); | 190 uint32 flags); |
185 void OnKeyUp(uint32 vkey, | 191 void OnKeyUp(uint32 vkey, |
186 uint32 repeat_count, | 192 uint32 repeat_count, |
187 uint32 scan_code, | 193 uint32 scan_code, |
(...skipping 24 matching lines...) Expand all Loading... |
212 int32 selection_start, | 218 int32 selection_start, |
213 int32 selection_end, | 219 int32 selection_end, |
214 const std::vector<metro_viewer::UnderlineInfo>& underlines); | 220 const std::vector<metro_viewer::UnderlineInfo>& underlines); |
215 void OnImeTextCommitted(const base::string16& text); | 221 void OnImeTextCommitted(const base::string16& text); |
216 void OnImeInputSourceChanged(uint16 language_id, bool is_ime); | 222 void OnImeInputSourceChanged(uint16 language_id, bool is_ime); |
217 | 223 |
218 // WindowTreeHost overrides: | 224 // WindowTreeHost overrides: |
219 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 225 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
220 virtual void Show() OVERRIDE; | 226 virtual void Show() OVERRIDE; |
221 virtual void Hide() OVERRIDE; | 227 virtual void Hide() OVERRIDE; |
222 virtual void ToggleFullScreen() OVERRIDE; | |
223 virtual gfx::Rect GetBounds() const OVERRIDE; | 228 virtual gfx::Rect GetBounds() const OVERRIDE; |
224 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 229 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
225 virtual gfx::Insets GetInsets() const OVERRIDE; | |
226 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; | |
227 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 230 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
228 virtual void SetCapture() OVERRIDE; | 231 virtual void SetCapture() OVERRIDE; |
229 virtual void ReleaseCapture() OVERRIDE; | 232 virtual void ReleaseCapture() OVERRIDE; |
230 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 233 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
231 virtual bool ConfineCursorToRootWindow() OVERRIDE; | |
232 virtual void UnConfineCursor() OVERRIDE; | |
233 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 234 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
234 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 235 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
235 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; | 236 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; |
236 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 237 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
237 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 238 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
238 | 239 |
239 // ui::EventSource: | 240 // ui::EventSource: |
240 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 241 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
241 | 242 |
242 // ui::internal::RemoteInputMethodDelegateWin overrides: | 243 // ui::internal::RemoteInputMethodDelegateWin overrides: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 299 |
299 // Current size of this root window. | 300 // Current size of this root window. |
300 gfx::Size window_size_; | 301 gfx::Size window_size_; |
301 | 302 |
302 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin); | 303 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin); |
303 }; | 304 }; |
304 | 305 |
305 } // namespace aura | 306 } // namespace aura |
306 | 307 |
307 #endif // UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ | 308 #endif // UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ |
OLD | NEW |