OLD | NEW |
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/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 "content/public/child/v8_value_converter.h" | 10 #include "content/public/child/v8_value_converter.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if (hash) { | 78 if (hash) { |
79 const blink::WebCryptoAlgorithmInfo* hash_info = | 79 const blink::WebCryptoAlgorithmInfo* hash_info = |
80 blink::WebCryptoAlgorithm::lookupAlgorithmInfo(hash->id()); | 80 blink::WebCryptoAlgorithm::lookupAlgorithmInfo(hash->id()); |
81 | 81 |
82 scoped_ptr<base::DictionaryValue> hash_dict(new base::DictionaryValue); | 82 scoped_ptr<base::DictionaryValue> hash_dict(new base::DictionaryValue); |
83 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name); | 83 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name); |
84 dict->SetWithoutPathExpansion("hash", hash_dict.release()); | 84 dict->SetWithoutPathExpansion("hash", hash_dict.release()); |
85 } | 85 } |
86 // Otherwise, |algorithm| is missing support here or no parameters were | 86 // Otherwise, |algorithm| is missing support here or no parameters were |
87 // required. | 87 // required. |
88 return dict.Pass(); | 88 return dict; |
89 } | 89 } |
90 | 90 |
91 } // namespace | 91 } // namespace |
92 | 92 |
93 PlatformKeysNatives::PlatformKeysNatives(ScriptContext* context) | 93 PlatformKeysNatives::PlatformKeysNatives(ScriptContext* context) |
94 : ObjectBackedNativeHandler(context) { | 94 : ObjectBackedNativeHandler(context) { |
95 RouteFunction("NormalizeAlgorithm", | 95 RouteFunction("NormalizeAlgorithm", |
96 base::Bind(&PlatformKeysNatives::NormalizeAlgorithm, | 96 base::Bind(&PlatformKeysNatives::NormalizeAlgorithm, |
97 base::Unretained(this))); | 97 base::Unretained(this))); |
98 } | 98 } |
(...skipping 24 matching lines...) Expand all Loading... |
123 if (!algorithm_dict) | 123 if (!algorithm_dict) |
124 return; | 124 return; |
125 | 125 |
126 scoped_ptr<content::V8ValueConverter> converter( | 126 scoped_ptr<content::V8ValueConverter> converter( |
127 content::V8ValueConverter::create()); | 127 content::V8ValueConverter::create()); |
128 call_info.GetReturnValue().Set( | 128 call_info.GetReturnValue().Set( |
129 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); | 129 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); |
130 } | 130 } |
131 | 131 |
132 } // namespace extensions | 132 } // namespace extensions |
OLD | NEW |