| 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 "content/browser/devtools/protocol/network_handler.h" | 5 #include "content/browser/devtools/protocol/network_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 .SetConnectionReused(head.load_timing.socket_reused) | 624 .SetConnectionReused(head.load_timing.socket_reused) |
| 625 .SetConnectionId(head.load_timing.socket_log_id) | 625 .SetConnectionId(head.load_timing.socket_log_id) |
| 626 .SetSecurityState(securityState(url, head.cert_status)) | 626 .SetSecurityState(securityState(url, head.cert_status)) |
| 627 .SetEncodedDataLength(head.encoded_data_length) | 627 .SetEncodedDataLength(head.encoded_data_length) |
| 628 .SetTiming(getTiming(head.load_timing)) | 628 .SetTiming(getTiming(head.load_timing)) |
| 629 .SetFromDiskCache(!head.load_timing.request_start_time.is_null() && | 629 .SetFromDiskCache(!head.load_timing.request_start_time.is_null() && |
| 630 head.response_time < | 630 head.response_time < |
| 631 head.load_timing.request_start_time) | 631 head.load_timing.request_start_time) |
| 632 .Build()); | 632 .Build()); |
| 633 if (head.devtools_info) { | 633 if (head.devtools_info) { |
| 634 response->SetStatus(head.devtools_info->http_status_code); | 634 if (head.devtools_info->http_status_code) { |
| 635 response->SetStatusText(head.devtools_info->http_status_text); | 635 response->SetStatus(head.devtools_info->http_status_code); |
| 636 response->SetRequestHeaders( | 636 response->SetStatusText(head.devtools_info->http_status_text); |
| 637 getHeaders(head.devtools_info->request_headers)); | 637 } |
| 638 response->SetHeaders(getHeaders(head.devtools_info->response_headers)); | 638 if (head.devtools_info->request_headers.size()) { |
| 639 response->SetHeadersText(head.devtools_info->response_headers_text); | 639 response->SetRequestHeaders( |
| 640 getHeaders(head.devtools_info->request_headers)); |
| 641 } |
| 642 if (!head.devtools_info->request_headers_text.empty()) { |
| 643 response->SetRequestHeadersText( |
| 644 head.devtools_info->request_headers_text); |
| 645 } |
| 646 if (head.devtools_info->response_headers.size()) |
| 647 response->SetHeaders(getHeaders(head.devtools_info->response_headers)); |
| 648 if (!head.devtools_info->response_headers_text.empty()) |
| 649 response->SetHeadersText(head.devtools_info->response_headers_text); |
| 640 } | 650 } |
| 641 response->SetProtocol(getProtocol(url, head)); | 651 response->SetProtocol(getProtocol(url, head)); |
| 642 response->SetRemoteIPAddress(head.socket_address.HostForURL()); | 652 response->SetRemoteIPAddress(head.socket_address.HostForURL()); |
| 643 response->SetRemotePort(head.socket_address.port()); | 653 response->SetRemotePort(head.socket_address.port()); |
| 644 frontend_->ResponseReceived( | 654 frontend_->ResponseReceived( |
| 645 request_id, version_id /* frameId */, version_id /* loaderId */, | 655 request_id, version_id /* frameId */, version_id /* loaderId */, |
| 646 base::TimeTicks::Now().ToInternalValue() / | 656 base::TimeTicks::Now().ToInternalValue() / |
| 647 static_cast<double>(base::Time::kMicrosecondsPerSecond), | 657 static_cast<double>(base::Time::kMicrosecondsPerSecond), |
| 648 Page::ResourceTypeEnum::Other, std::move(response)); | 658 Page::ResourceTypeEnum::Other, std::move(response)); |
| 649 } | 659 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 665 static_cast<double>(base::Time::kMicrosecondsPerSecond), | 675 static_cast<double>(base::Time::kMicrosecondsPerSecond), |
| 666 completion_status.encoded_data_length); | 676 completion_status.encoded_data_length); |
| 667 } | 677 } |
| 668 | 678 |
| 669 std::string NetworkHandler::UserAgentOverride() const { | 679 std::string NetworkHandler::UserAgentOverride() const { |
| 670 return enabled_ ? user_agent_ : std::string(); | 680 return enabled_ ? user_agent_ : std::string(); |
| 671 } | 681 } |
| 672 | 682 |
| 673 } // namespace protocol | 683 } // namespace protocol |
| 674 } // namespace content | 684 } // namespace content |
| OLD | NEW |