| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/renderer/extensions/blob_native_handler.h" | 5 #include "chrome/renderer/extensions/blob_native_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "third_party/WebKit/public/platform/WebCString.h" | 8 #include "third_party/WebKit/public/platform/WebCString.h" |
| 9 #include "third_party/WebKit/public/platform/WebURL.h" | 9 #include "third_party/WebKit/public/platform/WebURL.h" |
| 10 #include "third_party/WebKit/public/web/WebBlob.h" | 10 #include "third_party/WebKit/public/web/WebBlob.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // Expects a single Blob argument. Returns the Blob's UUID. | 14 // Expects a single Blob argument. Returns the Blob's UUID. |
| 15 void GetBlobUuid(const v8::FunctionCallbackInfo<v8::Value>& args) { | 15 void GetBlobUuid(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 16 DCHECK_EQ(1, args.Length()); | 16 DCHECK_EQ(1, args.Length()); |
| 17 blink::WebBlob blob = blink::WebBlob::fromV8Value(args[0]); | 17 blink::WebBlob blob = blink::WebBlob::fromV8Value(args[0]); |
| 18 args.GetReturnValue().Set( | 18 args.GetReturnValue().Set( |
| 19 v8::String::NewFromUtf8(args.GetIsolate(), blob.uuid().utf8().data())); | 19 v8::String::NewFromUtf8(args.GetIsolate(), blob.uuid().utf8().data())); |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 | 25 |
| 26 BlobNativeHandler::BlobNativeHandler(ChromeV8Context* context) | 26 BlobNativeHandler::BlobNativeHandler(ScriptContext* context) |
| 27 : ObjectBackedNativeHandler(context) { | 27 : ObjectBackedNativeHandler(context) { |
| 28 RouteFunction("GetBlobUuid", base::Bind(&GetBlobUuid)); | 28 RouteFunction("GetBlobUuid", base::Bind(&GetBlobUuid)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace extensions | 31 } // namespace extensions |
| OLD | NEW |