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 "components/update_client/request_sender.h" | 5 #include "components/update_client/request_sender.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "components/update_client/client_update_protocol_ecdsa.h" | 15 #include "components/client_update_protocol/ecdsa.h" |
16 #include "components/update_client/configurator.h" | 16 #include "components/update_client/configurator.h" |
17 #include "components/update_client/utils.h" | 17 #include "components/update_client/utils.h" |
18 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
19 #include "net/url_request/url_fetcher.h" | 19 #include "net/url_request/url_fetcher.h" |
20 | 20 |
21 namespace update_client { | 21 namespace update_client { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // This is an ECDSA prime256v1 named-curve key. | 25 // This is an ECDSA prime256v1 named-curve key. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 void RequestSender::SendInternal() { | 72 void RequestSender::SendInternal() { |
73 DCHECK(cur_url_ != urls_.end()); | 73 DCHECK(cur_url_ != urls_.end()); |
74 DCHECK(cur_url_->is_valid()); | 74 DCHECK(cur_url_->is_valid()); |
75 DCHECK(thread_checker_.CalledOnValidThread()); | 75 DCHECK(thread_checker_.CalledOnValidThread()); |
76 | 76 |
77 GURL url(*cur_url_); | 77 GURL url(*cur_url_); |
78 | 78 |
79 if (use_signing_) { | 79 if (use_signing_) { |
80 DCHECK(!public_key_.empty()); | 80 DCHECK(!public_key_.empty()); |
81 signer_ = ClientUpdateProtocolEcdsa::Create(kKeyVersion, public_key_); | 81 signer_ = client_update_protocol::Ecdsa::Create(kKeyVersion, public_key_); |
82 std::string request_query_string; | 82 std::string request_query_string; |
83 signer_->SignRequest(request_body_, &request_query_string); | 83 signer_->SignRequest(request_body_, &request_query_string); |
84 | 84 |
85 url = BuildUpdateUrl(url, request_query_string); | 85 url = BuildUpdateUrl(url, request_query_string); |
86 } | 86 } |
87 | 87 |
88 url_fetcher_ = | 88 url_fetcher_ = |
89 SendProtocolRequest(url, request_body_, this, config_->RequestContext()); | 89 SendProtocolRequest(url, request_body_, this, config_->RequestContext()); |
90 if (!url_fetcher_.get()) | 90 if (!url_fetcher_.get()) |
91 base::ThreadTaskRunnerHandle::Get()->PostTask( | 91 base::ThreadTaskRunnerHandle::Get()->PostTask( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (!response_headers) | 171 if (!response_headers) |
172 return std::string(); | 172 return std::string(); |
173 | 173 |
174 std::string etag; | 174 std::string etag; |
175 return response_headers->EnumerateHeader(nullptr, "ETag", &etag) | 175 return response_headers->EnumerateHeader(nullptr, "ETag", &etag) |
176 ? etag | 176 ? etag |
177 : std::string(); | 177 : std::string(); |
178 } | 178 } |
179 | 179 |
180 } // namespace update_client | 180 } // namespace update_client |
OLD | NEW |