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

Unified Diff: ios/chrome/browser/reading_list/offline_url_utils.cc

Issue 2514333003: Componentize Reading List (Closed)
Patch Set: fix Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/reading_list/offline_url_utils.cc
diff --git a/ios/chrome/browser/reading_list/offline_url_utils.cc b/ios/chrome/browser/reading_list/offline_url_utils.cc
index cc7d044c493471a1f3a008333b9648f87249bac1..aac2f918941ffdf589389bacaba097c2abe2dccd 100644
--- a/ios/chrome/browser/reading_list/offline_url_utils.cc
+++ b/ios/chrome/browser/reading_list/offline_url_utils.cc
@@ -6,40 +6,11 @@
#include "base/md5.h"
#include "base/strings/stringprintf.h"
+#include "components/reading_list/offline_url_utils.h"
#include "ios/chrome/browser/chrome_url_constants.h"
-namespace {
-const char kOfflineDirectory[] = "Offline";
-const char kMainPageFileName[] = "page.html";
-} // namespace
-
namespace reading_list {
-base::FilePath OfflineRootDirectoryPath(const base::FilePath& profile_path) {
- return profile_path.Append(FILE_PATH_LITERAL(kOfflineDirectory));
-}
-
-std::string OfflineURLDirectoryID(const GURL& url) {
- return base::MD5String(url.spec());
-}
-
-base::FilePath OfflinePagePath(const GURL& url) {
- base::FilePath directory(OfflineURLDirectoryID(url));
- return directory.Append(FILE_PATH_LITERAL(kMainPageFileName));
-}
-
-base::FilePath OfflineURLDirectoryAbsolutePath(
- const base::FilePath& profile_path,
- const GURL& url) {
- return OfflineRootDirectoryPath(profile_path)
- .Append(OfflineURLDirectoryID(url));
-}
-
-base::FilePath OfflinePageAbsolutePath(const base::FilePath& profile_path,
- const GURL& url) {
- return OfflineRootDirectoryPath(profile_path).Append(OfflinePagePath(url));
-}
-
GURL DistilledURLForPath(const base::FilePath& distilled_path) {
if (distilled_path.empty()) {
return GURL();
@@ -54,7 +25,7 @@ GURL FileURLForDistilledURL(const GURL& distilled_url,
return GURL();
}
DCHECK(distilled_url.SchemeIs(kChromeUIScheme));
- base::FilePath offline_path = profile_path.AppendASCII(kOfflineDirectory);
+ base::FilePath offline_path = OfflineRootDirectoryPath(profile_path);
GURL file_url(base::StringPrintf("%s%s", url::kFileScheme,
url::kStandardSchemeSeparator) +

Powered by Google App Engine
This is Rietveld 408576698