| OLD | NEW |
| 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" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "components/reading_list/offline_url_utils.h" | 14 #include "components/reading_list/ios/offline_url_utils.h" |
| 15 #include "ios/chrome/browser/chrome_paths.h" | 15 #include "ios/chrome/browser/chrome_paths.h" |
| 16 #include "ios/chrome/browser/dom_distiller/distiller_viewer.h" | 16 #include "ios/chrome/browser/dom_distiller/distiller_viewer.h" |
| 17 #include "ios/web/public/web_thread.h" | 17 #include "ios/web/public/web_thread.h" |
| 18 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 // URLDownloader | 21 // URLDownloader |
| 22 | 22 |
| 23 URLDownloader::URLDownloader( | 23 URLDownloader::URLDownloader( |
| 24 dom_distiller::DomDistillerService* distiller_service, | 24 dom_distiller::DomDistillerService* distiller_service, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool URLDownloader::SaveHTMLForURL(std::string html, const GURL& url) { | 226 bool URLDownloader::SaveHTMLForURL(std::string html, const GURL& url) { |
| 227 if (html.empty()) { | 227 if (html.empty()) { |
| 228 return false; | 228 return false; |
| 229 } | 229 } |
| 230 base::FilePath path = | 230 base::FilePath path = |
| 231 reading_list::OfflinePageAbsolutePath(base_directory_, url); | 231 reading_list::OfflinePageAbsolutePath(base_directory_, url); |
| 232 return base::WriteFile(path, html.c_str(), html.length()) > 0; | 232 return base::WriteFile(path, html.c_str(), html.length()) > 0; |
| 233 } | 233 } |
| OLD | NEW |