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

Side by Side Diff: content/child/webcrypto/jwk.cc

Issue 243433006: [webcrypto] Set the error type for failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
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 <algorithm> 5 #include <algorithm>
6 #include <functional> 6 #include <functional>
7 #include <map> 7 #include <map>
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 787
788 } 788 }
789 789
790 return Status::ErrorJwkUnrecognizedKty(); 790 return Status::ErrorJwkUnrecognizedKty();
791 } 791 }
792 792
793 Status ExportKeyJwk(const blink::WebCryptoKey& key, 793 Status ExportKeyJwk(const blink::WebCryptoKey& key,
794 blink::WebArrayBuffer* buffer) { 794 blink::WebArrayBuffer* buffer) {
795 DCHECK(key.extractable()); 795 DCHECK(key.extractable());
796 base::DictionaryValue jwk_dict; 796 base::DictionaryValue jwk_dict;
797 Status status = Status::Error(); 797 Status status = Status::OperationError();
Ryan Sleevi 2014/04/22 23:45:50 What part of the spec led you to believe this was
eroman 2014/04/23 00:11:30 I renamed Status::Error() to Status::OperationErro
798 798
799 switch (key.type()) { 799 switch (key.type()) {
800 case blink::WebCryptoKeyTypeSecret: { 800 case blink::WebCryptoKeyTypeSecret: {
801 blink::WebArrayBuffer exported_key; 801 blink::WebArrayBuffer exported_key;
802 status = ExportKey(blink::WebCryptoKeyFormatRaw, key, &exported_key); 802 status = ExportKey(blink::WebCryptoKeyFormatRaw, key, &exported_key);
803 if (status.IsError()) 803 if (status.IsError())
804 return status; 804 return status;
805 WriteSecretKey(exported_key, &jwk_dict); 805 WriteSecretKey(exported_key, &jwk_dict);
806 break; 806 break;
807 } 807 }
(...skipping 28 matching lines...) Expand all
836 std::string json; 836 std::string json;
837 base::JSONWriter::Write(&jwk_dict, &json); 837 base::JSONWriter::Write(&jwk_dict, &json);
838 *buffer = CreateArrayBuffer(reinterpret_cast<const uint8*>(json.data()), 838 *buffer = CreateArrayBuffer(reinterpret_cast<const uint8*>(json.data()),
839 json.size()); 839 json.size());
840 return Status::Success(); 840 return Status::Success();
841 } 841 }
842 842
843 } // namespace webcrypto 843 } // namespace webcrypto
844 844
845 } // namespace content 845 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/webcrypto/platform_crypto_nss.cc » ('j') | content/child/webcrypto/platform_crypto_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698