| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/offline_pages/offline_page_request_job.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_request_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // consistent with network cache behavior. | 632 // consistent with network cache behavior. |
| 633 load_timing_info->send_start = receive_redirect_headers_end_; | 633 load_timing_info->send_start = receive_redirect_headers_end_; |
| 634 load_timing_info->send_end = receive_redirect_headers_end_; | 634 load_timing_info->send_end = receive_redirect_headers_end_; |
| 635 load_timing_info->receive_headers_end = receive_redirect_headers_end_; | 635 load_timing_info->receive_headers_end = receive_redirect_headers_end_; |
| 636 } | 636 } |
| 637 | 637 |
| 638 bool OfflinePageRequestJob::CopyFragmentOnRedirect(const GURL& location) const { | 638 bool OfflinePageRequestJob::CopyFragmentOnRedirect(const GURL& location) const { |
| 639 return false; | 639 return false; |
| 640 } | 640 } |
| 641 | 641 |
| 642 int OfflinePageRequestJob::GetResponseCode() const { | |
| 643 if (!fake_headers_for_redirect_) | |
| 644 return URLRequestFileJob::GetResponseCode(); | |
| 645 | |
| 646 return net::URLRequestRedirectJob::REDIRECT_302_FOUND; | |
| 647 } | |
| 648 | |
| 649 void OfflinePageRequestJob::OnOpenComplete(int result) { | 642 void OfflinePageRequestJob::OnOpenComplete(int result) { |
| 650 UMA_HISTOGRAM_SPARSE_SLOWLY("OfflinePages.RequestJob.OpenFileErrorCode", | 643 UMA_HISTOGRAM_SPARSE_SLOWLY("OfflinePages.RequestJob.OpenFileErrorCode", |
| 651 -result); | 644 -result); |
| 652 } | 645 } |
| 653 | 646 |
| 654 void OfflinePageRequestJob::OnSeekComplete(int64_t result) { | 647 void OfflinePageRequestJob::OnSeekComplete(int64_t result) { |
| 655 if (result < 0) { | 648 if (result < 0) { |
| 656 UMA_HISTOGRAM_SPARSE_SLOWLY("OfflinePages.RequestJob.SeekFileErrorCode", | 649 UMA_HISTOGRAM_SPARSE_SLOWLY("OfflinePages.RequestJob.SeekFileErrorCode", |
| 657 static_cast<int>(-result)); | 650 static_cast<int>(-result)); |
| 658 } | 651 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 | 704 |
| 712 URLRequestJob::NotifyHeadersComplete(); | 705 URLRequestJob::NotifyHeadersComplete(); |
| 713 } | 706 } |
| 714 | 707 |
| 715 void OfflinePageRequestJob::SetDelegateForTesting( | 708 void OfflinePageRequestJob::SetDelegateForTesting( |
| 716 std::unique_ptr<Delegate> delegate) { | 709 std::unique_ptr<Delegate> delegate) { |
| 717 delegate_ = std::move(delegate); | 710 delegate_ = std::move(delegate); |
| 718 } | 711 } |
| 719 | 712 |
| 720 } // namespace offline_pages | 713 } // namespace offline_pages |
| OLD | NEW |