| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains definitions for CppVariant. | 5 // This file contains definitions for CppVariant. |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 9 #include "webkit/glue/cpp_variant.h" | 9 #include "webkit/glue/cpp_variant.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 | 14 |
| 15 using WebKit::WebBindings; | 15 using WebKit::WebBindings; |
| 16 | 16 |
| 17 namespace webkit_glue { |
| 18 |
| 17 CppVariant::CppVariant() { | 19 CppVariant::CppVariant() { |
| 18 type = NPVariantType_Null; | 20 type = NPVariantType_Null; |
| 19 } | 21 } |
| 20 | 22 |
| 21 // Note that Set() performs a deep copy, which is necessary to safely | 23 // Note that Set() performs a deep copy, which is necessary to safely |
| 22 // call FreeData() on the value in the destructor. | 24 // call FreeData() on the value in the destructor. |
| 23 CppVariant::CppVariant(const CppVariant& original) { | 25 CppVariant::CppVariant(const CppVariant& original) { |
| 24 type = NPVariantType_Null; | 26 type = NPVariantType_Null; |
| 25 Set(original); | 27 Set(original); |
| 26 } | 28 } |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 NPObject* np_object = value.objectValue; | 256 NPObject* np_object = value.objectValue; |
| 255 if (WebBindings::hasMethod(NULL, np_object, method_name)) { | 257 if (WebBindings::hasMethod(NULL, np_object, method_name)) { |
| 256 NPVariant r; | 258 NPVariant r; |
| 257 bool status = WebBindings::invoke(NULL, np_object, method_name, args, arg_co
unt, &r); | 259 bool status = WebBindings::invoke(NULL, np_object, method_name, args, arg_co
unt, &r); |
| 258 result.Set(r); | 260 result.Set(r); |
| 259 return status; | 261 return status; |
| 260 } else { | 262 } else { |
| 261 return false; | 263 return false; |
| 262 } | 264 } |
| 263 } | 265 } |
| 266 |
| 267 } // namespace webkit_glue |
| OLD | NEW |