| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "bindings/core/v8/npruntime_priv.h" | 44 #include "bindings/core/v8/npruntime_priv.h" |
| 45 #include "core/dom/Range.h" | 45 #include "core/dom/Range.h" |
| 46 #include "core/frame/LocalDOMWindow.h" | 46 #include "core/frame/LocalDOMWindow.h" |
| 47 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
| 48 #include "public/platform/WebArrayBuffer.h" | 48 #include "public/platform/WebArrayBuffer.h" |
| 49 #include "public/web/WebArrayBufferView.h" | 49 #include "public/web/WebArrayBufferView.h" |
| 50 #include "public/web/WebElement.h" | 50 #include "public/web/WebElement.h" |
| 51 #include "public/web/WebRange.h" | 51 #include "public/web/WebRange.h" |
| 52 #include "wtf/ArrayBufferView.h" | 52 #include "wtf/ArrayBufferView.h" |
| 53 | 53 |
| 54 using namespace blink; | |
| 55 | |
| 56 namespace blink { | 54 namespace blink { |
| 57 | 55 |
| 58 bool WebBindings::construct(NPP npp, NPObject* object, const NPVariant* args, ui
nt32_t argCount, NPVariant* result) | 56 bool WebBindings::construct(NPP npp, NPObject* object, const NPVariant* args, ui
nt32_t argCount, NPVariant* result) |
| 59 { | 57 { |
| 60 return _NPN_Construct(npp, object, args, argCount, result); | 58 return _NPN_Construct(npp, object, args, argCount, result); |
| 61 } | 59 } |
| 62 | 60 |
| 63 NPObject* WebBindings::createObject(NPP npp, NPClass* npClass) | 61 NPObject* WebBindings::createObject(NPP npp, NPClass* npClass) |
| 64 { | 62 { |
| 65 return _NPN_CreateObject(npp, npClass); | 63 return _NPN_CreateObject(npp, npClass); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return 0; | 176 return 0; |
| 179 } | 177 } |
| 180 | 178 |
| 181 void WebBindings::unregisterObject(NPObject* object) | 179 void WebBindings::unregisterObject(NPObject* object) |
| 182 { | 180 { |
| 183 _NPN_UnregisterObject(object); | 181 _NPN_UnregisterObject(object); |
| 184 } | 182 } |
| 185 | 183 |
| 186 void WebBindings::dropV8WrapperForObject(NPObject* object) | 184 void WebBindings::dropV8WrapperForObject(NPObject* object) |
| 187 { | 185 { |
| 188 blink::forgetV8ObjectForNPObject(object); | 186 forgetV8ObjectForNPObject(object); |
| 189 } | 187 } |
| 190 | 188 |
| 191 NPUTF8* WebBindings::utf8FromIdentifier(NPIdentifier identifier) | 189 NPUTF8* WebBindings::utf8FromIdentifier(NPIdentifier identifier) |
| 192 { | 190 { |
| 193 return _NPN_UTF8FromIdentifier(identifier); | 191 return _NPN_UTF8FromIdentifier(identifier); |
| 194 } | 192 } |
| 195 | 193 |
| 196 void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NP
UTF8*& string, int32_t& number, bool& isString) | 194 void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NP
UTF8*& string, int32_t& number, bool& isString) |
| 197 { | 195 { |
| 198 PrivateIdentifier* data = static_cast<PrivateIdentifier*>(identifier); | 196 PrivateIdentifier* data = static_cast<PrivateIdentifier*>(identifier); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 blink::pushExceptionHandler(handler, data); | 377 blink::pushExceptionHandler(handler, data); |
| 380 } | 378 } |
| 381 | 379 |
| 382 void WebBindings::popExceptionHandler() | 380 void WebBindings::popExceptionHandler() |
| 383 { | 381 { |
| 384 blink::popExceptionHandler(); | 382 blink::popExceptionHandler(); |
| 385 } | 383 } |
| 386 | 384 |
| 387 void WebBindings::toNPVariant(v8::Local<v8::Value> object, NPObject* root, NPVar
iant* result) | 385 void WebBindings::toNPVariant(v8::Local<v8::Value> object, NPObject* root, NPVar
iant* result) |
| 388 { | 386 { |
| 389 blink::convertV8ObjectToNPVariant(object, root, result, v8::Isolate::GetCurr
ent()); | 387 convertV8ObjectToNPVariant(object, root, result, v8::Isolate::GetCurrent()); |
| 390 } | 388 } |
| 391 | 389 |
| 392 v8::Handle<v8::Value> WebBindings::toV8Value(const NPVariant* variant) | 390 v8::Handle<v8::Value> WebBindings::toV8Value(const NPVariant* variant) |
| 393 { | 391 { |
| 394 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 392 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 395 if (variant->type == NPVariantType_Object) { | 393 if (variant->type == NPVariantType_Object) { |
| 396 NPObject* object = NPVARIANT_TO_OBJECT(*variant); | 394 NPObject* object = NPVARIANT_TO_OBJECT(*variant); |
| 397 V8NPObject* v8Object = npObjectToV8NPObject(object); | 395 V8NPObject* v8Object = npObjectToV8NPObject(object); |
| 398 if (!v8Object) | 396 if (!v8Object) |
| 399 return v8::Undefined(isolate); | 397 return v8::Undefined(isolate); |
| 400 return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()
->script().windowScriptNPObject(), isolate); | 398 return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()
->script().windowScriptNPObject(), isolate); |
| 401 } | 399 } |
| 402 // Safe to pass 0 since we have checked the script object class to make sure
the | 400 // Safe to pass 0 since we have checked the script object class to make sure
the |
| 403 // argument is a primitive v8 type. | 401 // argument is a primitive v8 type. |
| 404 return convertNPVariantToV8Object(variant, 0, isolate); | 402 return convertNPVariantToV8Object(variant, 0, isolate); |
| 405 } | 403 } |
| 406 | 404 |
| 407 } // namespace blink | 405 } // namespace blink |
| OLD | NEW |