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 #include "webkit/glue/plugins/pepper_var.h" | 5 #include "webkit/glue/plugins/pepper_var.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
10 #include "third_party/ppapi/c/pp_var.h" | 11 #include "third_party/ppapi/c/pp_var.h" |
11 #include "third_party/ppapi/c/ppb_var.h" | 12 #include "third_party/ppapi/c/ppb_var.h" |
12 #include "third_party/ppapi/c/ppp_class.h" | 13 #include "third_party/ppapi/c/ppp_class.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
14 #include "webkit/glue/plugins/pepper_string.h" | 15 #include "webkit/glue/plugins/pepper_string.h" |
15 #include "v8/include/v8.h" | 16 #include "v8/include/v8.h" |
16 | 17 |
17 using WebKit::WebBindings; | 18 using WebKit::WebBindings; |
18 | 19 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return VarFromUtf8(string_value, strlen(string_value)); | 194 return VarFromUtf8(string_value, strlen(string_value)); |
194 | 195 |
195 return PP_MakeInt32(int_value); | 196 return PP_MakeInt32(int_value); |
196 } | 197 } |
197 | 198 |
198 PP_Var NPIdentifierToPPVarString(NPIdentifier id) { | 199 PP_Var NPIdentifierToPPVarString(NPIdentifier id) { |
199 PP_Var var = NPIdentifierToPPVar(id); | 200 PP_Var var = NPIdentifierToPPVar(id); |
200 if (var.type == PP_VARTYPE_STRING) | 201 if (var.type == PP_VARTYPE_STRING) |
201 return var; | 202 return var; |
202 DCHECK(var.type == PP_VARTYPE_INT32); | 203 DCHECK(var.type == PP_VARTYPE_INT32); |
203 const std::string& str = IntToString(var.value.as_int); | 204 const std::string& str = base::IntToString(var.value.as_int); |
204 return VarFromUtf8(str.data(), str.size()); | 205 return VarFromUtf8(str.data(), str.size()); |
205 } | 206 } |
206 | 207 |
207 void ThrowException(NPObject* object, PP_Var exception) { | 208 void ThrowException(NPObject* object, PP_Var exception) { |
208 String* str = GetString(exception); | 209 String* str = GetString(exception); |
209 if (str) | 210 if (str) |
210 WebBindings::setException(object, str->value().c_str()); | 211 WebBindings::setException(object, str->value().c_str()); |
211 } | 212 } |
212 | 213 |
213 // --------------------------------------------------------------------------- | 214 // --------------------------------------------------------------------------- |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 return VarFromUtf8(str.data(), str.size()); | 849 return VarFromUtf8(str.data(), str.size()); |
849 } | 850 } |
850 | 851 |
851 String* GetString(PP_Var var) { | 852 String* GetString(PP_Var var) { |
852 if (var.type != PP_VARTYPE_STRING) | 853 if (var.type != PP_VARTYPE_STRING) |
853 return NULL; | 854 return NULL; |
854 return GetStringUnchecked(var); | 855 return GetStringUnchecked(var); |
855 } | 856 } |
856 | 857 |
857 } // namespace pepper | 858 } // namespace pepper |
OLD | NEW |