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

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

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: Created 3 years, 10 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 content::WebContentsObserver::web_contents()); 133 content::WebContentsObserver::web_contents());
134 134
135 std::unique_ptr<OfflinePageArchiver> archiver( 135 std::unique_ptr<OfflinePageArchiver> archiver(
136 new OfflinePageMHTMLArchiver(web_contents)); 136 new OfflinePageMHTMLArchiver(web_contents));
137 137
138 OfflinePageModel::SavePageParams params; 138 OfflinePageModel::SavePageParams params;
139 params.url = web_contents->GetLastCommittedURL(); 139 params.url = web_contents->GetLastCommittedURL();
140 params.client_id = request.client_id(); 140 params.client_id = request.client_id();
141 params.proposed_offline_id = request.request_id(); 141 params.proposed_offline_id = request.request_id();
142 params.is_background = true; 142 params.is_background = true;
143 std::vector<std::string> signal_data;
143 offline_page_model_->SavePage( 144 offline_page_model_->SavePage(
144 params, std::move(archiver), 145 params, std::move(archiver), signal_data,
145 base::Bind(&BackgroundLoaderOffliner::OnPageSaved, 146 base::Bind(&BackgroundLoaderOffliner::OnPageSaved,
146 weak_ptr_factory_.GetWeakPtr())); 147 weak_ptr_factory_.GetWeakPtr()));
147 } 148 }
148 149
149 void BackgroundLoaderOffliner::RenderProcessGone( 150 void BackgroundLoaderOffliner::RenderProcessGone(
150 base::TerminationStatus status) { 151 base::TerminationStatus status) {
151 if (pending_request_) { 152 if (pending_request_) {
152 SavePageRequest request(*pending_request_.get()); 153 SavePageRequest request(*pending_request_.get());
153 switch (status) { 154 switch (status) {
154 case base::TERMINATION_STATUS_OOM: 155 case base::TERMINATION_STATUS_OOM:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 application_state == 218 application_state ==
218 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { 219 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) {
219 DVLOG(1) << "App became active, canceling current offlining request"; 220 DVLOG(1) << "App became active, canceling current offlining request";
220 SavePageRequest* request = pending_request_.get(); 221 SavePageRequest* request = pending_request_.get();
221 Cancel(); 222 Cancel();
222 completion_callback_.Run(*request, RequestStatus::FOREGROUND_CANCELED); 223 completion_callback_.Run(*request, RequestStatus::FOREGROUND_CANCELED);
223 } 224 }
224 } 225 }
225 226
226 } // namespace offline_pages 227 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698