Home | History | Annotate | Download | only in browser
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_
      6 #define COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_
      7 
      8 #include <string>
      9 
     10 #include "base/memory/ref_counted.h"
     11 
     12 class GURL;
     13 
     14 namespace base {
     15 class FilePath;
     16 }
     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.
     27 
     28 namespace nacl_file_host {
     29 
     30 // Open a PNaCl file (readonly) on behalf of the NaCl plugin.
     31 void GetReadonlyPnaclFd(
     32     scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter,
     33     const std::string& filename,
     34     IPC::Message* reply_msg);
     35 
     36 // Return true if the filename requested is valid for opening.
     37 // Sets file_to_open to the base::FilePath which we will attempt to open.
     38 bool PnaclCanOpenFile(const std::string& filename,
     39                       base::FilePath* file_to_open);
     40 
     41 // Opens a NaCl executable file for reading and executing.
     42 void OpenNaClExecutable(
     43     scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter,
     44     int render_view_id,
     45     const GURL& file_url,
     46     IPC::Message* reply_msg);
     47 
     48 }  // namespace nacl_file_host
     49 
     50 #endif  // COMPONENTS_NACL_BROWSER_NACL_FILE_HOST_H_
     51