• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 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 CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_
7 
8 #include <string>
9 
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/public/renderer/renderer_ppapi_host.h"
14 #include "content/renderer/pepper/pepper_file_system_host.h"
15 #include "ipc/ipc_message.h"
16 #include "ppapi/c/pp_file_info.h"
17 #include "ppapi/c/pp_instance.h"
18 #include "ppapi/c/pp_resource.h"
19 #include "ppapi/host/host_message_context.h"
20 #include "ppapi/host/resource_host.h"
21 #include "url/gurl.h"
22 
23 namespace content {
24 
25 class PepperFileRefRendererHost
26     : public ppapi::host::ResourceHost {
27  public:
28   PepperFileRefRendererHost(RendererPpapiHost* host,
29                             PP_Instance instance,
30                             PP_Resource resource,
31                             PP_Resource file_system,
32                             const std::string& internal_path);
33 
34   PepperFileRefRendererHost(RendererPpapiHost* host,
35                             PP_Instance instance,
36                             PP_Resource resource,
37                             const base::FilePath& external_path);
38 
39   virtual ~PepperFileRefRendererHost();
40 
41   PP_FileSystemType GetFileSystemType() const;
42   GURL GetFileSystemURL() const;
43   base::FilePath GetExternalFilePath() const;
44 
45   // ppapi::host::ResourceHost override.
46   virtual int32_t OnResourceMessageReceived(
47       const IPC::Message& msg,
48       ppapi::host::HostMessageContext* context) OVERRIDE;
49   virtual bool IsFileRefHost() OVERRIDE;
50 
51  private:
52   PP_FileSystemType file_system_type_;
53   std::string internal_path_;
54   base::FilePath external_path_;
55   base::WeakPtr<PepperFileSystemHost> fs_host_;
56 
57   DISALLOW_COPY_AND_ASSIGN(PepperFileRefRendererHost);
58 };
59 
60 }  // namespace content
61 
62 #endif  // CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_
63