| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const FileSelectionCanceled& on_failure); | 87 const FileSelectionCanceled& on_failure); |
| 88 | 88 |
| 89 // Handles the activate desktop command for Metro Chrome Ash. The on_success | 89 // Handles the activate desktop command for Metro Chrome Ash. The on_success |
| 90 // callback passed in is invoked when activation is completed. | 90 // callback passed in is invoked when activation is completed. |
| 91 // The |ash_exit| parameter indicates whether the Ash process would be shutdown | 91 // The |ash_exit| parameter indicates whether the Ash process would be shutdown |
| 92 // after activating the desktop. | 92 // after activating the desktop. |
| 93 AURA_EXPORT void HandleActivateDesktop( | 93 AURA_EXPORT void HandleActivateDesktop( |
| 94 const base::FilePath& shortcut, | 94 const base::FilePath& shortcut, |
| 95 bool ash_exit); | 95 bool ash_exit); |
| 96 | 96 |
| 97 // RootWindowHost implementaton that receives events from a different | 97 // WindowTreeHost implementaton that receives events from a different |
| 98 // process. In the case of Windows this is the Windows 8 (aka Metro) | 98 // process. In the case of Windows this is the Windows 8 (aka Metro) |
| 99 // frontend process, which forwards input events to this class. | 99 // frontend process, which forwards input events to this class. |
| 100 class AURA_EXPORT RemoteRootWindowHostWin | 100 class AURA_EXPORT RemoteWindowTreeHostWin |
| 101 : public RootWindowHost, | 101 : public WindowTreeHost, |
| 102 public ui::internal::RemoteInputMethodDelegateWin { | 102 public ui::internal::RemoteInputMethodDelegateWin { |
| 103 public: | 103 public: |
| 104 // Returns the only RemoteRootWindowHostWin, if this is the first time | 104 // Returns the only RemoteWindowTreeHostWin, if this is the first time |
| 105 // this function is called, it will call Create() wiht empty bounds. | 105 // this function is called, it will call Create() wiht empty bounds. |
| 106 static RemoteRootWindowHostWin* Instance(); | 106 static RemoteWindowTreeHostWin* Instance(); |
| 107 static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds); | 107 static RemoteWindowTreeHostWin* Create(const gfx::Rect& bounds); |
| 108 | 108 |
| 109 // Called when the remote process has established its IPC connection. | 109 // Called when the remote process has established its IPC connection. |
| 110 // The |host| can be used when we need to send a message to it and | 110 // The |host| can be used when we need to send a message to it and |
| 111 // |remote_window| is the actual window owned by the viewer process. | 111 // |remote_window| is the actual window owned by the viewer process. |
| 112 void Connected(IPC::Sender* host, HWND remote_window); | 112 void Connected(IPC::Sender* host, HWND remote_window); |
| 113 // Called when the remote process has closed its IPC connection. | 113 // Called when the remote process has closed its IPC connection. |
| 114 void Disconnected(); | 114 void Disconnected(); |
| 115 | 115 |
| 116 // Called when we have a message from the remote process. | 116 // Called when we have a message from the remote process. |
| 117 bool OnMessageReceived(const IPC::Message& message); | 117 bool OnMessageReceived(const IPC::Message& message); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void HandleWindowSizeChanged(uint32 width, uint32 height); | 152 void HandleWindowSizeChanged(uint32 width, uint32 height); |
| 153 | 153 |
| 154 // Returns the active ASH root window. | 154 // Returns the active ASH root window. |
| 155 Window* GetAshWindow(); | 155 Window* GetAshWindow(); |
| 156 | 156 |
| 157 // Returns true if the remote window is the foreground window according to the | 157 // Returns true if the remote window is the foreground window according to the |
| 158 // OS. | 158 // OS. |
| 159 bool IsForegroundWindow(); | 159 bool IsForegroundWindow(); |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 explicit RemoteRootWindowHostWin(const gfx::Rect& bounds); | 162 explicit RemoteWindowTreeHostWin(const gfx::Rect& bounds); |
| 163 virtual ~RemoteRootWindowHostWin(); | 163 virtual ~RemoteWindowTreeHostWin(); |
| 164 | 164 |
| 165 // IPC message handing methods: | 165 // IPC message handing methods: |
| 166 void OnMouseMoved(int32 x, int32 y, int32 flags); | 166 void OnMouseMoved(int32 x, int32 y, int32 flags); |
| 167 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params); | 167 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params); |
| 168 void OnKeyDown(uint32 vkey, | 168 void OnKeyDown(uint32 vkey, |
| 169 uint32 repeat_count, | 169 uint32 repeat_count, |
| 170 uint32 scan_code, | 170 uint32 scan_code, |
| 171 uint32 flags); | 171 uint32 flags); |
| 172 void OnKeyUp(uint32 vkey, | 172 void OnKeyUp(uint32 vkey, |
| 173 uint32 repeat_count, | 173 uint32 repeat_count, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 194 ui::RemoteInputMethodPrivateWin* GetRemoteInputMethodPrivate(); | 194 ui::RemoteInputMethodPrivateWin* GetRemoteInputMethodPrivate(); |
| 195 void OnImeCandidatePopupChanged(bool visible); | 195 void OnImeCandidatePopupChanged(bool visible); |
| 196 void OnImeCompositionChanged( | 196 void OnImeCompositionChanged( |
| 197 const base::string16& text, | 197 const base::string16& text, |
| 198 int32 selection_start, | 198 int32 selection_start, |
| 199 int32 selection_end, | 199 int32 selection_end, |
| 200 const std::vector<metro_viewer::UnderlineInfo>& underlines); | 200 const std::vector<metro_viewer::UnderlineInfo>& underlines); |
| 201 void OnImeTextCommitted(const base::string16& text); | 201 void OnImeTextCommitted(const base::string16& text); |
| 202 void OnImeInputSourceChanged(uint16 language_id, bool is_ime); | 202 void OnImeInputSourceChanged(uint16 language_id, bool is_ime); |
| 203 | 203 |
| 204 // RootWindowHost overrides: | 204 // WindowTreeHost overrides: |
| 205 virtual RootWindow* GetRootWindow() OVERRIDE; | 205 virtual RootWindow* GetRootWindow() OVERRIDE; |
| 206 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 206 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 207 virtual void Show() OVERRIDE; | 207 virtual void Show() OVERRIDE; |
| 208 virtual void Hide() OVERRIDE; | 208 virtual void Hide() OVERRIDE; |
| 209 virtual void ToggleFullScreen() OVERRIDE; | 209 virtual void ToggleFullScreen() OVERRIDE; |
| 210 virtual gfx::Rect GetBounds() const OVERRIDE; | 210 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 211 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 211 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 212 virtual gfx::Insets GetInsets() const OVERRIDE; | 212 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 213 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; | 213 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; |
| 214 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 214 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
| 215 virtual void SetCapture() OVERRIDE; | 215 virtual void SetCapture() OVERRIDE; |
| 216 virtual void ReleaseCapture() OVERRIDE; | 216 virtual void ReleaseCapture() OVERRIDE; |
| 217 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 217 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
| 218 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 218 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
| 219 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 219 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
| 220 virtual void UnConfineCursor() OVERRIDE; | 220 virtual void UnConfineCursor() OVERRIDE; |
| 221 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; | 221 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; |
| 222 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 222 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
| 223 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 223 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
| 224 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 224 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
| 225 virtual void PrepareForShutdown() OVERRIDE; | 225 virtual void PrepareForShutdown() OVERRIDE; |
| 226 | 226 |
| 227 // ui::internal::RemoteInputMethodDelegateWin overrides: | 227 // ui::internal::RemoteInputMethodDelegateWin overrides: |
| 228 virtual void CancelComposition() OVERRIDE; | 228 virtual void CancelComposition() OVERRIDE; |
| 229 virtual void OnTextInputClientUpdated( | 229 virtual void OnTextInputClientUpdated( |
| 230 const std::vector<int32>& input_scopes, | 230 const std::vector<int32>& input_scopes, |
| 231 const std::vector<gfx::Rect>& composition_character_bounds) OVERRIDE; | 231 const std::vector<gfx::Rect>& composition_character_bounds) OVERRIDE; |
| 232 | 232 |
| 233 // Helper function to dispatch a keyboard message to the desired target. | 233 // Helper function to dispatch a keyboard message to the desired target. |
| 234 // The default target is the RootWindowHostDelegate. For nested message loop | 234 // The default target is the WindowTreeHostDelegate. For nested message loop |
| 235 // invocations we post a synthetic keyboard message directly into the message | 235 // invocations we post a synthetic keyboard message directly into the message |
| 236 // loop. The dispatcher for the nested loop would then decide how this | 236 // loop. The dispatcher for the nested loop would then decide how this |
| 237 // message is routed. | 237 // message is routed. |
| 238 void DispatchKeyboardMessage(ui::EventType type, | 238 void DispatchKeyboardMessage(ui::EventType type, |
| 239 uint32 vkey, | 239 uint32 vkey, |
| 240 uint32 repeat_count, | 240 uint32 repeat_count, |
| 241 uint32 scan_code, | 241 uint32 scan_code, |
| 242 uint32 flags, | 242 uint32 flags, |
| 243 bool is_character); | 243 bool is_character); |
| 244 | 244 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // Tracking last click event for synthetically generated mouse events. | 277 // Tracking last click event for synthetically generated mouse events. |
| 278 scoped_ptr<ui::MouseEvent> last_mouse_click_event_; | 278 scoped_ptr<ui::MouseEvent> last_mouse_click_event_; |
| 279 | 279 |
| 280 // State of the keyboard/mouse at the time of the last input event. See | 280 // State of the keyboard/mouse at the time of the last input event. See |
| 281 // description of SetEventFlags(). | 281 // description of SetEventFlags(). |
| 282 uint32 event_flags_; | 282 uint32 event_flags_; |
| 283 | 283 |
| 284 // Current size of this root window. | 284 // Current size of this root window. |
| 285 gfx::Size window_size_; | 285 gfx::Size window_size_; |
| 286 | 286 |
| 287 DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin); | 287 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin); |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 } // namespace aura | 290 } // namespace aura |
| 291 | 291 |
| 292 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 292 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
| OLD | NEW |