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_VAR_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 typedef struct _pp_Var PP_Var; | 10 typedef struct _pp_Var PP_Var; |
9 typedef struct _ppb_Var PPB_Var; | 11 typedef struct _ppb_Var PPB_Var; |
10 typedef struct NPObject NPObject; | 12 typedef struct NPObject NPObject; |
11 typedef struct _NPVariant NPVariant; | 13 typedef struct _NPVariant NPVariant; |
12 typedef void* NPIdentifier; | 14 typedef void* NPIdentifier; |
13 | 15 |
14 namespace pepper { | 16 namespace pepper { |
15 | 17 |
16 class String; | 18 class String; |
17 | 19 |
18 // There's no class implementing Var since it could represent a number of | 20 // There's no class implementing Var since it could represent a number of |
19 // objects. Instead, we just expose a getter for the interface implemented in | 21 // objects. Instead, we just expose a getter for the interface implemented in |
20 // the .cc file here. | 22 // the .cc file here. |
21 const PPB_Var* GetVarInterface(); | 23 const PPB_Var* GetVarInterface(); |
22 | 24 |
23 // Returns a PP_Var of type object that wraps the given NPObject. Calling this | 25 // Returns a PP_Var of type object that wraps the given NPObject. Calling this |
24 // function multiple times given the same NPObject results in the same PP_Var. | 26 // function multiple times given the same NPObject results in the same PP_Var. |
25 PP_Var NPObjectToPPVar(NPObject* object); | 27 PP_Var NPObjectToPPVar(NPObject* object); |
26 | 28 |
27 // Returns the NPObject corresponding to the PP_Var. This pointer has not been | 29 // Returns the NPObject corresponding to the PP_Var. This pointer has not been |
28 // retained, so you should not call WebBindings::releaseObject unless you first | 30 // retained, so you should not call WebBindings::releaseObject unless you first |
29 // call WebBindings::retainObject. Returns NULL if the PP_Var is not an object | 31 // call WebBindings::retainObject. Returns NULL if the PP_Var is not an object |
30 // type. | 32 // type. |
31 NPObject* GetNPObject(PP_Var var); | 33 NPObject* GetNPObject(PP_Var var); |
32 | 34 |
| 35 // Returns a PP_Var of type string that contains a copy of the given string. |
| 36 // The input data must be valid UTF-8 encoded text. |
| 37 PP_Var StringToPPVar(const std::string& str); |
| 38 |
33 // Returns the String corresponding to the PP_Var. This pointer has not been | 39 // Returns the String corresponding to the PP_Var. This pointer has not been |
34 // AddRef'd, so you should not call Release! Returns NULL if the PP_Var is not | 40 // AddRef'd, so you should not call Release! Returns NULL if the PP_Var is not |
35 // a string type. | 41 // a string type. |
36 String* GetString(PP_Var var); | 42 String* GetString(PP_Var var); |
37 | 43 |
38 } // namespace pepper | 44 } // namespace pepper |
39 | 45 |
40 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ | 46 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ |
OLD | NEW |