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/cryptauth/cryptauth_api_call_flow.h" | 5 #include "components/cryptauth/cryptauth_api_call_flow.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "components/proximity_auth/logging/logging.h" | 8 #include "components/proximity_auth/logging/logging.h" |
| 9 #include "net/traffic_annotation/network_traffic_annotation.h" |
9 #include "net/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
10 | 11 |
11 namespace cryptauth { | 12 namespace cryptauth { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 const char kResponseBodyError[] = "Failed to get response body"; | 16 const char kResponseBodyError[] = "Failed to get response body"; |
16 const char kRequestFailedError[] = "Request failed"; | 17 const char kRequestFailedError[] = "Request failed"; |
17 const char kHttpStatusErrorPrefix[] = "HTTP status: "; | 18 const char kHttpStatusErrorPrefix[] = "HTTP status: "; |
18 | 19 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } else { | 74 } else { |
74 error_message = kRequestFailedError; | 75 error_message = kRequestFailedError; |
75 } | 76 } |
76 | 77 |
77 std::string response; | 78 std::string response; |
78 source->GetResponseAsString(&response); | 79 source->GetResponseAsString(&response); |
79 PA_LOG(INFO) << "API call failed:\n" << response; | 80 PA_LOG(INFO) << "API call failed:\n" << response; |
80 error_callback_.Run(error_message); | 81 error_callback_.Run(error_message); |
81 } | 82 } |
82 | 83 |
| 84 net::PartialNetworkTrafficAnnotationTag |
| 85 CryptAuthApiCallFlow::GetNetworkTrafficAnnotationTag() { |
| 86 DCHECK(partial_network_annotation_ != nullptr); |
| 87 return *partial_network_annotation_.get(); |
| 88 } |
| 89 |
83 } // namespace cryptauth | 90 } // namespace cryptauth |
OLD | NEW |