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 "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
17 #include "ipc/message_filter.h" | 17 #include "ipc/message_filter.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 #include "win8/viewer/metro_viewer_exports.h" | 19 #include "win8/viewer/metro_viewer_exports.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
23 class WaitableEvent; | 23 class WaitableEvent; |
24 } | 24 } |
25 | 25 |
26 namespace IPC { | 26 namespace IPC { |
| 27 class AttachmentBroker; |
27 class ChannelProxy; | 28 class ChannelProxy; |
28 class Message; | 29 class Message; |
29 } | 30 } |
30 | 31 |
31 namespace win8 { | 32 namespace win8 { |
32 | 33 |
33 // Abstract base class for various Metro viewer process host implementations. | 34 // Abstract base class for various Metro viewer process host implementations. |
34 class METRO_VIEWER_EXPORT MetroViewerProcessHost : public IPC::Listener, | 35 class METRO_VIEWER_EXPORT MetroViewerProcessHost : public IPC::Listener, |
35 public IPC::Sender, | 36 public IPC::Sender, |
36 public base::NonThreadSafe { | 37 public base::NonThreadSafe { |
(...skipping 11 matching lines...) Expand all Loading... |
48 SelectFolderCompletion; | 49 SelectFolderCompletion; |
49 | 50 |
50 typedef base::Callback<void(void*)> FileSelectionCanceled; | 51 typedef base::Callback<void(void*)> FileSelectionCanceled; |
51 | 52 |
52 // Initializes a viewer process host to connect to the Metro viewer process | 53 // Initializes a viewer process host to connect to the Metro viewer process |
53 // over IPC. The given task runner correspond to a thread on which | 54 // over IPC. The given task runner correspond to a thread on which |
54 // IPC::Channel is created and used (e.g. IO thread). Instantly connects to | 55 // IPC::Channel is created and used (e.g. IO thread). Instantly connects to |
55 // the viewer process if one is already connected to |ipc_channel_name|; a | 56 // the viewer process if one is already connected to |ipc_channel_name|; a |
56 // viewer can otherwise be launched synchronously via | 57 // viewer can otherwise be launched synchronously via |
57 // LaunchViewerAndWaitForConnection(). | 58 // LaunchViewerAndWaitForConnection(). |
58 explicit MetroViewerProcessHost( | 59 MetroViewerProcessHost( |
59 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); | 60 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
| 61 IPC::AttachmentBroker* attachment_broker); |
60 ~MetroViewerProcessHost() override; | 62 ~MetroViewerProcessHost() override; |
61 | 63 |
62 // Returns the process id of the viewer process if one is connected to this | 64 // Returns the process id of the viewer process if one is connected to this |
63 // host, returns base::kNullProcessId otherwise. | 65 // host, returns base::kNullProcessId otherwise. |
64 base::ProcessId GetViewerProcessId(); | 66 base::ProcessId GetViewerProcessId(); |
65 | 67 |
66 // Launches the viewer process associated with the given |app_user_model_id| | 68 // Launches the viewer process associated with the given |app_user_model_id| |
67 // and blocks until that viewer process connects or until a timeout is | 69 // and blocks until that viewer process connects or until a timeout is |
68 // reached. Returns true if the viewer process connects before the timeout is | 70 // reached. Returns true if the viewer process connects before the timeout is |
69 // reached. NOTE: this assumes that the app referred to by |app_user_model_id| | 71 // reached. NOTE: this assumes that the app referred to by |app_user_model_id| |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |