OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
11 #include "third_party/ppapi/c/pp_resource.h" | 11 #include "third_party/ppapi/c/pp_resource.h" |
12 #include "webkit/glue/plugins/pepper_resource_tracker.h" | 12 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
13 | 13 |
14 namespace pepper { | 14 namespace pepper { |
15 | 15 |
16 class Buffer; | 16 class Buffer; |
17 class DeviceContext2D; | 17 class DeviceContext2D; |
18 class DirectoryReader; | 18 class DirectoryReader; |
19 class FileChooser; | 19 class FileChooser; |
20 class FileIO; | 20 class FileIO; |
21 class FileRef; | 21 class FileRef; |
22 class Font; | 22 class Font; |
23 class ImageData; | 23 class ImageData; |
24 class PluginModule; | 24 class PluginModule; |
25 class PrivateFontFile; | |
26 class Scrollbar; | 25 class Scrollbar; |
27 class URLLoader; | 26 class URLLoader; |
28 class URLRequestInfo; | 27 class URLRequestInfo; |
29 class URLResponseInfo; | 28 class URLResponseInfo; |
30 class Widget; | 29 class Widget; |
31 | 30 |
32 class Resource : public base::RefCountedThreadSafe<Resource> { | 31 class Resource : public base::RefCountedThreadSafe<Resource> { |
33 public: | 32 public: |
34 explicit Resource(PluginModule* module) : resource_id_(0), module_(module) {} | 33 explicit Resource(PluginModule* module) : resource_id_(0), module_(module) {} |
35 virtual ~Resource() {} | 34 virtual ~Resource() {} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // NULL if the resource does not match the specified type. Used by the Cast() | 73 // NULL if the resource does not match the specified type. Used by the Cast() |
75 // function. | 74 // function. |
76 virtual Buffer* AsBuffer() { return NULL; } | 75 virtual Buffer* AsBuffer() { return NULL; } |
77 virtual DeviceContext2D* AsDeviceContext2D() { return NULL; } | 76 virtual DeviceContext2D* AsDeviceContext2D() { return NULL; } |
78 virtual DirectoryReader* AsDirectoryReader() { return NULL; } | 77 virtual DirectoryReader* AsDirectoryReader() { return NULL; } |
79 virtual FileChooser* AsFileChooser() { return NULL; } | 78 virtual FileChooser* AsFileChooser() { return NULL; } |
80 virtual FileIO* AsFileIO() { return NULL; } | 79 virtual FileIO* AsFileIO() { return NULL; } |
81 virtual FileRef* AsFileRef() { return NULL; } | 80 virtual FileRef* AsFileRef() { return NULL; } |
82 virtual Font* AsFont() { return NULL; } | 81 virtual Font* AsFont() { return NULL; } |
83 virtual ImageData* AsImageData() { return NULL; } | 82 virtual ImageData* AsImageData() { return NULL; } |
84 virtual PrivateFontFile* AsPrivateFontFile() { return NULL; } | |
85 virtual Scrollbar* AsScrollbar() { return NULL; } | 83 virtual Scrollbar* AsScrollbar() { return NULL; } |
86 virtual URLLoader* AsURLLoader() { return NULL; } | 84 virtual URLLoader* AsURLLoader() { return NULL; } |
87 virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } | 85 virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } |
88 virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } | 86 virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } |
89 virtual Widget* AsWidget() { return NULL; } | 87 virtual Widget* AsWidget() { return NULL; } |
90 | 88 |
91 private: | 89 private: |
92 // If referenced by a plugin, holds the id of this resource object. Do not | 90 // If referenced by a plugin, holds the id of this resource object. Do not |
93 // access this member directly, because it is possible that the plugin holds | 91 // access this member directly, because it is possible that the plugin holds |
94 // no references to the object, and therefore the resource_id_ is zero. Use | 92 // no references to the object, and therefore the resource_id_ is zero. Use |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 DEFINE_RESOURCE_CAST(Scrollbar) | 126 DEFINE_RESOURCE_CAST(Scrollbar) |
129 DEFINE_RESOURCE_CAST(URLLoader) | 127 DEFINE_RESOURCE_CAST(URLLoader) |
130 DEFINE_RESOURCE_CAST(URLRequestInfo) | 128 DEFINE_RESOURCE_CAST(URLRequestInfo) |
131 DEFINE_RESOURCE_CAST(URLResponseInfo) | 129 DEFINE_RESOURCE_CAST(URLResponseInfo) |
132 DEFINE_RESOURCE_CAST(Widget) | 130 DEFINE_RESOURCE_CAST(Widget) |
133 | 131 |
134 #undef DEFINE_RESOURCE_CAST | 132 #undef DEFINE_RESOURCE_CAST |
135 } // namespace pepper | 133 } // namespace pepper |
136 | 134 |
137 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 135 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
OLD | NEW |