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

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

Issue 2754803003: Reading List iOS: Handle multiple pages. (Closed)
Patch Set: rebase 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/reading_list_distiller_page_factory.mm ('k') | no next file » | 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 DownloadCompletionHandler(url, std::string(), base::FilePath(), 166 DownloadCompletionHandler(url, std::string(), base::FilePath(),
167 DOWNLOAD_EXISTS); 167 DOWNLOAD_EXISTS);
168 return; 168 return;
169 } 169 }
170 170
171 original_url_ = url; 171 original_url_ = url;
172 distilled_url_ = url; 172 distilled_url_ = url;
173 saved_size_ = 0; 173 saved_size_ = 0;
174 std::unique_ptr<reading_list::ReadingListDistillerPage> 174 std::unique_ptr<reading_list::ReadingListDistillerPage>
175 reading_list_distiller_page = 175 reading_list_distiller_page =
176 distiller_page_factory_->CreateReadingListDistillerPage(this); 176 distiller_page_factory_->CreateReadingListDistillerPage(url, this);
177 177
178 distiller_.reset(new dom_distiller::DistillerViewer( 178 distiller_.reset(new dom_distiller::DistillerViewer(
179 distiller_factory_, std::move(reading_list_distiller_page), pref_service_, 179 distiller_factory_, std::move(reading_list_distiller_page), pref_service_,
180 url, 180 url,
181 base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this)))); 181 base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this))));
182 } 182 }
183 183
184 void URLDownloader::DistilledPageRedirectedToURL(const GURL& page_url, 184 void URLDownloader::DistilledPageRedirectedToURL(const GURL& page_url,
185 const GURL& redirected_url) { 185 const GURL& redirected_url) {
186 DCHECK(original_url_ == page_url); 186 DCHECK(original_url_ == page_url);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 base::FilePath path = reading_list::OfflineURLAbsolutePathFromRelativePath( 377 base::FilePath path = reading_list::OfflineURLAbsolutePathFromRelativePath(
378 base_directory_, 378 base_directory_,
379 reading_list::OfflinePagePath(url, reading_list::OFFLINE_TYPE_HTML)); 379 reading_list::OfflinePagePath(url, reading_list::OFFLINE_TYPE_HTML));
380 int written = base::WriteFile(path, html.c_str(), html.length()); 380 int written = base::WriteFile(path, html.c_str(), html.length());
381 if (written <= 0) { 381 if (written <= 0) {
382 return false; 382 return false;
383 } 383 }
384 saved_size_ += written; 384 saved_size_ += written;
385 return true; 385 return true;
386 } 386 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_distiller_page_factory.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698