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

Side by Side Diff: chrome/browser/extensions/api/messaging/message_property_provider.cc

Issue 1452853002: Convert vector_as_array to vector::data in //chrome{,cast,os}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vector-data
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/extensions/api/messaging/message_property_provider.h" 5 #include "chrome/browser/extensions/api/messaging/message_property_provider.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::Closure no_tls_channel_id_closure = base::Bind(reply, ""); 83 base::Closure no_tls_channel_id_closure = base::Bind(reply, "");
84 if (status != net::OK) { 84 if (status != net::OK) {
85 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure); 85 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure);
86 return; 86 return;
87 } 87 }
88 std::vector<uint8> spki_vector; 88 std::vector<uint8> spki_vector;
89 if (!output->channel_id_key->ExportPublicKey(&spki_vector)) { 89 if (!output->channel_id_key->ExportPublicKey(&spki_vector)) {
90 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure); 90 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure);
91 return; 91 return;
92 } 92 }
93 base::StringPiece spki(reinterpret_cast<char*>(vector_as_array(&spki_vector)), 93 base::StringPiece spki(reinterpret_cast<char*>(spki_vector.data()),
94 spki_vector.size()); 94 spki_vector.size());
95 base::DictionaryValue jwk_value; 95 base::DictionaryValue jwk_value;
96 if (!net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value)) { 96 if (!net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value)) {
97 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure); 97 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure);
98 return; 98 return;
99 } 99 }
100 std::string jwk_str; 100 std::string jwk_str;
101 base::JSONWriter::Write(jwk_value, &jwk_str); 101 base::JSONWriter::Write(jwk_value, &jwk_str);
102 original_task_runner->PostTask(FROM_HERE, base::Bind(reply, jwk_str)); 102 original_task_runner->PostTask(FROM_HERE, base::Bind(reply, jwk_str));
103 } 103 }
104 104
105 } // namespace extensions 105 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698