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/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
12 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
13 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
14 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
15 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
16 #include "ipc/message_filter.h" | 17 #include "ipc/message_filter.h" |
17 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
18 #include "win8/viewer/metro_viewer_exports.h" | 19 #include "win8/viewer/metro_viewer_exports.h" |
19 | 20 |
(...skipping 28 matching lines...) Expand all Loading... |
48 | 49 |
49 typedef base::Callback<void(void*)> FileSelectionCanceled; | 50 typedef base::Callback<void(void*)> FileSelectionCanceled; |
50 | 51 |
51 // Initializes a viewer process host to connect to the Metro viewer process | 52 // Initializes a viewer process host to connect to the Metro viewer process |
52 // over IPC. The given task runner correspond to a thread on which | 53 // over IPC. The given task runner correspond to a thread on which |
53 // IPC::Channel is created and used (e.g. IO thread). Instantly connects to | 54 // IPC::Channel is created and used (e.g. IO thread). Instantly connects to |
54 // the viewer process if one is already connected to |ipc_channel_name|; a | 55 // the viewer process if one is already connected to |ipc_channel_name|; a |
55 // viewer can otherwise be launched synchronously via | 56 // viewer can otherwise be launched synchronously via |
56 // LaunchViewerAndWaitForConnection(). | 57 // LaunchViewerAndWaitForConnection(). |
57 explicit MetroViewerProcessHost( | 58 explicit MetroViewerProcessHost( |
58 base::SingleThreadTaskRunner* ipc_task_runner); | 59 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); |
59 virtual ~MetroViewerProcessHost(); | 60 virtual ~MetroViewerProcessHost(); |
60 | 61 |
61 // Returns the process id of the viewer process if one is connected to this | 62 // Returns the process id of the viewer process if one is connected to this |
62 // host, returns base::kNullProcessId otherwise. | 63 // host, returns base::kNullProcessId otherwise. |
63 base::ProcessId GetViewerProcessId(); | 64 base::ProcessId GetViewerProcessId(); |
64 | 65 |
65 // Launches the viewer process associated with the given |app_user_model_id| | 66 // Launches the viewer process associated with the given |app_user_model_id| |
66 // and blocks until that viewer process connects or until a timeout is | 67 // and blocks until that viewer process connects or until a timeout is |
67 // reached. Returns true if the viewer process connects before the timeout is | 68 // reached. Returns true if the viewer process connects before the timeout is |
68 // reached. NOTE: this assumes that the app referred to by |app_user_model_id| | 69 // reached. NOTE: this assumes that the app referred to by |app_user_model_id| |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 SaveFileCompletion file_saveas_completion_callback_; | 208 SaveFileCompletion file_saveas_completion_callback_; |
208 SelectFolderCompletion select_folder_completion_callback_; | 209 SelectFolderCompletion select_folder_completion_callback_; |
209 FileSelectionCanceled failure_callback_; | 210 FileSelectionCanceled failure_callback_; |
210 | 211 |
211 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); | 212 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); |
212 }; | 213 }; |
213 | 214 |
214 } // namespace win8 | 215 } // namespace win8 |
215 | 216 |
216 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 217 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
OLD | NEW |