Replace FINAL and OVERRIDE with their C++11 counterparts in content/renderer
[chromium-blink-merge.git] / content / renderer / pepper / host_resource_var.h
blob6a37020ae8733c45bbdb859f1f4796248f8718c7
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 PPAPI_CONTENT_RENDERER_PEPPER_HOST_RESOURCE_VAR_H_
6 #define PPAPI_CONTENT_RENDERER_PEPPER_HOST_RESOURCE_VAR_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ipc/ipc_message.h"
10 #include "ppapi/c/pp_resource.h"
11 #include "ppapi/shared_impl/resource_var.h"
12 #include "ppapi/shared_impl/var.h"
14 namespace content {
16 // Represents a resource var, usable on the host side. Can either have a
17 // plugin-side resource or a pending resource host.
18 class HostResourceVar : public ppapi::ResourceVar {
19 public:
20 // Makes a null resource var.
21 HostResourceVar();
23 // Makes a resource var with an existing plugin-side resource.
24 explicit HostResourceVar(PP_Resource pp_resource);
26 // Makes a resource var with a pending resource host.
27 // The |pending_renderer_host_id| is a pending resource host ID in the
28 // renderer to attach from the plugin. Depending on the type of resource, this
29 // may be 0. The |creation_message| contains additional data needed to create
30 // the plugin-side resource. Its type depends on the type of resource.
31 HostResourceVar(int pending_renderer_host_id,
32 const IPC::Message& creation_message);
34 // ResourceVar override.
35 virtual PP_Resource GetPPResource() const override;
36 virtual int GetPendingRendererHostId() const override;
37 virtual int GetPendingBrowserHostId() const override;
38 virtual const IPC::Message* GetCreationMessage() const override;
39 virtual bool IsPending() const override;
41 void set_pending_browser_host_id(int id) { pending_browser_host_id_ = id; }
43 protected:
44 virtual ~HostResourceVar();
46 private:
47 // Real resource ID in the plugin. 0 if one has not yet been created
48 // (indicating that there is a pending resource host).
49 PP_Resource pp_resource_;
51 // Pending resource host ID in the renderer.
52 int pending_renderer_host_id_;
54 // Pending resource host ID in the browser.
55 int pending_browser_host_id_;
57 // If the plugin-side resource has not yet been created, carries a message to
58 // create a resource of the specific type on the plugin side. Otherwise, NULL.
59 scoped_ptr<IPC::Message> creation_message_;
61 DISALLOW_COPY_AND_ASSIGN(HostResourceVar);
64 } // namespace content
66 #endif