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