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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "third_party/ppapi/c/pp_resource.h" | 10 #include "third_party/ppapi/c/pp_resource.h" |
11 #include "webkit/glue/plugins/pepper_resource_tracker.h" | 11 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
12 | 12 |
13 namespace pepper { | 13 namespace pepper { |
14 | 14 |
15 class Buffer; | 15 class Buffer; |
16 class Audio; | 16 class Audio; |
17 class AudioConfig; | 17 class AudioConfig; |
18 class DeviceContext2D; | |
19 class DirectoryReader; | 18 class DirectoryReader; |
20 class FileChooser; | 19 class FileChooser; |
21 class FileIO; | 20 class FileIO; |
22 class FileRef; | 21 class FileRef; |
23 class Font; | 22 class Font; |
| 23 class Graphics2D; |
24 class Graphics3D; | 24 class Graphics3D; |
25 class ImageData; | 25 class ImageData; |
26 class PluginModule; | 26 class PluginModule; |
27 class PrivateFontFile; | 27 class PrivateFontFile; |
28 class Scrollbar; | 28 class Scrollbar; |
29 class URLLoader; | 29 class URLLoader; |
30 class URLRequestInfo; | 30 class URLRequestInfo; |
31 class URLResponseInfo; | 31 class URLResponseInfo; |
32 class VideoDecoder; | 32 class VideoDecoder; |
33 class Widget; | 33 class Widget; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 const PP_Resource id; | 72 const PP_Resource id; |
73 }; | 73 }; |
74 | 74 |
75 private: | 75 private: |
76 // Type-specific getters for individual resource types. These will return | 76 // Type-specific getters for individual resource types. These will return |
77 // NULL if the resource does not match the specified type. Used by the Cast() | 77 // NULL if the resource does not match the specified type. Used by the Cast() |
78 // function. | 78 // function. |
79 virtual Audio* AsAudio() { return NULL; } | 79 virtual Audio* AsAudio() { return NULL; } |
80 virtual AudioConfig* AsAudioConfig() { return NULL; } | 80 virtual AudioConfig* AsAudioConfig() { return NULL; } |
81 virtual Buffer* AsBuffer() { return NULL; } | 81 virtual Buffer* AsBuffer() { return NULL; } |
82 virtual DeviceContext2D* AsDeviceContext2D() { return NULL; } | |
83 virtual DirectoryReader* AsDirectoryReader() { return NULL; } | 82 virtual DirectoryReader* AsDirectoryReader() { return NULL; } |
84 virtual FileChooser* AsFileChooser() { return NULL; } | 83 virtual FileChooser* AsFileChooser() { return NULL; } |
85 virtual FileIO* AsFileIO() { return NULL; } | 84 virtual FileIO* AsFileIO() { return NULL; } |
86 virtual FileRef* AsFileRef() { return NULL; } | 85 virtual FileRef* AsFileRef() { return NULL; } |
87 virtual Font* AsFont() { return NULL; } | 86 virtual Font* AsFont() { return NULL; } |
| 87 virtual Graphics2D* AsGraphics2D() { return NULL; } |
88 virtual Graphics3D* AsGraphics3D() { return NULL; } | 88 virtual Graphics3D* AsGraphics3D() { return NULL; } |
89 virtual ImageData* AsImageData() { return NULL; } | 89 virtual ImageData* AsImageData() { return NULL; } |
90 virtual PrivateFontFile* AsPrivateFontFile() { return NULL; } | 90 virtual PrivateFontFile* AsPrivateFontFile() { return NULL; } |
91 virtual Scrollbar* AsScrollbar() { return NULL; } | 91 virtual Scrollbar* AsScrollbar() { return NULL; } |
92 virtual URLLoader* AsURLLoader() { return NULL; } | 92 virtual URLLoader* AsURLLoader() { return NULL; } |
93 virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } | 93 virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } |
94 virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } | 94 virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } |
95 virtual VideoDecoder* AsVideoDecoder() { return NULL; } | 95 virtual VideoDecoder* AsVideoDecoder() { return NULL; } |
96 virtual Widget* AsWidget() { return NULL; } | 96 virtual Widget* AsWidget() { return NULL; } |
97 | 97 |
(...skipping 19 matching lines...) Expand all Loading... |
117 | 117 |
118 // Cast() specializations. | 118 // Cast() specializations. |
119 #define DEFINE_RESOURCE_CAST(Type) \ | 119 #define DEFINE_RESOURCE_CAST(Type) \ |
120 template <> inline Type* Resource::Cast<Type>() { \ | 120 template <> inline Type* Resource::Cast<Type>() { \ |
121 return As##Type(); \ | 121 return As##Type(); \ |
122 } | 122 } |
123 | 123 |
124 DEFINE_RESOURCE_CAST(Audio) | 124 DEFINE_RESOURCE_CAST(Audio) |
125 DEFINE_RESOURCE_CAST(AudioConfig) | 125 DEFINE_RESOURCE_CAST(AudioConfig) |
126 DEFINE_RESOURCE_CAST(Buffer) | 126 DEFINE_RESOURCE_CAST(Buffer) |
127 DEFINE_RESOURCE_CAST(DeviceContext2D) | |
128 DEFINE_RESOURCE_CAST(DirectoryReader) | 127 DEFINE_RESOURCE_CAST(DirectoryReader) |
129 DEFINE_RESOURCE_CAST(FileChooser) | 128 DEFINE_RESOURCE_CAST(FileChooser) |
130 DEFINE_RESOURCE_CAST(FileIO) | 129 DEFINE_RESOURCE_CAST(FileIO) |
131 DEFINE_RESOURCE_CAST(FileRef) | 130 DEFINE_RESOURCE_CAST(FileRef) |
132 DEFINE_RESOURCE_CAST(Font) | 131 DEFINE_RESOURCE_CAST(Font) |
| 132 DEFINE_RESOURCE_CAST(Graphics2D) |
133 DEFINE_RESOURCE_CAST(Graphics3D) | 133 DEFINE_RESOURCE_CAST(Graphics3D) |
134 DEFINE_RESOURCE_CAST(ImageData) | 134 DEFINE_RESOURCE_CAST(ImageData) |
135 DEFINE_RESOURCE_CAST(PrivateFontFile) | 135 DEFINE_RESOURCE_CAST(PrivateFontFile) |
136 DEFINE_RESOURCE_CAST(Scrollbar) | 136 DEFINE_RESOURCE_CAST(Scrollbar) |
137 DEFINE_RESOURCE_CAST(URLLoader) | 137 DEFINE_RESOURCE_CAST(URLLoader) |
138 DEFINE_RESOURCE_CAST(URLRequestInfo) | 138 DEFINE_RESOURCE_CAST(URLRequestInfo) |
139 DEFINE_RESOURCE_CAST(URLResponseInfo) | 139 DEFINE_RESOURCE_CAST(URLResponseInfo) |
140 DEFINE_RESOURCE_CAST(VideoDecoder) | 140 DEFINE_RESOURCE_CAST(VideoDecoder) |
141 DEFINE_RESOURCE_CAST(Widget) | 141 DEFINE_RESOURCE_CAST(Widget) |
142 | 142 |
143 #undef DEFINE_RESOURCE_CAST | 143 #undef DEFINE_RESOURCE_CAST |
144 } // namespace pepper | 144 } // namespace pepper |
145 | 145 |
146 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 146 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
OLD | NEW |