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/enterprise_platform_keys_natives.h" | 5 #include "chrome/renderer/extensions/enterprise_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" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 blink::WebCryptoOperation operation; | 90 blink::WebCryptoOperation operation; |
91 if (!StringToWebCryptoOperation(*v8::String::Utf8Value(call_info[1]), | 91 if (!StringToWebCryptoOperation(*v8::String::Utf8Value(call_info[1]), |
92 &operation)) { | 92 &operation)) { |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
96 blink::WebString error_details; | 96 blink::WebString error_details; |
97 int exception_code = 0; | 97 int exception_code = 0; |
98 | 98 |
99 blink::WebCryptoAlgorithm algorithm = | 99 blink::WebCryptoAlgorithm algorithm = blink::normalizeCryptoAlgorithm( |
100 blink::normalizeCryptoAlgorithm(call_info[0]->ToObject(), | 100 v8::Local<v8::Object>::Cast(call_info[0]), operation, &exception_code, |
101 operation, | 101 &error_details, call_info.GetIsolate()); |
102 &exception_code, | |
103 &error_details, | |
104 call_info.GetIsolate()); | |
105 | 102 |
106 scoped_ptr<base::DictionaryValue> algorithm_dict; | 103 scoped_ptr<base::DictionaryValue> algorithm_dict; |
107 if (!algorithm.isNull()) | 104 if (!algorithm.isNull()) |
108 algorithm_dict = WebCryptoAlgorithmToBaseValue(algorithm); | 105 algorithm_dict = WebCryptoAlgorithmToBaseValue(algorithm); |
109 | 106 |
110 if (!algorithm_dict) | 107 if (!algorithm_dict) |
111 return; | 108 return; |
112 | 109 |
113 scoped_ptr<content::V8ValueConverter> converter( | 110 scoped_ptr<content::V8ValueConverter> converter( |
114 content::V8ValueConverter::create()); | 111 content::V8ValueConverter::create()); |
115 call_info.GetReturnValue().Set( | 112 call_info.GetReturnValue().Set( |
116 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); | 113 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); |
117 } | 114 } |
118 | 115 |
119 } // namespace extensions | 116 } // namespace extensions |
OLD | NEW |