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

Side by Side Diff: content/browser/devtools/protocol/network_handler.cc

Issue 2661583002: Check the existence of each properties of ResourceDevToolsInfo for NavigationPreload (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698