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_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/android/offline_pages/offline_page_request_job.h" | 10 #include "chrome/browser/android/offline_pages/offline_page_request_job.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 OfflinePageRequestJob::AggregatedRequestResult:: | 106 OfflinePageRequestJob::AggregatedRequestResult:: |
107 PAGE_NOT_FOUND_ON_FLAKY_NETWORK); | 107 PAGE_NOT_FOUND_ON_FLAKY_NETWORK); |
108 return; | 108 return; |
109 } | 109 } |
110 | 110 |
111 reloading_url_on_net_error_ = true; | 111 reloading_url_on_net_error_ = true; |
112 | 112 |
113 // Reloads the page with extra header set to force loading the offline page. | 113 // Reloads the page with extra header set to force loading the offline page. |
114 content::NavigationController::LoadURLParams load_params(offline_page->url); | 114 content::NavigationController::LoadURLParams load_params(offline_page->url); |
115 load_params.transition_type = ui::PAGE_TRANSITION_RELOAD; | 115 load_params.transition_type = ui::PAGE_TRANSITION_RELOAD; |
116 load_params.extra_headers = kLoadingOfflinePageHeader; | 116 load_params.extra_headers = kOfflinePageHeader; |
117 load_params.extra_headers += ":"; | 117 load_params.extra_headers += ":"; |
118 load_params.extra_headers += kLoadingOfflinePageReason; | 118 load_params.extra_headers += kOfflinePageHeaderReasonKey; |
119 load_params.extra_headers += kLoadingOfflinePageDueToNetError; | 119 load_params.extra_headers += "="; |
| 120 load_params.extra_headers += kOfflinePageHeaderReasonValueDueToNetError; |
120 web_contents()->GetController().LoadURLWithParams(load_params); | 121 web_contents()->GetController().LoadURLWithParams(load_params); |
121 } | 122 } |
122 | 123 |
123 void OfflinePageTabHelper::SetOfflinePage(const OfflinePageItem& offline_page, | 124 void OfflinePageTabHelper::SetOfflinePage(const OfflinePageItem& offline_page, |
124 bool is_offline_preview) { | 125 bool is_offline_preview) { |
125 offline_page_ = base::MakeUnique<OfflinePageItem>(offline_page); | 126 offline_page_ = base::MakeUnique<OfflinePageItem>(offline_page); |
126 is_offline_preview_ = is_offline_preview; | 127 is_offline_preview_ = is_offline_preview; |
127 } | 128 } |
128 | 129 |
129 } // namespace offline_pages | 130 } // namespace offline_pages |
OLD | NEW |