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

Side by Side Diff: extensions/renderer/utils_native_handler.cc

Issue 332233002: enterprise.platformKeys: Copy-on-read the 'algorithm' member of Key objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed the unnecessary unit test. Created 6 years, 6 months 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
« no previous file with comments | « extensions/renderer/utils_native_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/utils_native_handler.h" 5 #include "extensions/renderer/utils_native_handler.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "extensions/renderer/script_context.h" 8 #include "extensions/renderer/script_context.h"
9 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" 9 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
10 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
10 11
11 namespace extensions { 12 namespace extensions {
12 13
13 UtilsNativeHandler::UtilsNativeHandler(ScriptContext* context) 14 UtilsNativeHandler::UtilsNativeHandler(ScriptContext* context)
14 : ObjectBackedNativeHandler(context) { 15 : ObjectBackedNativeHandler(context) {
15 RouteFunction("createClassWrapper", 16 RouteFunction("createClassWrapper",
16 base::Bind(&UtilsNativeHandler::CreateClassWrapper, 17 base::Bind(&UtilsNativeHandler::CreateClassWrapper,
17 base::Unretained(this))); 18 base::Unretained(this)));
19 RouteFunction(
20 "deepCopy",
21 base::Bind(&UtilsNativeHandler::DeepCopy, base::Unretained(this)));
18 } 22 }
19 23
20 UtilsNativeHandler::~UtilsNativeHandler() {} 24 UtilsNativeHandler::~UtilsNativeHandler() {}
21 25
22 void UtilsNativeHandler::CreateClassWrapper( 26 void UtilsNativeHandler::CreateClassWrapper(
23 const v8::FunctionCallbackInfo<v8::Value>& args) { 27 const v8::FunctionCallbackInfo<v8::Value>& args) {
24 CHECK_EQ(3, args.Length()); 28 CHECK_EQ(3, args.Length());
25 CHECK(args[0]->IsString()); 29 CHECK(args[0]->IsString());
26 std::string name = *v8::String::Utf8Value(args[0]); 30 std::string name = *v8::String::Utf8Value(args[0]);
27 CHECK(args[1]->IsObject()); 31 CHECK(args[1]->IsObject());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 try_catch.SetCaptureMessage(true); 78 try_catch.SetCaptureMessage(true);
75 result = context()->CallFunction(func, arraysize(func_args), func_args); 79 result = context()->CallFunction(func, arraysize(func_args), func_args);
76 if (try_catch.HasCaught()) { 80 if (try_catch.HasCaught()) {
77 args.GetReturnValue().SetUndefined(); 81 args.GetReturnValue().SetUndefined();
78 return; 82 return;
79 } 83 }
80 } 84 }
81 args.GetReturnValue().Set(result); 85 args.GetReturnValue().Set(result);
82 } 86 }
83 87
88 void UtilsNativeHandler::DeepCopy(
89 const v8::FunctionCallbackInfo<v8::Value>& args) {
90 CHECK_EQ(1, args.Length());
91 args.GetReturnValue().Set(
92 blink::WebSerializedScriptValue::serialize(args[0]).deserialize());
93 }
94
84 } // namespace extensions 95 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/utils_native_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698