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

Unified Diff: components/offline_pages/offline_page_item.cc

Issue 1694863003: Refactor the offline page storage to include client namespace and id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address changes Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/offline_page_item.cc
diff --git a/components/offline_pages/offline_page_item.cc b/components/offline_pages/offline_page_item.cc
index 8ee8bc564ef65bd3ed36354adb3d429c10e59ebf..dc744dcf2e7c9ed2d979093b20a0101a8e4c7337 100644
--- a/components/offline_pages/offline_page_item.cc
+++ b/components/offline_pages/offline_page_item.cc
@@ -4,6 +4,7 @@
#include "components/offline_pages/offline_page_item.h"
+#include "components/offline_pages/proto/offline_pages.pb.h"
#include "net/base/filename_util.h"
namespace offline_pages {
@@ -12,6 +13,15 @@ namespace {
const int kCurrentVersion = 1;
}
+ClientId::ClientId() : name_space(""), id("") {}
+
+ClientId::ClientId(std::string name_space, std::string id)
+ : name_space(name_space), id(id) {}
+
+bool ClientId::operator==(const ClientId& client_id) const {
+ return name_space == client_id.name_space && id == client_id.id;
+}
+
OfflinePageItem::OfflinePageItem()
: version(kCurrentVersion),
file_size(0),
@@ -20,11 +30,13 @@ OfflinePageItem::OfflinePageItem()
}
OfflinePageItem::OfflinePageItem(const GURL& url,
- int64_t bookmark_id,
+ int64_t offline_id,
+ const ClientId& client_id,
const base::FilePath& file_path,
int64_t file_size)
: url(url),
- bookmark_id(bookmark_id),
+ offline_id(offline_id),
+ client_id(client_id),
version(kCurrentVersion),
file_path(file_path),
file_size(file_size),
@@ -32,12 +44,14 @@ OfflinePageItem::OfflinePageItem(const GURL& url,
flags(NO_FLAG) {}
OfflinePageItem::OfflinePageItem(const GURL& url,
- int64_t bookmark_id,
+ int64_t offline_id,
+ const ClientId& client_id,
const base::FilePath& file_path,
int64_t file_size,
const base::Time& creation_time)
: url(url),
- bookmark_id(bookmark_id),
+ offline_id(offline_id),
+ client_id(client_id),
version(kCurrentVersion),
file_path(file_path),
file_size(file_size),

Powered by Google App Engine
This is Rietveld 408576698