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

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

Issue 2511723002: Enable RL sync by default on iOS (Closed)
Patch Set: rebase Created 4 years 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 "ios/chrome/browser/reading_list/offline_url_utils.h" 5 #include "ios/chrome/browser/reading_list/offline_url_utils.h"
6 6
7 #include "base/md5.h" 7 #include "base/md5.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "components/reading_list/offline_url_utils.h" 9 #include "components/reading_list/ios/offline_url_utils.h"
10 #include "ios/chrome/browser/chrome_url_constants.h" 10 #include "ios/chrome/browser/chrome_url_constants.h"
11 11
12 namespace reading_list { 12 namespace reading_list {
13 13
14 GURL DistilledURLForPath(const base::FilePath& distilled_path) { 14 GURL DistilledURLForPath(const base::FilePath& distilled_path) {
15 if (distilled_path.empty()) { 15 if (distilled_path.empty()) {
16 return GURL(); 16 return GURL();
17 } 17 }
18 return GURL(kChromeUIOfflineURL + distilled_path.value()); 18 return GURL(kChromeUIOfflineURL + distilled_path.value());
19 } 19 }
20 20
21 GURL FileURLForDistilledURL(const GURL& distilled_url, 21 GURL FileURLForDistilledURL(const GURL& distilled_url,
22 const base::FilePath& profile_path, 22 const base::FilePath& profile_path,
23 GURL* resources_root_url) { 23 GURL* resources_root_url) {
24 if (!distilled_url.is_valid()) { 24 if (!distilled_url.is_valid()) {
25 return GURL(); 25 return GURL();
26 } 26 }
27 DCHECK(distilled_url.SchemeIs(kChromeUIScheme)); 27 DCHECK(distilled_url.SchemeIs(kChromeUIScheme));
28 base::FilePath offline_path = OfflineRootDirectoryPath(profile_path); 28 base::FilePath offline_path = OfflineRootDirectoryPath(profile_path);
29 29
30 GURL file_url(base::StringPrintf("%s%s", url::kFileScheme, 30 GURL file_url(base::StringPrintf("%s%s", url::kFileScheme,
31 url::kStandardSchemeSeparator) + 31 url::kStandardSchemeSeparator) +
32 offline_path.value() + distilled_url.path()); 32 offline_path.value() + distilled_url.path());
33 if (resources_root_url) { 33 if (resources_root_url) {
34 *resources_root_url = file_url.Resolve("."); 34 *resources_root_url = file_url.Resolve(".");
35 } 35 }
36 return file_url; 36 return file_url;
37 } 37 }
38 } 38 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/BUILD.gn ('k') | ios/chrome/browser/reading_list/reading_list_download_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698