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_NACL_HOST_NACL_FILE_HOST_H_ | 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_FILE_HOST_H_ |
6 #define CHROME_BROWSER_NACL_HOST_NACL_FILE_HOST_H_ | 6 #define CHROME_BROWSER_NACL_HOST_NACL_FILE_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 | 12 |
13 class ExtensionInfoMap; | 13 class ExtensionInfoMap; |
14 class GURL; | 14 class GURL; |
15 class NaClHostMessageFilter; | 15 class NaClHostMessageFilter; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 } | 19 } |
20 | 20 |
21 namespace IPC { | 21 namespace IPC { |
22 class Message; | 22 class Message; |
23 } | 23 } |
24 | 24 |
| 25 namespace nacl { |
| 26 struct PnaclInstallProgress; |
| 27 } |
| 28 |
25 // Opens NaCl Files in the Browser process, on behalf of the NaCl plugin. | 29 // Opens NaCl Files in the Browser process, on behalf of the NaCl plugin. |
26 | 30 |
27 namespace nacl_file_host { | 31 namespace nacl_file_host { |
| 32 typedef base::Callback<void(bool)> InstallCallback; |
| 33 typedef base::Callback<void(const nacl::PnaclInstallProgress&)> |
| 34 InstallProgressCallback; |
28 | 35 |
29 // Open a Pnacl file (readonly) on behalf of the NaCl plugin. | 36 // Ensure that PNaCl is installed. Calls |done_callback| if PNaCl is already |
| 37 // installed. Otherwise, issues a request to install and calls |done_callback| |
| 38 // after that request completes w/ success or failure. |
| 39 // If a request to install is issued, then |progress_callback| is called |
| 40 // with progress updates. |
| 41 void EnsurePnaclInstalled( |
| 42 const InstallCallback& done_callback, |
| 43 const InstallProgressCallback& progress_callback); |
| 44 |
| 45 // Open a PNaCl file (readonly) on behalf of the NaCl plugin. |
30 void GetReadonlyPnaclFd( | 46 void GetReadonlyPnaclFd( |
31 scoped_refptr<NaClHostMessageFilter> nacl_host_message_filter, | 47 scoped_refptr<NaClHostMessageFilter> nacl_host_message_filter, |
32 const std::string& filename, | 48 const std::string& filename, |
33 IPC::Message* reply_msg); | 49 IPC::Message* reply_msg); |
34 | 50 |
35 // Return true if the filename requested is valid for opening. | 51 // Return true if the filename requested is valid for opening. |
36 // Sets file_to_open to the base::FilePath which we will attempt to open. | 52 // Sets file_to_open to the base::FilePath which we will attempt to open. |
37 bool PnaclCanOpenFile(const std::string& filename, | 53 bool PnaclCanOpenFile(const std::string& filename, |
38 base::FilePath* file_to_open); | 54 base::FilePath* file_to_open); |
39 | 55 |
40 // Opens a NaCl executable file for reading and executing. | 56 // Opens a NaCl executable file for reading and executing. |
41 void OpenNaClExecutable( | 57 void OpenNaClExecutable( |
42 scoped_refptr<NaClHostMessageFilter> nacl_host_message_filter, | 58 scoped_refptr<NaClHostMessageFilter> nacl_host_message_filter, |
43 scoped_refptr<ExtensionInfoMap> extension_info_map, | 59 scoped_refptr<ExtensionInfoMap> extension_info_map, |
44 int render_view_id, | 60 int render_view_id, |
45 const GURL& file_url, | 61 const GURL& file_url, |
46 IPC::Message* reply_msg); | 62 IPC::Message* reply_msg); |
47 | 63 |
48 } // namespace nacl_file_host | 64 } // namespace nacl_file_host |
49 | 65 |
50 #endif // CHROME_BROWSER_NACL_HOST_NACL_FILE_HOST_H_ | 66 #endif // CHROME_BROWSER_NACL_HOST_NACL_FILE_HOST_H_ |
OLD | NEW |