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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/ClientId.java

Issue 1739163005: Java side of purging BookmarkId from offline pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Java side of offline id changes Created 4 years, 9 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: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/ClientId.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/ClientId.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/ClientId.java
new file mode 100644
index 0000000000000000000000000000000000000000..dacfa4906b49b37829230ff0a5876535d3545161
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/ClientId.java
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.offlinepages;
+
+import org.chromium.components.bookmarks.BookmarkId;
+
+/**
+ * Object to hold a client identifier for an offline page.
+ */
+public class ClientId {
+ private String mNamespace;
+ private String mId;
+
+ public ClientId(String namespace, String id) {
+ mNamespace = namespace;
+ mId = id;
+ }
+
+ public String getNamespace() {
+ return mNamespace;
+ }
+
+ public String getId() {
+ return mId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof ClientId) {
+ ClientId otherId = (ClientId) o;
+ return otherId.getNamespace().equals(mNamespace) && otherId.getId().equals(mId);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return (mNamespace + ":" + mId).hashCode();
+ }
+
+ /**
+ * Create a client id for a bookmark
+ * @param id The bookmark id to wrap.
+ * @return A {@link ClientId} that represents this BookmarkId.
+ */
+ public static ClientId createClientIdForBookmarkId(BookmarkId id) {
+ return new ClientId(OfflinePageBridge.BOOKMARK_NAMESPACE, id.toString());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698