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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_utils.cc

Issue 1904613005: [Offline pages] Removing bookmarks dependency from offline pages component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests compilation Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/android/offline_pages/offline_page_utils.h" 5 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 10 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // static 98 // static
99 int64_t OfflinePageUtils::GetBookmarkIdForOfflineURL( 99 int64_t OfflinePageUtils::GetBookmarkIdForOfflineURL(
100 content::BrowserContext* browser_context, 100 content::BrowserContext* browser_context,
101 const GURL& offline_url) { 101 const GURL& offline_url) {
102 const offline_pages::OfflinePageItem* offline_page = 102 const offline_pages::OfflinePageItem* offline_page =
103 GetOfflinePageForOfflineURL(browser_context, offline_url); 103 GetOfflinePageForOfflineURL(browser_context, offline_url);
104 if (!offline_page) 104 if (!offline_page)
105 return -1; 105 return -1;
106 106
107 if (offline_page->client_id.name_space != offline_pages::BOOKMARK_NAMESPACE) { 107 if (offline_page->client_id.name_space != offline_pages::kBookmarkNamespace) {
108 return -1; 108 return -1;
109 } 109 }
110 110
111 int64_t result; 111 int64_t result;
112 if (base::StringToInt64(offline_page->client_id.id, &result)) { 112 if (base::StringToInt64(offline_page->client_id.id, &result)) {
113 return result; 113 return result;
114 } 114 }
115 return -1; 115 return -1;
116 } 116 }
117 117
118 // static 118 // static
119 bool OfflinePageUtils::IsOfflinePage(content::BrowserContext* browser_context, 119 bool OfflinePageUtils::IsOfflinePage(content::BrowserContext* browser_context,
120 const GURL& offline_url) { 120 const GURL& offline_url) {
121 return GetOfflinePageForOfflineURL(browser_context, offline_url) != nullptr; 121 return GetOfflinePageForOfflineURL(browser_context, offline_url) != nullptr;
122 } 122 }
123 123
124 // static 124 // static
125 bool OfflinePageUtils::HasOfflinePageForOnlineURL( 125 bool OfflinePageUtils::HasOfflinePageForOnlineURL(
126 content::BrowserContext* browser_context, 126 content::BrowserContext* browser_context,
127 const GURL& online_url) { 127 const GURL& online_url) {
128 const offline_pages::OfflinePageItem* offline_page = 128 const offline_pages::OfflinePageItem* offline_page =
129 GetOfflinePageForOnlineURL(browser_context, online_url); 129 GetOfflinePageForOnlineURL(browser_context, online_url);
130 return offline_page && !offline_page->file_path.empty(); 130 return offline_page && !offline_page->file_path.empty();
131 } 131 }
132 132
133 } // namespace offline_pages 133 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698