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 | 11 |
12 namespace pepper { | 12 namespace pepper { |
13 | 13 |
14 class Buffer; | 14 class Buffer; |
15 class DeviceContext2D; | 15 class DeviceContext2D; |
| 16 class DirectoryReader; |
| 17 class FileChooser; |
| 18 class FileIO; |
| 19 class FileRef; |
16 class ImageData; | 20 class ImageData; |
17 class PluginModule; | 21 class PluginModule; |
18 class URLLoader; | 22 class URLLoader; |
19 class URLRequestInfo; | 23 class URLRequestInfo; |
20 class URLResponseInfo; | 24 class URLResponseInfo; |
21 | 25 |
22 class Resource : public base::RefCountedThreadSafe<Resource> { | 26 class Resource : public base::RefCountedThreadSafe<Resource> { |
23 public: | 27 public: |
24 explicit Resource(PluginModule* module); | 28 explicit Resource(PluginModule* module); |
25 virtual ~Resource(); | 29 virtual ~Resource(); |
26 | 30 |
27 PP_Resource GetResource() const; | 31 PP_Resource GetResource() const; |
28 | 32 |
29 PluginModule* module() const { return module_; } | 33 PluginModule* module() const { return module_; } |
30 | 34 |
31 // Type-specific getters for individual resource types. These will return | 35 // Type-specific getters for individual resource types. These will return |
32 // NULL if the resource does not match the specified type. | 36 // NULL if the resource does not match the specified type. |
| 37 virtual Buffer* AsBuffer() { return NULL; } |
33 virtual DeviceContext2D* AsDeviceContext2D() { return NULL; } | 38 virtual DeviceContext2D* AsDeviceContext2D() { return NULL; } |
| 39 virtual DirectoryReader* AsDirectoryReader() { return NULL; } |
| 40 virtual FileChooser* AsFileChooser() { return NULL; } |
| 41 virtual FileIO* AsFileIO() { return NULL; } |
| 42 virtual FileRef* AsFileRef() { return NULL; } |
34 virtual ImageData* AsImageData() { return NULL; } | 43 virtual ImageData* AsImageData() { return NULL; } |
35 virtual URLLoader* AsURLLoader() { return NULL; } | 44 virtual URLLoader* AsURLLoader() { return NULL; } |
36 virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } | 45 virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } |
37 virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } | 46 virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } |
38 virtual Buffer* AsBuffer() { return NULL; } | |
39 | 47 |
40 private: | 48 private: |
41 PluginModule* module_; // Non-owning pointer to our module. | 49 PluginModule* module_; // Non-owning pointer to our module. |
42 | 50 |
43 DISALLOW_COPY_AND_ASSIGN(Resource); | 51 DISALLOW_COPY_AND_ASSIGN(Resource); |
44 }; | 52 }; |
45 | 53 |
46 } // namespace pepper | 54 } // namespace pepper |
47 | 55 |
48 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 56 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
OLD | NEW |