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