blob: cca66f031bb8d5015fa2f58779be591dab11a339 (
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
|
// 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 WEBKIT_PLUGINS_PPAPI_RESOURCE_HELPER_H_
#define WEBKIT_PLUGINS_PPAPI_RESOURCE_HELPER_H_
#include "base/basictypes.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "webkit/plugins/webkit_plugins_export.h"
namespace ppapi {
class Resource;
}
namespace webkit {
namespace ppapi {
class PluginInstance;
class PluginModule;
class PluginDelegate;
// Helper functions for Resoruce implementations.
//
// This is specifically not designed to be a base class that derives from
// ppapi::Resource to avoid diamond inheritance if most of a resource class
// is implemented in the shared_impl (to share code with the proxy).
class ResourceHelper {
public:
// Returns the instance implementation object for the given resource, or NULL
// if the resource has outlived its instance.
static PluginInstance* GetPluginInstance(const ::ppapi::Resource* resource);
// Returns the module for the given resource, or NULL if the resource has
// outlived its instance.
WEBKIT_PLUGINS_EXPORT static PluginModule* GetPluginModule(
const ::ppapi::Resource* resource);
// Returns the plugin delegate for the given resource, or NULL if the
// resource has outlived its instance.
static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource);
// Returns the instance implementation object for the pp_instance.
static PluginInstance* PPInstanceToPluginInstance(PP_Instance instance);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper);
};
} // namespace ppapi
} // namespace webkit
#endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_IMPL_HELPER_H_
|