Android NTP: Most visited tile clicks should have PageTransition.AUTO_BOOKMARK
[chromium-blink-merge.git] / ppapi / shared_impl / resource_var.h
blob0696d57e13f3652de9203f99ab52dc956dd5e447
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_SHARED_IMPL_RESOURCE_VAR_H_
6 #define PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
8 #include "ppapi/c/pp_resource.h"
9 #include "ppapi/c/pp_var.h"
10 #include "ppapi/shared_impl/ppapi_shared_export.h"
11 #include "ppapi/shared_impl/var.h"
13 namespace IPC {
14 class Message;
17 namespace ppapi {
19 // Represents a resource Var.
20 class PPAPI_SHARED_EXPORT ResourceVar : public Var {
21 public:
22 // Gets the resource ID associated with this var.
23 // This is 0 if a resource is still pending (only possible on the host side).
24 // NOTE: This can return a PP_Resource with a reference count of 0 on the
25 // plugin side. It should be AddRef'd if the resource is passed to the user.
26 virtual PP_Resource GetPPResource() const = 0;
28 // Gets the pending resource host ID in the renderer.
29 virtual int GetPendingRendererHostId() const;
31 // Gets the pending resource host ID in the browser.
32 virtual int GetPendingBrowserHostId() const;
34 // Gets the message for creating a plugin-side resource. Returns NULL if the
35 // message is empty (which is always true on the plugin side).
36 virtual const IPC::Message* GetCreationMessage() const;
38 // Determines whether this is a pending resource.
39 // This is true if, on the host side, the there is a creation_message and no
40 // PP_Resource.
41 virtual bool IsPending() const = 0;
43 // Var override.
44 ResourceVar* AsResourceVar() override;
45 PP_VarType GetType() const override;
47 // Helper function that converts a PP_Var to a ResourceVar. This will
48 // return NULL if the PP_Var is not of Resource type.
49 static ResourceVar* FromPPVar(PP_Var var);
51 protected:
52 ResourceVar();
54 ~ResourceVar() override;
56 private:
57 DISALLOW_COPY_AND_ASSIGN(ResourceVar);
60 } // namespace ppapi
62 #endif // PPAPI_SHARED_IMPL_RESOURCE_VAR_H_