OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 5 #ifndef WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
6 #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 6 #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
9 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
13 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
14 #include "ipc/ipc_channel_proxy.h" | 16 #include "ipc/ipc_channel_proxy.h" |
15 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_sender.h" | 18 #include "ipc/ipc_sender.h" |
17 #include "ipc/message_filter.h" | 19 #include "ipc/message_filter.h" |
18 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
19 #include "win8/viewer/metro_viewer_exports.h" | 21 #include "win8/viewer/metro_viewer_exports.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Called over IPC by the viewer process to request that the url passed in be | 161 // Called over IPC by the viewer process to request that the url passed in be |
160 // opened. | 162 // opened. |
161 virtual void OnOpenURL(const base::string16& url) = 0; | 163 virtual void OnOpenURL(const base::string16& url) = 0; |
162 | 164 |
163 // Called over IPC by the viewer process to request that the search string | 165 // Called over IPC by the viewer process to request that the search string |
164 // passed in is passed to the default search provider and a URL navigation be | 166 // passed in is passed to the default search provider and a URL navigation be |
165 // performed. | 167 // performed. |
166 virtual void OnHandleSearchRequest(const base::string16& search_string) = 0; | 168 virtual void OnHandleSearchRequest(const base::string16& search_string) = 0; |
167 | 169 |
168 // Called over IPC by the viewer process when the window size has changed. | 170 // Called over IPC by the viewer process when the window size has changed. |
169 virtual void OnWindowSizeChanged(uint32 width, uint32 height) = 0; | 171 virtual void OnWindowSizeChanged(uint32_t width, uint32_t height) = 0; |
170 | 172 |
171 void NotifyChannelConnected(); | 173 void NotifyChannelConnected(); |
172 | 174 |
173 // IPC message handing methods: | 175 // IPC message handing methods: |
174 void OnFileSaveAsDone(bool success, | 176 void OnFileSaveAsDone(bool success, |
175 const base::FilePath& filename, | 177 const base::FilePath& filename, |
176 int filter_index); | 178 int filter_index); |
177 void OnFileOpenDone(bool success, const base::FilePath& filename); | 179 void OnFileOpenDone(bool success, const base::FilePath& filename); |
178 void OnMultiFileOpenDone(bool success, | 180 void OnMultiFileOpenDone(bool success, |
179 const std::vector<base::FilePath>& files); | 181 const std::vector<base::FilePath>& files); |
180 void OnSelectFolderDone(bool success, const base::FilePath& folder); | 182 void OnSelectFolderDone(bool success, const base::FilePath& folder); |
181 | 183 |
182 // Inner message filter used to handle connection event on the IPC channel | 184 // Inner message filter used to handle connection event on the IPC channel |
183 // proxy's background thread. This prevents consumers of | 185 // proxy's background thread. This prevents consumers of |
184 // MetroViewerProcessHost from having to pump messages on their own message | 186 // MetroViewerProcessHost from having to pump messages on their own message |
185 // loop. | 187 // loop. |
186 class InternalMessageFilter : public IPC::MessageFilter { | 188 class InternalMessageFilter : public IPC::MessageFilter { |
187 public: | 189 public: |
188 InternalMessageFilter(MetroViewerProcessHost* owner); | 190 InternalMessageFilter(MetroViewerProcessHost* owner); |
189 | 191 |
190 // IPC::MessageFilter implementation. | 192 // IPC::MessageFilter implementation. |
191 void OnChannelConnected(int32 peer_pid) override; | 193 void OnChannelConnected(int32_t peer_pid) override; |
192 | 194 |
193 private: | 195 private: |
194 ~InternalMessageFilter() override; | 196 ~InternalMessageFilter() override; |
195 | 197 |
196 MetroViewerProcessHost* owner_; | 198 MetroViewerProcessHost* owner_; |
197 DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); | 199 DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); |
198 }; | 200 }; |
199 | 201 |
200 scoped_ptr<IPC::ChannelProxy> channel_; | 202 scoped_ptr<IPC::ChannelProxy> channel_; |
201 scoped_ptr<base::WaitableEvent> channel_connected_event_; | 203 scoped_ptr<base::WaitableEvent> channel_connected_event_; |
202 scoped_refptr<InternalMessageFilter> message_filter_; | 204 scoped_refptr<InternalMessageFilter> message_filter_; |
203 | 205 |
204 static MetroViewerProcessHost* instance_; | 206 static MetroViewerProcessHost* instance_; |
205 | 207 |
206 // Saved callbacks which inform the caller about the result of the open file/ | 208 // Saved callbacks which inform the caller about the result of the open file/ |
207 // save file/select operations. | 209 // save file/select operations. |
208 OpenFileCompletion file_open_completion_callback_; | 210 OpenFileCompletion file_open_completion_callback_; |
209 OpenMultipleFilesCompletion multi_file_open_completion_callback_; | 211 OpenMultipleFilesCompletion multi_file_open_completion_callback_; |
210 SaveFileCompletion file_saveas_completion_callback_; | 212 SaveFileCompletion file_saveas_completion_callback_; |
211 SelectFolderCompletion select_folder_completion_callback_; | 213 SelectFolderCompletion select_folder_completion_callback_; |
212 FileSelectionCanceled failure_callback_; | 214 FileSelectionCanceled failure_callback_; |
213 | 215 |
214 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); | 216 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); |
215 }; | 217 }; |
216 | 218 |
217 } // namespace win8 | 219 } // namespace win8 |
218 | 220 |
219 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 221 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
OLD | NEW |