| 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 25 matching lines...) Expand all Loading... |
| 36 #include "bindings/v8/NPV8Object.h" // for PrivateIdentifier | 36 #include "bindings/v8/NPV8Object.h" // for PrivateIdentifier |
| 37 #include "bindings/v8/ScriptController.h" | 37 #include "bindings/v8/ScriptController.h" |
| 38 #include "bindings/v8/V8DOMWrapper.h" | 38 #include "bindings/v8/V8DOMWrapper.h" |
| 39 #include "bindings/v8/V8NPObject.h" | 39 #include "bindings/v8/V8NPObject.h" |
| 40 #include "bindings/v8/V8NPUtils.h" | 40 #include "bindings/v8/V8NPUtils.h" |
| 41 #include "bindings/v8/custom/V8ArrayBufferCustom.h" | 41 #include "bindings/v8/custom/V8ArrayBufferCustom.h" |
| 42 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" | 42 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" |
| 43 #include "bindings/v8/npruntime_impl.h" | 43 #include "bindings/v8/npruntime_impl.h" |
| 44 #include "bindings/v8/npruntime_priv.h" | 44 #include "bindings/v8/npruntime_priv.h" |
| 45 #include "core/dom/Range.h" | 45 #include "core/dom/Range.h" |
| 46 #include "core/frame/DOMWindow.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 WebCore; | 54 using namespace WebCore; |
| 55 | 55 |
| 56 namespace blink { | 56 namespace blink { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 return true; | 317 return true; |
| 318 } | 318 } |
| 319 | 319 |
| 320 static NPObject* makeIntArrayImpl(const WebVector<int>& data, v8::Isolate* isola
te) | 320 static NPObject* makeIntArrayImpl(const WebVector<int>& data, v8::Isolate* isola
te) |
| 321 { | 321 { |
| 322 v8::HandleScope handleScope(isolate); | 322 v8::HandleScope handleScope(isolate); |
| 323 v8::Handle<v8::Array> result = v8::Array::New(isolate, data.size()); | 323 v8::Handle<v8::Array> result = v8::Array::New(isolate, data.size()); |
| 324 for (size_t i = 0; i < data.size(); ++i) | 324 for (size_t i = 0; i < data.size(); ++i) |
| 325 result->Set(i, v8::Number::New(isolate, data[i])); | 325 result->Set(i, v8::Number::New(isolate, data[i])); |
| 326 | 326 |
| 327 DOMWindow* window = currentDOMWindow(isolate); | 327 LocalDOMWindow* window = currentDOMWindow(isolate); |
| 328 return npCreateV8ScriptObject(0, result, window, isolate); | 328 return npCreateV8ScriptObject(0, result, window, isolate); |
| 329 } | 329 } |
| 330 | 330 |
| 331 static NPObject* makeStringArrayImpl(const WebVector<WebString>& data, v8::Isola
te* isolate) | 331 static NPObject* makeStringArrayImpl(const WebVector<WebString>& data, v8::Isola
te* isolate) |
| 332 { | 332 { |
| 333 v8::HandleScope handleScope(isolate); | 333 v8::HandleScope handleScope(isolate); |
| 334 v8::Handle<v8::Array> result = v8::Array::New(isolate, data.size()); | 334 v8::Handle<v8::Array> result = v8::Array::New(isolate, data.size()); |
| 335 for (size_t i = 0; i < data.size(); ++i) | 335 for (size_t i = 0; i < data.size(); ++i) |
| 336 result->Set(i, v8String(isolate, data[i])); | 336 result->Set(i, v8String(isolate, data[i])); |
| 337 | 337 |
| 338 DOMWindow* window = currentDOMWindow(isolate); | 338 LocalDOMWindow* window = currentDOMWindow(isolate); |
| 339 return npCreateV8ScriptObject(0, result, window, isolate); | 339 return npCreateV8ScriptObject(0, result, window, isolate); |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool WebBindings::getRange(NPObject* range, WebRange* webRange) | 342 bool WebBindings::getRange(NPObject* range, WebRange* webRange) |
| 343 { | 343 { |
| 344 return getRangeImpl(range, webRange, v8::Isolate::GetCurrent()); | 344 return getRangeImpl(range, webRange, v8::Isolate::GetCurrent()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 bool WebBindings::getArrayBuffer(NPObject* arrayBuffer, WebArrayBuffer* webArray
Buffer) | 347 bool WebBindings::getArrayBuffer(NPObject* arrayBuffer, WebArrayBuffer* webArray
Buffer) |
| 348 { | 348 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (!v8Object) | 398 if (!v8Object) |
| 399 return v8::Undefined(isolate); | 399 return v8::Undefined(isolate); |
| 400 return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()
->script().windowScriptNPObject(), isolate); | 400 return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()
->script().windowScriptNPObject(), isolate); |
| 401 } | 401 } |
| 402 // Safe to pass 0 since we have checked the script object class to make sure
the | 402 // Safe to pass 0 since we have checked the script object class to make sure
the |
| 403 // argument is a primitive v8 type. | 403 // argument is a primitive v8 type. |
| 404 return convertNPVariantToV8Object(variant, 0, isolate); | 404 return convertNPVariantToV8Object(variant, 0, isolate); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace blink | 407 } // namespace blink |
| OLD | NEW |