summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/plugin_resource.h
blob: 298b4cd2cf7081c1072e5731c2426bf86771ad73 (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
// Copyright (c) 2011 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 PPAPI_PROXY_PLUGIN_RESOURCE_H_
#define PPAPI_PROXY_PLUGIN_RESOURCE_H_

#include "base/basictypes.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/resource_object_base.h"

namespace pp {
namespace proxy {

class PluginResource : public ::ppapi::ResourceObjectBase {
 public:
  PluginResource(const ppapi::HostResource& resource);
  virtual ~PluginResource();

  PP_Instance instance() const { return host_resource_.instance(); }

  // Returns the host resource ID for sending to the host process.
  const ppapi::HostResource& host_resource() const {
    return host_resource_;
  }

  PluginDispatcher* GetDispatcher();

 private:
  // The resource ID in the host that this object corresponds to. Inside the
  // plugin we'll remap the resource IDs so we can have many host processes
  // each independently generating resources (which may conflict) but the IDs
  // in the plugin will all be unique.
  ppapi::HostResource host_resource_;

  DISALLOW_COPY_AND_ASSIGN(PluginResource);
};

}  // namespace proxy
}  // namespace pp

#endif  // PPAPI_PROXY_PLUGIN_RESOURCE_H_