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

Side by Side Diff: ios/chrome/browser/reading_list/url_downloader.cc

Issue 2745313004: Remove all ReadingList entries on managed account signout. (Closed)
Patch Set: feedback Created 3 years, 9 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
« no previous file with comments | « ios/chrome/browser/reading_list/url_downloader.h ('k') | ios/chrome/browser/signin/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ios/chrome/browser/reading_list/url_downloader.h" 5 #include "ios/chrome/browser/reading_list/url_downloader.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 fetcher_->GetResponseAsFilePath(false, &temporary_path); 212 fetcher_->GetResponseAsFilePath(false, &temporary_path);
213 213
214 task_tracker_.PostTaskAndReplyWithResult( 214 task_tracker_.PostTaskAndReplyWithResult(
215 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE).get(), 215 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE).get(),
216 FROM_HERE, base::Bind(&URLDownloader::SavePDFFile, base::Unretained(this), 216 FROM_HERE, base::Bind(&URLDownloader::SavePDFFile, base::Unretained(this),
217 temporary_path), 217 temporary_path),
218 base::Bind(&URLDownloader::DownloadCompletionHandler, 218 base::Bind(&URLDownloader::DownloadCompletionHandler,
219 base::Unretained(this), source->GetOriginalURL(), "", path)); 219 base::Unretained(this), source->GetOriginalURL(), "", path));
220 } 220 }
221 221
222 void URLDownloader::CancelTask() {
223 task_tracker_.TryCancelAll();
224 distiller_.reset();
225 }
226
222 void URLDownloader::FetchPDFFile() { 227 void URLDownloader::FetchPDFFile() {
223 const GURL& pdf_url = 228 const GURL& pdf_url =
224 distilled_url_.is_valid() ? distilled_url_ : original_url_; 229 distilled_url_.is_valid() ? distilled_url_ : original_url_;
225 fetcher_ = net::URLFetcher::Create(0, pdf_url, net::URLFetcher::GET, this); 230 fetcher_ = net::URLFetcher::Create(0, pdf_url, net::URLFetcher::GET, this);
226 fetcher_->SetRequestContext(url_request_context_getter_.get()); 231 fetcher_->SetRequestContext(url_request_context_getter_.get());
227 fetcher_->SetLoadFlags(net::LOAD_SKIP_CACHE_VALIDATION); 232 fetcher_->SetLoadFlags(net::LOAD_SKIP_CACHE_VALIDATION);
228 fetcher_->SaveResponseToTemporaryFile( 233 fetcher_->SaveResponseToTemporaryFile(
229 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE)); 234 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE));
230 fetcher_->Start(); 235 fetcher_->Start();
231 } 236 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 base::FilePath path = reading_list::OfflineURLAbsolutePathFromRelativePath( 377 base::FilePath path = reading_list::OfflineURLAbsolutePathFromRelativePath(
373 base_directory_, 378 base_directory_,
374 reading_list::OfflinePagePath(url, reading_list::OFFLINE_TYPE_HTML)); 379 reading_list::OfflinePagePath(url, reading_list::OFFLINE_TYPE_HTML));
375 int written = base::WriteFile(path, html.c_str(), html.length()); 380 int written = base::WriteFile(path, html.c_str(), html.length());
376 if (written <= 0) { 381 if (written <= 0) {
377 return false; 382 return false;
378 } 383 }
379 saved_size_ += written; 384 saved_size_ += written;
380 return true; 385 return true;
381 } 386 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/url_downloader.h ('k') | ios/chrome/browser/signin/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698