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_ROOT_WINDOW_HOST_WIN_H_ | 5 #ifndef UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
6 #define UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 6 #define UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 AURA_EXPORT void HandleSelectFolder(const base::string16& title, | 82 AURA_EXPORT void HandleSelectFolder(const base::string16& title, |
83 const SelectFolderCompletion& on_success, | 83 const SelectFolderCompletion& on_success, |
84 const FileSelectionCanceled& on_failure); | 84 const FileSelectionCanceled& on_failure); |
85 | 85 |
86 // Handles the activate desktop command for Metro Chrome Ash. The on_success | 86 // Handles the activate desktop command for Metro Chrome Ash. The on_success |
87 // callback passed in is invoked when activation is completed. | 87 // callback passed in is invoked when activation is completed. |
88 AURA_EXPORT void HandleActivateDesktop( | 88 AURA_EXPORT void HandleActivateDesktop( |
89 const base::FilePath& shortcut, | 89 const base::FilePath& shortcut, |
90 const ActivateDesktopCompleted& on_success); | 90 const ActivateDesktopCompleted& on_success); |
91 | 91 |
92 // WindowTreeHost implementaton that receives events from a different | 92 // RootWindowHost implementaton that receives events from a different |
93 // process. In the case of Windows this is the Windows 8 (aka Metro) | 93 // process. In the case of Windows this is the Windows 8 (aka Metro) |
94 // frontend process, which forwards input events to this class. | 94 // frontend process, which forwards input events to this class. |
95 class AURA_EXPORT RemoteWindowTreeHostWin : public WindowTreeHost { | 95 class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { |
96 public: | 96 public: |
97 // Returns the only RemoteWindowTreeHostWin, if this is the first time | 97 // Returns the only RemoteRootWindowHostWin, if this is the first time |
98 // this function is called, it will call Create() wiht empty bounds. | 98 // this function is called, it will call Create() wiht empty bounds. |
99 static RemoteWindowTreeHostWin* Instance(); | 99 static RemoteRootWindowHostWin* Instance(); |
100 static RemoteWindowTreeHostWin* Create(const gfx::Rect& bounds); | 100 static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds); |
101 | 101 |
102 // Called when the remote process has established its IPC connection. | 102 // Called when the remote process has established its IPC connection. |
103 // The |host| can be used when we need to send a message to it and | 103 // The |host| can be used when we need to send a message to it and |
104 // |remote_window| is the actual window owned by the viewer process. | 104 // |remote_window| is the actual window owned by the viewer process. |
105 void Connected(IPC::Sender* host, HWND remote_window); | 105 void Connected(IPC::Sender* host, HWND remote_window); |
106 // Called when the remote process has closed its IPC connection. | 106 // Called when the remote process has closed its IPC connection. |
107 void Disconnected(); | 107 void Disconnected(); |
108 | 108 |
109 // Called when we have a message from the remote process. | 109 // Called when we have a message from the remote process. |
110 bool OnMessageReceived(const IPC::Message& message); | 110 bool OnMessageReceived(const IPC::Message& message); |
(...skipping 29 matching lines...) Expand all Loading... |
140 const FileSelectionCanceled& on_failure); | 140 const FileSelectionCanceled& on_failure); |
141 | 141 |
142 // Returns the active ASH root window. | 142 // Returns the active ASH root window. |
143 Window* GetAshWindow(); | 143 Window* GetAshWindow(); |
144 | 144 |
145 // Returns true if the remote window is the foreground window according to the | 145 // Returns true if the remote window is the foreground window according to the |
146 // OS. | 146 // OS. |
147 bool IsForegroundWindow(); | 147 bool IsForegroundWindow(); |
148 | 148 |
149 private: | 149 private: |
150 explicit RemoteWindowTreeHostWin(const gfx::Rect& bounds); | 150 explicit RemoteRootWindowHostWin(const gfx::Rect& bounds); |
151 virtual ~RemoteWindowTreeHostWin(); | 151 virtual ~RemoteRootWindowHostWin(); |
152 | 152 |
153 // IPC message handing methods: | 153 // IPC message handing methods: |
154 void OnMouseMoved(int32 x, int32 y, int32 flags); | 154 void OnMouseMoved(int32 x, int32 y, int32 flags); |
155 void OnMouseButton(int32 x, | 155 void OnMouseButton(int32 x, |
156 int32 y, | 156 int32 y, |
157 int32 extra, | 157 int32 extra, |
158 ui::EventType type, | 158 ui::EventType type, |
159 ui::EventFlags flags); | 159 ui::EventFlags flags); |
160 void OnKeyDown(uint32 vkey, | 160 void OnKeyDown(uint32 vkey, |
161 uint32 repeat_count, | 161 uint32 repeat_count, |
(...skipping 15 matching lines...) Expand all Loading... |
177 const base::FilePath& filename, | 177 const base::FilePath& filename, |
178 int filter_index); | 178 int filter_index); |
179 void OnFileOpenDone(bool success, const base::FilePath& filename); | 179 void OnFileOpenDone(bool success, const base::FilePath& filename); |
180 void OnMultiFileOpenDone(bool success, | 180 void OnMultiFileOpenDone(bool success, |
181 const std::vector<base::FilePath>& files); | 181 const std::vector<base::FilePath>& files); |
182 void OnSelectFolderDone(bool success, const base::FilePath& folder); | 182 void OnSelectFolderDone(bool success, const base::FilePath& folder); |
183 void OnSetCursorPosAck(); | 183 void OnSetCursorPosAck(); |
184 void OnWindowSizeChanged(uint32 width, uint32 height); | 184 void OnWindowSizeChanged(uint32 width, uint32 height); |
185 void OnDesktopActivated(); | 185 void OnDesktopActivated(); |
186 | 186 |
187 // WindowTreeHost overrides: | 187 // RootWindowHost overrides: |
188 virtual RootWindow* GetRootWindow() OVERRIDE; | 188 virtual RootWindow* GetRootWindow() OVERRIDE; |
189 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 189 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
190 virtual void Show() OVERRIDE; | 190 virtual void Show() OVERRIDE; |
191 virtual void Hide() OVERRIDE; | 191 virtual void Hide() OVERRIDE; |
192 virtual void ToggleFullScreen() OVERRIDE; | 192 virtual void ToggleFullScreen() OVERRIDE; |
193 virtual gfx::Rect GetBounds() const OVERRIDE; | 193 virtual gfx::Rect GetBounds() const OVERRIDE; |
194 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 194 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
195 virtual gfx::Insets GetInsets() const OVERRIDE; | 195 virtual gfx::Insets GetInsets() const OVERRIDE; |
196 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; | 196 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; |
197 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 197 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
198 virtual void SetCapture() OVERRIDE; | 198 virtual void SetCapture() OVERRIDE; |
199 virtual void ReleaseCapture() OVERRIDE; | 199 virtual void ReleaseCapture() OVERRIDE; |
200 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 200 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
201 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 201 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
202 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 202 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
203 virtual void UnConfineCursor() OVERRIDE; | 203 virtual void UnConfineCursor() OVERRIDE; |
204 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; | 204 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; |
205 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 205 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
206 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 206 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
207 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 207 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
208 virtual void PrepareForShutdown() OVERRIDE; | 208 virtual void PrepareForShutdown() OVERRIDE; |
209 | 209 |
210 // Helper function to dispatch a keyboard message to the desired target. | 210 // Helper function to dispatch a keyboard message to the desired target. |
211 // The default target is the WindowTreeHostDelegate. For nested message loop | 211 // The default target is the RootWindowHostDelegate. For nested message loop |
212 // invocations we post a synthetic keyboard message directly into the message | 212 // invocations we post a synthetic keyboard message directly into the message |
213 // loop. The dispatcher for the nested loop would then decide how this | 213 // loop. The dispatcher for the nested loop would then decide how this |
214 // message is routed. | 214 // message is routed. |
215 void DispatchKeyboardMessage(ui::EventType type, | 215 void DispatchKeyboardMessage(ui::EventType type, |
216 uint32 vkey, | 216 uint32 vkey, |
217 uint32 repeat_count, | 217 uint32 repeat_count, |
218 uint32 scan_code, | 218 uint32 scan_code, |
219 uint32 flags, | 219 uint32 flags, |
220 bool is_character); | 220 bool is_character); |
221 | 221 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // operation is acked by the viewer. | 255 // operation is acked by the viewer. |
256 bool ignore_mouse_moves_until_set_cursor_ack_; | 256 bool ignore_mouse_moves_until_set_cursor_ack_; |
257 | 257 |
258 // Tracking last click event for synthetically generated mouse events. | 258 // Tracking last click event for synthetically generated mouse events. |
259 scoped_ptr<ui::MouseEvent> last_mouse_click_event_; | 259 scoped_ptr<ui::MouseEvent> last_mouse_click_event_; |
260 | 260 |
261 // State of the keyboard/mouse at the time of the last input event. See | 261 // State of the keyboard/mouse at the time of the last input event. See |
262 // description of SetEventFlags(). | 262 // description of SetEventFlags(). |
263 uint32 event_flags_; | 263 uint32 event_flags_; |
264 | 264 |
265 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin); | 265 DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin); |
266 }; | 266 }; |
267 | 267 |
268 } // namespace aura | 268 } // namespace aura |
269 | 269 |
270 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 270 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
OLD | NEW |