9cfc65f657d17c45e7788ae8f5315900b7b0f479
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / pepper_file_ref_renderer_host.h
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 : public ppapi::host::ResourceHost {
26  public:
27   PepperFileRefRendererHost(RendererPpapiHost* host,
28                             PP_Instance instance,
29                             PP_Resource resource,
30                             PP_Resource file_system,
31                             const std::string& internal_path);
32
33   PepperFileRefRendererHost(RendererPpapiHost* host,
34                             PP_Instance instance,
35                             PP_Resource resource,
36                             const base::FilePath& external_path);
37
38   virtual ~PepperFileRefRendererHost();
39
40   PP_FileSystemType GetFileSystemType() const;
41   GURL GetFileSystemURL() const;
42   base::FilePath GetExternalFilePath() const;
43
44   // ppapi::host::ResourceHost override.
45   virtual int32_t OnResourceMessageReceived(
46       const IPC::Message& msg,
47       ppapi::host::HostMessageContext* context) OVERRIDE;
48   virtual bool IsFileRefHost() OVERRIDE;
49
50  private:
51   PP_FileSystemType file_system_type_;
52   std::string internal_path_;
53   base::FilePath external_path_;
54   base::WeakPtr<PepperFileSystemHost> fs_host_;
55
56   DISALLOW_COPY_AND_ASSIGN(PepperFileRefRendererHost);
57 };
58
59 }  // namespace content
60
61 #endif  // CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_