| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/values.h" | 11 #include "base/values.h" |
| 11 #include "content/public/child/v8_value_converter.h" | 12 #include "content/public/child/v8_value_converter.h" |
| 12 #include "extensions/renderer/script_context.h" | 13 #include "extensions/renderer/script_context.h" |
| 13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
| 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" | 15 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
| 15 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
| 16 #include "third_party/WebKit/public/platform/WebVector.h" | 17 #include "third_party/WebKit/public/platform/WebVector.h" |
| 17 #include "third_party/WebKit/public/web/WebCryptoNormalize.h" | 18 #include "third_party/WebKit/public/web/WebCryptoNormalize.h" |
| 18 | 19 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 hash = &rsaHashedImport->GetHash(); | 76 hash = &rsaHashedImport->GetHash(); |
| 76 DCHECK(!hash->IsNull()); | 77 DCHECK(!hash->IsNull()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 if (hash) { | 80 if (hash) { |
| 80 const blink::WebCryptoAlgorithmInfo* hash_info = | 81 const blink::WebCryptoAlgorithmInfo* hash_info = |
| 81 blink::WebCryptoAlgorithm::LookupAlgorithmInfo(hash->Id()); | 82 blink::WebCryptoAlgorithm::LookupAlgorithmInfo(hash->Id()); |
| 82 | 83 |
| 83 std::unique_ptr<base::DictionaryValue> hash_dict(new base::DictionaryValue); | 84 std::unique_ptr<base::DictionaryValue> hash_dict(new base::DictionaryValue); |
| 84 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name); | 85 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name); |
| 85 dict->SetWithoutPathExpansion("hash", hash_dict.release()); | 86 dict->SetWithoutPathExpansion("hash", std::move(hash_dict)); |
| 86 } | 87 } |
| 87 // Otherwise, |algorithm| is missing support here or no parameters were | 88 // Otherwise, |algorithm| is missing support here or no parameters were |
| 88 // required. | 89 // required. |
| 89 return dict; | 90 return dict; |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| 93 | 94 |
| 94 PlatformKeysNatives::PlatformKeysNatives(ScriptContext* context) | 95 PlatformKeysNatives::PlatformKeysNatives(ScriptContext* context) |
| 95 : ObjectBackedNativeHandler(context) { | 96 : ObjectBackedNativeHandler(context) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 124 if (!algorithm_dict) | 125 if (!algorithm_dict) |
| 125 return; | 126 return; |
| 126 | 127 |
| 127 std::unique_ptr<content::V8ValueConverter> converter( | 128 std::unique_ptr<content::V8ValueConverter> converter( |
| 128 content::V8ValueConverter::create()); | 129 content::V8ValueConverter::create()); |
| 129 call_info.GetReturnValue().Set( | 130 call_info.GetReturnValue().Set( |
| 130 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); | 131 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace extensions | 134 } // namespace extensions |
| OLD | NEW |