Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / pepper / pepper_file_ref_renderer_host.h
blobcfa36b2d83e00d0a5ae47f21be9bfe3c8b57ac9a
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.
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_
8 #include <string>
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"
23 namespace content {
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);
33 PepperFileRefRendererHost(RendererPpapiHost* host,
34 PP_Instance instance,
35 PP_Resource resource,
36 const base::FilePath& external_path);
38 ~PepperFileRefRendererHost() override;
40 PP_FileSystemType GetFileSystemType() const;
41 GURL GetFileSystemURL() const;
42 base::FilePath GetExternalFilePath() const;
44 // ppapi::host::ResourceHost override.
45 int32_t OnResourceMessageReceived(
46 const IPC::Message& msg,
47 ppapi::host::HostMessageContext* context) override;
48 bool IsFileRefHost() override;
50 private:
51 PP_FileSystemType file_system_type_;
52 std::string internal_path_;
53 base::FilePath external_path_;
54 base::WeakPtr<PepperFileSystemHost> fs_host_;
56 DISALLOW_COPY_AND_ASSIGN(PepperFileRefRendererHost);
59 } // namespace content
61 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_