summaryrefslogtreecommitdiffstats
path: root/chromium/content/renderer/pepper/pepper_file_ref_renderer_host.h
blob: 2435271ca192f30b8ffde4ccb2e5d5e152babf7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_
#define CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_

#include <stdint.h>

#include <string>

#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "content/renderer/pepper/pepper_file_system_host.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
#include "url/gurl.h"

namespace content {

class PepperFileRefRendererHost : public ppapi::host::ResourceHost {
 public:
  PepperFileRefRendererHost(RendererPpapiHost* host,
                            PP_Instance instance,
                            PP_Resource resource,
                            PP_Resource file_system,
                            const std::string& internal_path);

  PepperFileRefRendererHost(RendererPpapiHost* host,
                            PP_Instance instance,
                            PP_Resource resource,
                            const base::FilePath& external_path);

  ~PepperFileRefRendererHost() override;

  PP_FileSystemType GetFileSystemType() const;
  GURL GetFileSystemURL() const;
  base::FilePath GetExternalFilePath() const;

  // ppapi::host::ResourceHost override.
  int32_t OnResourceMessageReceived(
      const IPC::Message& msg,
      ppapi::host::HostMessageContext* context) override;
  bool IsFileRefHost() override;

 private:
  PP_FileSystemType file_system_type_;
  std::string internal_path_;
  base::FilePath external_path_;
  base::WeakPtr<PepperFileSystemHost> fs_host_;

  DISALLOW_COPY_AND_ASSIGN(PepperFileRefRendererHost);
};

}  // namespace content

#endif  // CONTENT_RENDERER_PEPPER_PEPPER_FILE_REF_RENDERER_HOST_H_