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

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

Issue 847333004: Move parts from enterprise.platformKeysInternal to platformKeysInternal for reuse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_idl
Patch Set: Rebased. Created 5 years, 11 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
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 "chrome/renderer/extensions/enterprise_platform_keys_natives.h" 5 #include "chrome/renderer/extensions/platform_keys_natives.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/renderer/extensions/chrome_v8_context.h" 10 #include "chrome/renderer/extensions/chrome_v8_context.h"
11 #include "content/public/renderer/v8_value_converter.h" 11 #include "content/public/renderer/v8_value_converter.h"
12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
14 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "third_party/WebKit/public/platform/WebVector.h" 15 #include "third_party/WebKit/public/platform/WebVector.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name); 66 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name);
67 dict->SetWithoutPathExpansion("hash", hash_dict.release()); 67 dict->SetWithoutPathExpansion("hash", hash_dict.release());
68 } 68 }
69 // Otherwise, |algorithm| is missing support here or no parameters were 69 // Otherwise, |algorithm| is missing support here or no parameters were
70 // required. 70 // required.
71 return dict.Pass(); 71 return dict.Pass();
72 } 72 }
73 73
74 } // namespace 74 } // namespace
75 75
76 EnterprisePlatformKeysNatives::EnterprisePlatformKeysNatives( 76 PlatformKeysNatives::PlatformKeysNatives(ScriptContext* context)
77 ScriptContext* context)
78 : ObjectBackedNativeHandler(context) { 77 : ObjectBackedNativeHandler(context) {
79 RouteFunction("NormalizeAlgorithm", 78 RouteFunction("NormalizeAlgorithm",
80 base::Bind(&EnterprisePlatformKeysNatives::NormalizeAlgorithm, 79 base::Bind(&PlatformKeysNatives::NormalizeAlgorithm,
81 base::Unretained(this))); 80 base::Unretained(this)));
82 } 81 }
83 82
84 void EnterprisePlatformKeysNatives::NormalizeAlgorithm( 83 void PlatformKeysNatives::NormalizeAlgorithm(
85 const v8::FunctionCallbackInfo<v8::Value>& call_info) { 84 const v8::FunctionCallbackInfo<v8::Value>& call_info) {
86 DCHECK_EQ(call_info.Length(), 2); 85 DCHECK_EQ(call_info.Length(), 2);
87 DCHECK(call_info[0]->IsObject()); 86 DCHECK(call_info[0]->IsObject());
88 DCHECK(call_info[1]->IsString()); 87 DCHECK(call_info[1]->IsString());
89 88
90 blink::WebCryptoOperation operation; 89 blink::WebCryptoOperation operation;
91 if (!StringToWebCryptoOperation(*v8::String::Utf8Value(call_info[1]), 90 if (!StringToWebCryptoOperation(*v8::String::Utf8Value(call_info[1]),
92 &operation)) { 91 &operation)) {
93 return; 92 return;
94 } 93 }
(...skipping 12 matching lines...) Expand all
107 if (!algorithm_dict) 106 if (!algorithm_dict)
108 return; 107 return;
109 108
110 scoped_ptr<content::V8ValueConverter> converter( 109 scoped_ptr<content::V8ValueConverter> converter(
111 content::V8ValueConverter::create()); 110 content::V8ValueConverter::create());
112 call_info.GetReturnValue().Set( 111 call_info.GetReturnValue().Set(
113 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); 112 converter->ToV8Value(algorithm_dict.get(), context()->v8_context()));
114 } 113 }
115 114
116 } // namespace extensions 115 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698