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

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

Issue 2822023002: [Offline pages]: Move logic for whether to consider the DocumentAvailableInMainFrame signal to the … (Closed)
Patch Set: some fix Created 3 years, 8 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/background_loader_offliner.h" 5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
10 #include "chrome/browser/android/offline_pages/offliner_helper.h" 10 #include "chrome/browser/android/offline_pages/offliner_helper.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 progress_callback_ = progress_callback; 163 progress_callback_ = progress_callback;
164 164
165 // Listen for app foreground/background change. 165 // Listen for app foreground/background change.
166 app_listener_.reset(new base::android::ApplicationStatusListener( 166 app_listener_.reset(new base::android::ApplicationStatusListener(
167 base::Bind(&BackgroundLoaderOffliner::OnApplicationStateChange, 167 base::Bind(&BackgroundLoaderOffliner::OnApplicationStateChange,
168 weak_ptr_factory_.GetWeakPtr()))); 168 weak_ptr_factory_.GetWeakPtr())));
169 169
170 // Load page attempt. 170 // Load page attempt.
171 loader_.get()->LoadPage(request.url()); 171 loader_.get()->LoadPage(request.url());
172 172
173 snapshot_controller_.reset( 173 snapshot_controller_.reset(new SnapshotController(
174 new SnapshotController(base::ThreadTaskRunnerHandle::Get(), this, 174 base::ThreadTaskRunnerHandle::Get(), this, kOfflineDomContentLoadedMs,
carlosk 2017/04/19 23:16:57 As the DOM content loaded delay is now ignored thi
fgorski 2017/04/20 16:39:05 Since this is the only place the constant is used,
chili 2017/04/21 00:12:54 Done.
175 kOfflineDomContentLoadedMs, page_delay_ms_)); 175 page_delay_ms_, false /* consider_document_available_for_snapshot */));
176 176
177 return true; 177 return true;
178 } 178 }
179 179
180 void BackgroundLoaderOffliner::Cancel(const CancelCallback& callback) { 180 void BackgroundLoaderOffliner::Cancel(const CancelCallback& callback) {
181 // TODO(chili): We are not able to cancel a pending 181 // TODO(chili): We are not able to cancel a pending
182 // OfflinePageModel::SaveSnapshot() operation. We will notify caller that 182 // OfflinePageModel::SaveSnapshot() operation. We will notify caller that
183 // cancel completed once the SavePage operation returns. 183 // cancel completed once the SavePage operation returns.
184 if (!pending_request_) { 184 if (!pending_request_) {
185 callback.Run(0LL); 185 callback.Run(0LL);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 int64_t offline_id) { 413 int64_t offline_id) {
414 // If for some reason the request was reset during while waiting for callback 414 // If for some reason the request was reset during while waiting for callback
415 // ignore the completion callback. 415 // ignore the completion callback.
416 if (pending_request_ && pending_request_->request_id() != offline_id) 416 if (pending_request_ && pending_request_->request_id() != offline_id)
417 return; 417 return;
418 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); 418 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED);
419 } 419 }
420 } // namespace offline_pages 420 } // namespace offline_pages
421 421
422 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); 422 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698