| OLD | NEW |
| 1 // Copyright (c) 2012 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 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" | 5 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/common/extensions/extension_messages.h" | 9 #include "chrome/common/extensions/extension_messages.h" |
| 10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 RouteFunction("SendResponseAck", | 24 RouteFunction("SendResponseAck", |
| 25 base::Bind(&PageCaptureCustomBindings::SendResponseAck, | 25 base::Bind(&PageCaptureCustomBindings::SendResponseAck, |
| 26 base::Unretained(this))); | 26 base::Unretained(this))); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void PageCaptureCustomBindings::CreateBlob( | 29 void PageCaptureCustomBindings::CreateBlob( |
| 30 const v8::FunctionCallbackInfo<v8::Value>& args) { | 30 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 31 CHECK(args.Length() == 2); | 31 CHECK(args.Length() == 2); |
| 32 CHECK(args[0]->IsString()); | 32 CHECK(args[0]->IsString()); |
| 33 CHECK(args[1]->IsInt32()); | 33 CHECK(args[1]->IsInt32()); |
| 34 WebKit::WebString path(UTF8ToUTF16(*v8::String::Utf8Value(args[0]))); | 34 blink::WebString path(UTF8ToUTF16(*v8::String::Utf8Value(args[0]))); |
| 35 WebKit::WebBlob blob = | 35 blink::WebBlob blob = |
| 36 WebKit::WebBlob::createFromFile(path, args[1]->Int32Value()); | 36 blink::WebBlob::createFromFile(path, args[1]->Int32Value()); |
| 37 args.GetReturnValue().Set(blob.toV8Value()); | 37 args.GetReturnValue().Set(blob.toV8Value()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void PageCaptureCustomBindings::SendResponseAck( | 40 void PageCaptureCustomBindings::SendResponseAck( |
| 41 const v8::FunctionCallbackInfo<v8::Value>& args) { | 41 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 42 CHECK(args.Length() == 1); | 42 CHECK(args.Length() == 1); |
| 43 CHECK(args[0]->IsInt32()); | 43 CHECK(args[0]->IsInt32()); |
| 44 | 44 |
| 45 content::RenderView* render_view = GetRenderView(); | 45 content::RenderView* render_view = GetRenderView(); |
| 46 if (render_view) { | 46 if (render_view) { |
| 47 render_view->Send(new ExtensionHostMsg_ResponseAck( | 47 render_view->Send(new ExtensionHostMsg_ResponseAck( |
| 48 render_view->GetRoutingID(), args[0]->Int32Value())); | 48 render_view->GetRoutingID(), args[0]->Int32Value())); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace extensions | 52 } // namespace extensions |
| OLD | NEW |