| 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 <memory> |
| 9 |
| 8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 9 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/process/process.h" | 13 #include "base/process/process.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class CommandLine; | 19 class CommandLine; |
| 19 class FilePath; | 20 class FilePath; |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 // to false in case of a failure. Handler must take ownership of the IO | 36 // to false in case of a failure. Handler must take ownership of the IO |
| 36 // handles. | 37 // handles. |
| 37 typedef base::Callback<void(LaunchResult result, | 38 typedef base::Callback<void(LaunchResult result, |
| 38 base::Process process, | 39 base::Process process, |
| 39 base::File read_file, | 40 base::File read_file, |
| 40 base::File write_file)> LaunchedCallback; | 41 base::File write_file)> LaunchedCallback; |
| 41 | 42 |
| 42 // Creates default launcher for the current OS. |native_view| refers to the | 43 // Creates default launcher for the current OS. |native_view| refers to the |
| 43 // window that contains calling page. Can be nullptr, e.g. for background | 44 // window that contains calling page. Can be nullptr, e.g. for background |
| 44 // pages. | 45 // pages. |
| 45 static scoped_ptr<NativeProcessLauncher> CreateDefault( | 46 static std::unique_ptr<NativeProcessLauncher> CreateDefault( |
| 46 bool allow_user_level_hosts, | 47 bool allow_user_level_hosts, |
| 47 gfx::NativeView native_view); | 48 gfx::NativeView native_view); |
| 48 | 49 |
| 49 NativeProcessLauncher() {} | 50 NativeProcessLauncher() {} |
| 50 virtual ~NativeProcessLauncher() {} | 51 virtual ~NativeProcessLauncher() {} |
| 51 | 52 |
| 52 // Finds native messaging host with the specified name and launches it | 53 // Finds native messaging host with the specified name and launches it |
| 53 // asynchronously. Also checks that the specified |origin| is permitted to | 54 // asynchronously. Also checks that the specified |origin| is permitted to |
| 54 // access the host. |callback| is called after the process has been started. | 55 // access the host. |callback| is called after the process has been started. |
| 55 // If the launcher is destroyed before the callback is called then the call is | 56 // If the launcher is destroyed before the callback is called then the call is |
| (...skipping 20 matching lines...) Expand all Loading... |
| 76 base::File* read_file, | 77 base::File* read_file, |
| 77 base::File* write_file); | 78 base::File* write_file); |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(NativeProcessLauncher); | 81 DISALLOW_COPY_AND_ASSIGN(NativeProcessLauncher); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace extensions | 84 } // namespace extensions |
| 84 | 85 |
| 85 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ | 86 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_ |
| OLD | NEW |