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

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

Issue 334333004: [webcrypto] exportKey() now returns dictionary when format='jwk' (CL 1 of 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, for funzies Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/child/webcrypto/webcrypto_impl.h" 5 #include "content/child/webcrypto/webcrypto_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 DCHECK(state->key.handle()); 450 DCHECK(state->key.handle());
451 DCHECK(!state->key.algorithm().isNull()); 451 DCHECK(!state->key.algorithm().isNull());
452 DCHECK_EQ(state->extractable, state->key.extractable()); 452 DCHECK_EQ(state->extractable, state->key.extractable());
453 } 453 }
454 454
455 state->origin_thread->PostTask( 455 state->origin_thread->PostTask(
456 FROM_HERE, base::Bind(DoImportKeyReply, Passed(&passed_state))); 456 FROM_HERE, base::Bind(DoImportKeyReply, Passed(&passed_state)));
457 } 457 }
458 458
459 void DoExportKeyReply(scoped_ptr<ExportKeyState> state) { 459 void DoExportKeyReply(scoped_ptr<ExportKeyState> state) {
460 #ifndef WEBCRYPTO_RESULT_ACCEPTS_JSON
461 // TODO(eroman): Remove idfef once blink rolls.
460 CompleteWithBufferOrError(state->status, state->buffer, &state->result); 462 CompleteWithBufferOrError(state->status, state->buffer, &state->result);
463 #else
464 if (state->format != blink::WebCryptoKeyFormatJwk) {
465 CompleteWithBufferOrError(state->status, state->buffer, &state->result);
466 return;
467 }
468
469 if (state->status.IsError()) {
470 CompleteWithError(state->status, &state->result);
471 } else {
472 state->result.completeWithJson(
473 reinterpret_cast<const char*>(
474 webcrypto::Uint8VectorStart(&state->buffer)),
475 state->buffer.size());
Ryan Sleevi 2014/06/17 19:15:20 This feels like there's a dependent CL here (perha
476 }
477 #endif
461 } 478 }
462 479
463 void DoExportKey(scoped_ptr<ExportKeyState> passed_state) { 480 void DoExportKey(scoped_ptr<ExportKeyState> passed_state) {
464 ExportKeyState* state = passed_state.get(); 481 ExportKeyState* state = passed_state.get();
465 state->status = 482 state->status =
466 webcrypto::ExportKey(state->format, state->key, &state->buffer); 483 webcrypto::ExportKey(state->format, state->key, &state->buffer);
467 state->origin_thread->PostTask( 484 state->origin_thread->PostTask(
468 FROM_HERE, base::Bind(DoExportKeyReply, Passed(&passed_state))); 485 FROM_HERE, base::Bind(DoExportKeyReply, Passed(&passed_state)));
469 } 486 }
470 487
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 &key); 747 &key);
731 } 748 }
732 749
733 bool WebCryptoImpl::serializeKeyForClone( 750 bool WebCryptoImpl::serializeKeyForClone(
734 const blink::WebCryptoKey& key, 751 const blink::WebCryptoKey& key,
735 blink::WebVector<unsigned char>& key_data) { 752 blink::WebVector<unsigned char>& key_data) {
736 return webcrypto::SerializeKeyForClone(key, &key_data); 753 return webcrypto::SerializeKeyForClone(key, &key_data);
737 } 754 }
738 755
739 } // namespace content 756 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698