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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 AURA_EXPORT void HandleMetroExit(); | 99 AURA_EXPORT void HandleMetroExit(); |
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 current RemoteWindowTreeHostWin. This does *not* create a |
110 // this function is called and the instance have never set by SetInstance, | 110 // RemoteWindowTreeHostWin. |
111 // it will call Create() wiht empty bounds. | |
112 static RemoteWindowTreeHostWin* Instance(); | 111 static RemoteWindowTreeHostWin* Instance(); |
113 | 112 |
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); | |
118 | |
119 // Returns true if there is a RemoteWindowTreeHostWin and it has a valid | 113 // Returns true if there is a RemoteWindowTreeHostWin and it has a valid |
120 // HWND. A return value of false typically indicates we're not in metro mode. | 114 // HWND. A return value of false typically indicates we're not in metro mode. |
121 static bool IsValid(); | 115 static bool IsValid(); |
122 | 116 |
123 // Sets the handle to the remote window and the scale factor. The | 117 // Sets the handle to the remote window. The |remote_window| is the actual |
124 // |remote_window| is the actual window owned by the viewer process. Call | 118 // window owned by the viewer process. Call this before Connected() for some |
125 // this before Connected() for some customers like input method | 119 // customers like input method initialization which needs the handle. |
126 // initialization which needs the handle. | 120 void SetRemoteWindowHandle(HWND remote_window); |
127 // |device_scale| indicates the Windows 8 dpi scale. | 121 HWND remote_window() { return remote_window_; } |
128 void InitializeRemoteWindowAndScaleFactor(HWND remote_window, | |
129 float device_scale); | |
130 | 122 |
131 // The |host| can be used when we need to send a message to it. | 123 // The |host| can be used when we need to send a message to it. |
132 void Connected(IPC::Sender* host); | 124 void Connected(IPC::Sender* host); |
133 // Called when the remote process has closed its IPC connection. | 125 // Called when the remote process has closed its IPC connection. |
134 void Disconnected(); | 126 void Disconnected(); |
135 | 127 |
136 // Called when we have a message from the remote process. | 128 // Called when we have a message from the remote process. |
137 bool OnMessageReceived(const IPC::Message& message); | 129 bool OnMessageReceived(const IPC::Message& message); |
138 | 130 |
139 void HandleOpenURLOnDesktop(const base::FilePath& shortcut, | 131 void HandleOpenURLOnDesktop(const base::FilePath& shortcut, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void HandleWindowSizeChanged(uint32 width, uint32 height); | 165 void HandleWindowSizeChanged(uint32 width, uint32 height); |
174 | 166 |
175 // Returns the active ASH root window. | 167 // Returns the active ASH root window. |
176 Window* GetAshWindow(); | 168 Window* GetAshWindow(); |
177 | 169 |
178 // Returns true if the remote window is the foreground window according to the | 170 // Returns true if the remote window is the foreground window according to the |
179 // OS. | 171 // OS. |
180 bool IsForegroundWindow(); | 172 bool IsForegroundWindow(); |
181 | 173 |
182 protected: | 174 protected: |
183 explicit RemoteWindowTreeHostWin(const gfx::Rect& bounds); | 175 RemoteWindowTreeHostWin(); |
184 virtual ~RemoteWindowTreeHostWin(); | 176 virtual ~RemoteWindowTreeHostWin(); |
185 | 177 |
186 private: | 178 private: |
187 // IPC message handing methods: | 179 // IPC message handing methods: |
188 void OnMouseMoved(int32 x, int32 y, int32 flags); | 180 void OnMouseMoved(int32 x, int32 y, int32 flags); |
189 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params); | 181 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params); |
190 void OnKeyDown(uint32 vkey, | 182 void OnKeyDown(uint32 vkey, |
191 uint32 repeat_count, | 183 uint32 repeat_count, |
192 uint32 scan_code, | 184 uint32 scan_code, |
193 uint32 flags); | 185 uint32 flags); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 294 |
303 // Current size of this root window. | 295 // Current size of this root window. |
304 gfx::Size window_size_; | 296 gfx::Size window_size_; |
305 | 297 |
306 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin); | 298 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin); |
307 }; | 299 }; |
308 | 300 |
309 } // namespace aura | 301 } // namespace aura |
310 | 302 |
311 #endif // UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ | 303 #endif // UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_ |
OLD | NEW |