Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/renderer/extensions/app_runtime_custom_bindings.cc

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/app_runtime_custom_bindings.h" 5 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "third_party/WebKit/public/platform/WebCString.h" 9 #include "third_party/WebKit/public/platform/WebCString.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 10 #include "third_party/WebKit/public/platform/WebString.h"
11 #include "third_party/WebKit/public/web/WebBlob.h" 11 #include "third_party/WebKit/public/web/WebBlob.h"
12 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" 12 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
13 13
14 using WebKit::WebBlob; 14 using blink::WebBlob;
15 using WebKit::WebSerializedScriptValue; 15 using blink::WebSerializedScriptValue;
16 using WebKit::WebString; 16 using blink::WebString;
17 17
18 namespace { 18 namespace {
19 19
20 void DeserializeString(const v8::FunctionCallbackInfo<v8::Value> &args) { 20 void DeserializeString(const v8::FunctionCallbackInfo<v8::Value> &args) {
21 DCHECK(args.Length() == 1); 21 DCHECK(args.Length() == 1);
22 DCHECK(args[0]->IsString()); 22 DCHECK(args[0]->IsString());
23 23
24 std::string data_v8(*v8::String::Utf8Value(args[0])); 24 std::string data_v8(*v8::String::Utf8Value(args[0]));
25 WebString data_webstring = WebString::fromUTF8(data_v8); 25 WebString data_webstring = WebString::fromUTF8(data_v8);
26 WebSerializedScriptValue serialized = 26 WebSerializedScriptValue serialized =
(...skipping 13 matching lines...) Expand all
40 40
41 void CreateBlob(const v8::FunctionCallbackInfo<v8::Value> &args) { 41 void CreateBlob(const v8::FunctionCallbackInfo<v8::Value> &args) {
42 DCHECK(args.Length() == 2); 42 DCHECK(args.Length() == 2);
43 DCHECK(args[0]->IsString()); 43 DCHECK(args[0]->IsString());
44 DCHECK(args[1]->IsNumber()); 44 DCHECK(args[1]->IsNumber());
45 45
46 std::string blob_file_path(*v8::String::Utf8Value(args[0])); 46 std::string blob_file_path(*v8::String::Utf8Value(args[0]));
47 std::string blob_length_string(*v8::String::Utf8Value(args[1])); 47 std::string blob_length_string(*v8::String::Utf8Value(args[1]));
48 int64 blob_length = 0; 48 int64 blob_length = 0;
49 DCHECK(base::StringToInt64(blob_length_string, &blob_length)); 49 DCHECK(base::StringToInt64(blob_length_string, &blob_length));
50 WebKit::WebBlob web_blob = WebBlob::createFromFile( 50 blink::WebBlob web_blob = WebBlob::createFromFile(
51 WebString::fromUTF8(blob_file_path), blob_length); 51 WebString::fromUTF8(blob_file_path), blob_length);
52 args.GetReturnValue().Set(web_blob.toV8Value()); 52 args.GetReturnValue().Set(web_blob.toV8Value());
53 } 53 }
54 54
55 } // namespace 55 } // namespace
56 56
57 namespace extensions { 57 namespace extensions {
58 58
59 AppRuntimeCustomBindings::AppRuntimeCustomBindings( 59 AppRuntimeCustomBindings::AppRuntimeCustomBindings(
60 Dispatcher* dispatcher, 60 Dispatcher* dispatcher,
61 ChromeV8Context* context) : ChromeV8Extension(dispatcher, context) { 61 ChromeV8Context* context) : ChromeV8Extension(dispatcher, context) {
62 RouteFunction("DeserializeString", base::Bind(&DeserializeString)); 62 RouteFunction("DeserializeString", base::Bind(&DeserializeString));
63 RouteFunction("SerializeToString", base::Bind(&SerializeToString)); 63 RouteFunction("SerializeToString", base::Bind(&SerializeToString));
64 RouteFunction("CreateBlob", base::Bind(&CreateBlob)); 64 RouteFunction("CreateBlob", base::Bind(&CreateBlob));
65 } 65 }
66 66
67 } // namespace extensions 67 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/app_bindings.cc ('k') | chrome/renderer/extensions/app_window_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698