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 COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_ |
6 #define COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "components/nacl/common/nacl.mojom.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class FilePath; | 15 class FilePath; |
16 } | 16 } |
17 | 17 |
18 namespace IPC { | |
19 class Message; | |
20 } | |
21 | |
22 namespace nacl { | |
23 class NaClHostMessageFilter; | |
24 } | |
25 | |
26 // Opens NaCl Files in the Browser process, on behalf of the NaCl plugin. | 18 // Opens NaCl Files in the Browser process, on behalf of the NaCl plugin. |
27 | 19 |
28 namespace nacl_file_host { | 20 namespace nacl_file_host { |
29 | 21 |
22 using OpenFileCallback = | |
23 base::Callback<void(base::File, uint64_t token_lo, uint64_t token_hi)>; | |
24 | |
30 // Open a PNaCl file (readonly) on behalf of the NaCl plugin. | 25 // Open a PNaCl file (readonly) on behalf of the NaCl plugin. |
31 // If it is executable, registers the executable for validation caching. | 26 // If it is executable, registers the executable for validation caching. |
32 // Otherwise, just opens the file read-only. | 27 // Otherwise, just opens the file read-only. |
33 void GetReadonlyPnaclFd( | 28 void GetReadonlyPnaclFd(const std::string& filename, |
34 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter, | 29 bool is_executable, |
35 const std::string& filename, | 30 const OpenFileCallback& callback); |
36 bool is_executable, | |
37 IPC::Message* reply_msg); | |
38 | 31 |
39 // Return true if the filename requested is valid for opening. | 32 // Return true if the filename requested is valid for opening. |
40 // Sets file_to_open to the base::FilePath which we will attempt to open. | 33 // Sets file_to_open to the base::FilePath which we will attempt to open. |
41 bool PnaclCanOpenFile(const std::string& filename, | 34 bool PnaclCanOpenFile(const std::string& filename, |
42 base::FilePath* file_to_open); | 35 base::FilePath* file_to_open); |
43 | 36 |
44 // Opens a NaCl executable file for reading and executing. | 37 // Opens a NaCl executable file for reading and executing. |
45 void OpenNaClExecutable( | 38 void OpenNaClExecutable( |
46 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter, | |
47 int render_view_id, | 39 int render_view_id, |
48 const GURL& file_url, | 40 const GURL& file_url, |
49 bool enable_validation_caching, | 41 bool enable_validation_caching, |
50 IPC::Message* reply_msg); | 42 int render_process_id, |
43 const base::FilePath& profile_directory, | |
44 const scoped_refptr<base::TaskRunner>& origin_task_runner, | |
tibell
2017/01/31 01:24:12
Could you document what |origin_task_runner| is fo
Sam McNally
2017/02/07 00:13:18
Done.
| |
45 const OpenFileCallback& callback); | |
51 | 46 |
52 } // namespace nacl_file_host | 47 } // namespace nacl_file_host |
53 | 48 |
54 #endif // COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_ | 49 #endif // COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_ |
OLD | NEW |