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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_offliner.cc

Issue 2608553002: [OfflinePages] Improve visiblity/handling of "Loading not started" case (Closed)
Patch Set: Addes ! low-end device default to test Setup Created 3 years, 11 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
OLDNEW
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/prerendering_offliner.h" 5 #include "chrome/browser/android/offline_pages/prerendering_offliner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 10 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 bool PrerenderingOffliner::LoadAndSave(const SavePageRequest& request, 142 bool PrerenderingOffliner::LoadAndSave(const SavePageRequest& request,
143 const CompletionCallback& callback) { 143 const CompletionCallback& callback) {
144 DCHECK(!pending_request_.get()); 144 DCHECK(!pending_request_.get());
145 145
146 if (pending_request_) { 146 if (pending_request_) {
147 DVLOG(1) << "Already have pending request"; 147 DVLOG(1) << "Already have pending request";
148 return false; 148 return false;
149 } 149 }
150 150
151 if (!GetOrCreateLoader()->CanPrerender()) {
152 DVLOG(1) << "Prerendering not allowed/configured";
153 return false;
154 }
155
156 // Do not allow loading for custom tabs clients if 3rd party cookies blocked. 151 // Do not allow loading for custom tabs clients if 3rd party cookies blocked.
157 // TODO(dewittj): Revise api to specify policy rather than hard code to 152 // TODO(dewittj): Revise api to specify policy rather than hard code to
158 // name_space. 153 // name_space.
159 if (request.client_id().name_space == kCCTNamespace && 154 if (request.client_id().name_space == kCCTNamespace &&
160 (AreThirdPartyCookiesBlocked(browser_context_) || 155 (AreThirdPartyCookiesBlocked(browser_context_) ||
161 IsNetworkPredictionDisabled(browser_context_))) { 156 IsNetworkPredictionDisabled(browser_context_))) {
162 DVLOG(1) << "WARNING: Unable to load when 3rd party cookies blocked or " 157 DVLOG(1) << "WARNING: Unable to load when 3rd party cookies blocked or "
163 << "prediction disabled"; 158 << "prediction disabled";
164 // Record user metrics for third party cookies being disabled or network 159 // Record user metrics for third party cookies being disabled or network
165 // prediction being disabled. 160 // prediction being disabled.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { 263 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) {
269 DVLOG(1) << "App became active, canceling current offlining request"; 264 DVLOG(1) << "App became active, canceling current offlining request";
270 SavePageRequest* request = pending_request_.get(); 265 SavePageRequest* request = pending_request_.get();
271 Cancel(); 266 Cancel();
272 completion_callback_.Run(*request, 267 completion_callback_.Run(*request,
273 Offliner::RequestStatus::FOREGROUND_CANCELED); 268 Offliner::RequestStatus::FOREGROUND_CANCELED);
274 } 269 }
275 } 270 }
276 271
277 } // namespace offline_pages 272 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698