OLD | NEW |
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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 base::ThreadTaskRunnerHandle::Get(), | 42 base::ThreadTaskRunnerHandle::Get(), |
43 request_context_getter, | 43 request_context_getter, |
44 source_url.host(), | 44 source_url.host(), |
45 reply)); | 45 reply)); |
46 } | 46 } |
47 | 47 |
48 // Helper struct to bind the memory addresses that will be written to by | 48 // Helper struct to bind the memory addresses that will be written to by |
49 // ChannelIDService::GetChannelID to the callback provided to | 49 // ChannelIDService::GetChannelID to the callback provided to |
50 // MessagePropertyProvider::GetChannelID. | 50 // MessagePropertyProvider::GetChannelID. |
51 struct MessagePropertyProvider::GetChannelIDOutput { | 51 struct MessagePropertyProvider::GetChannelIDOutput { |
52 scoped_ptr<crypto::ECPrivateKey> channel_id_key; | 52 std::unique_ptr<crypto::ECPrivateKey> channel_id_key; |
53 net::ChannelIDService::Request request; | 53 net::ChannelIDService::Request request; |
54 }; | 54 }; |
55 | 55 |
56 // static | 56 // static |
57 void MessagePropertyProvider::GetChannelIDOnIOThread( | 57 void MessagePropertyProvider::GetChannelIDOnIOThread( |
58 scoped_refptr<base::TaskRunner> original_task_runner, | 58 scoped_refptr<base::TaskRunner> original_task_runner, |
59 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 59 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
60 const std::string& host, | 60 const std::string& host, |
61 const ChannelIDCallback& reply) { | 61 const ChannelIDCallback& reply) { |
62 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 62 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (!net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value)) { | 98 if (!net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value)) { |
99 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure); | 99 original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure); |
100 return; | 100 return; |
101 } | 101 } |
102 std::string jwk_str; | 102 std::string jwk_str; |
103 base::JSONWriter::Write(jwk_value, &jwk_str); | 103 base::JSONWriter::Write(jwk_value, &jwk_str); |
104 original_task_runner->PostTask(FROM_HERE, base::Bind(reply, jwk_str)); | 104 original_task_runner->PostTask(FROM_HERE, base::Bind(reply, jwk_str)); |
105 } | 105 } |
106 | 106 |
107 } // namespace extensions | 107 } // namespace extensions |
OLD | NEW |