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 CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 }; | 31 }; |
32 | 32 |
33 // Callback that's called after the process has been launched. |result| is set | 33 // Callback that's called after the process has been launched. |result| is set |
34 // to false in case of a failure. Handler must take ownership of the IO | 34 // to false in case of a failure. Handler must take ownership of the IO |
35 // handles. | 35 // handles. |
36 typedef base::Callback<void(LaunchResult result, | 36 typedef base::Callback<void(LaunchResult result, |
37 base::Process process, | 37 base::Process process, |
38 base::File read_file, | 38 base::File read_file, |
39 base::File write_file)> LaunchedCallback; | 39 base::File write_file)> LaunchedCallback; |
40 | 40 |
| 41 // Creates default launcher for the current OS. |native_view| refers to the |
| 42 // window that contains calling page. Can be nullptr, e.g. for background |
| 43 // pages. |
41 static scoped_ptr<NativeProcessLauncher> CreateDefault( | 44 static scoped_ptr<NativeProcessLauncher> CreateDefault( |
42 bool allow_user_level_hosts, | 45 bool allow_user_level_hosts, |
43 gfx::NativeView native_view); | 46 gfx::NativeView native_view); |
44 | 47 |
45 NativeProcessLauncher() {} | 48 NativeProcessLauncher() {} |
46 virtual ~NativeProcessLauncher() {} | 49 virtual ~NativeProcessLauncher() {} |
47 | 50 |
48 // Finds native messaging host with the specified name and launches it | 51 // Finds native messaging host with the specified name and launches it |
49 // asynchronously. Also checks that the specified |origin| is permitted to | 52 // asynchronously. Also checks that the specified |origin| is permitted to |
50 // access the host. |callback| is called after the process has been started. | 53 // access the host. |callback| is called after the process has been started. |
(...skipping 21 matching lines...) Expand all Loading... |
72 base::File* read_file, | 75 base::File* read_file, |
73 base::File* write_file); | 76 base::File* write_file); |
74 | 77 |
75 private: | 78 private: |
76 DISALLOW_COPY_AND_ASSIGN(NativeProcessLauncher); | 79 DISALLOW_COPY_AND_ASSIGN(NativeProcessLauncher); |
77 }; | 80 }; |
78 | 81 |
79 } // namespace extensions | 82 } // namespace extensions |
80 | 83 |
81 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ | 84 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ |
OLD | NEW |