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

Side by Side Diff: components/offline_pages/offline_page_metadata_store_impl.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 "components/offline_pages/offline_page_metadata_store_impl.h" 5 #include "components/offline_pages/offline_page_metadata_store_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Legacy storage. We upgrade them to the new offline_id keyed storage. 167 // Legacy storage. We upgrade them to the new offline_id keyed storage.
168 // TODO(bburns): Remove this eventually when we are sure everyone is 168 // TODO(bburns): Remove this eventually when we are sure everyone is
169 // upgraded. 169 // upgraded.
170 if (!entry.has_offline_id()) { 170 if (!entry.has_offline_id()) {
171 item.offline_id = OfflinePageModel::GenerateOfflineId(); 171 item.offline_id = OfflinePageModel::GenerateOfflineId();
172 172
173 if (!entry.has_deprecated_bookmark_id()) { 173 if (!entry.has_deprecated_bookmark_id()) {
174 LOG(ERROR) << "unexpected entry missing bookmark id"; 174 LOG(ERROR) << "unexpected entry missing bookmark id";
175 continue; 175 continue;
176 } 176 }
177 item.client_id.name_space = offline_pages::BOOKMARK_NAMESPACE; 177 item.client_id.name_space = offline_pages::kBookmarkNamespace;
178 item.client_id.id = base::Int64ToString(entry.deprecated_bookmark_id()); 178 item.client_id.id = base::Int64ToString(entry.deprecated_bookmark_id());
179 179
180 OfflinePageEntry upgraded_entry; 180 OfflinePageEntry upgraded_entry;
181 OfflinePageItemToEntry(item, &upgraded_entry); 181 OfflinePageItemToEntry(item, &upgraded_entry);
182 entries_to_update->push_back( 182 entries_to_update->push_back(
183 std::make_pair(base::Int64ToString(upgraded_entry.offline_id()), 183 std::make_pair(base::Int64ToString(upgraded_entry.offline_id()),
184 upgraded_entry)); 184 upgraded_entry));
185 // Remove the old entry that is indexed with deprecated id. 185 // Remove the old entry that is indexed with deprecated id.
186 keys_to_remove->push_back(item.client_id.id); 186 keys_to_remove->push_back(item.client_id.id);
187 } 187 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bool success) { 309 bool success) {
310 // If the update failed, log and keep going. We'll try to 310 // If the update failed, log and keep going. We'll try to
311 // update next time. 311 // update next time.
312 if (!success) { 312 if (!success) {
313 LOG(ERROR) << "Failed to update database"; 313 LOG(ERROR) << "Failed to update database";
314 } 314 }
315 NotifyLoadResult(cb, status, result); 315 NotifyLoadResult(cb, status, result);
316 } 316 }
317 317
318 } // namespace offline_pages 318 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698