| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 DOMWindow* window = currentDOMWindow(isolate); |
| 328 return npCreateV8ScriptObject(0, result, window, isolate); | 328 return npCreateV8ScriptValue(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 DOMWindow* window = currentDOMWindow(isolate); |
| 339 return npCreateV8ScriptObject(0, result, window, isolate); | 339 return npCreateV8ScriptValue(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 { |
| 349 return getArrayBufferImpl(arrayBuffer, webArrayBuffer, v8::Isolate::GetCurre
nt()); | 349 return getArrayBufferImpl(arrayBuffer, webArrayBuffer, v8::Isolate::GetCurre
nt()); |
| (...skipping 48 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 |