| 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 Page::ResourceTypeEnum::Other, std::move(response)); | 689 Page::ResourceTypeEnum::Other, std::move(response)); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void NetworkHandler::NavigationPreloadCompleted( | 692 void NetworkHandler::NavigationPreloadCompleted( |
| 693 const std::string& request_id, | 693 const std::string& request_id, |
| 694 const ResourceRequestCompletionStatus& completion_status) { | 694 const ResourceRequestCompletionStatus& completion_status) { |
| 695 if (!enabled_) | 695 if (!enabled_) |
| 696 return; | 696 return; |
| 697 if (completion_status.error_code != net::OK) { | 697 if (completion_status.error_code != net::OK) { |
| 698 frontend_->LoadingFailed( | 698 frontend_->LoadingFailed( |
| 699 request_id, base::TimeTicks::Now().ToInternalValue() / | 699 request_id, |
| 700 static_cast<double>(base::Time::kMicrosecondsPerSecond), | 700 base::TimeTicks::Now().ToInternalValue() / |
| 701 Page::ResourceTypeEnum::Other, "Navigation Preload Error", | 701 static_cast<double>(base::Time::kMicrosecondsPerSecond), |
| 702 Page::ResourceTypeEnum::Other, |
| 703 net::ErrorToString(completion_status.error_code), |
| 702 completion_status.error_code == net::Error::ERR_ABORTED); | 704 completion_status.error_code == net::Error::ERR_ABORTED); |
| 703 } | 705 } |
| 704 frontend_->LoadingFinished( | 706 frontend_->LoadingFinished( |
| 705 request_id, base::TimeTicks::Now().ToInternalValue() / | 707 request_id, base::TimeTicks::Now().ToInternalValue() / |
| 706 static_cast<double>(base::Time::kMicrosecondsPerSecond), | 708 static_cast<double>(base::Time::kMicrosecondsPerSecond), |
| 707 completion_status.encoded_data_length); | 709 completion_status.encoded_data_length); |
| 708 } | 710 } |
| 709 | 711 |
| 710 void NetworkHandler::NavigationFailed( | 712 void NetworkHandler::NavigationFailed( |
| 711 const CommonNavigationParams& common_params, | 713 const CommonNavigationParams& common_params, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 static_cast<double>(base::Time::kMicrosecondsPerSecond), | 755 static_cast<double>(base::Time::kMicrosecondsPerSecond), |
| 754 Page::ResourceTypeEnum::Document, error_string, cancelled); | 756 Page::ResourceTypeEnum::Document, error_string, cancelled); |
| 755 } | 757 } |
| 756 | 758 |
| 757 std::string NetworkHandler::UserAgentOverride() const { | 759 std::string NetworkHandler::UserAgentOverride() const { |
| 758 return enabled_ ? user_agent_ : std::string(); | 760 return enabled_ ? user_agent_ : std::string(); |
| 759 } | 761 } |
| 760 | 762 |
| 761 } // namespace protocol | 763 } // namespace protocol |
| 762 } // namespace content | 764 } // namespace content |
| OLD | NEW |