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

Unified Diff: sync/android/java/src/org/chromium/sync/notifier/RandomizedInvalidationClientNameGenerator.java

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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: sync/android/java/src/org/chromium/sync/notifier/RandomizedInvalidationClientNameGenerator.java
diff --git a/sync/android/java/src/org/chromium/sync/notifier/RandomizedInvalidationClientNameGenerator.java b/sync/android/java/src/org/chromium/sync/notifier/RandomizedInvalidationClientNameGenerator.java
deleted file mode 100644
index 0c26f6fd838b0b15dc0b2dcd3d3f70bda97e4064..0000000000000000000000000000000000000000
--- a/sync/android/java/src/org/chromium/sync/notifier/RandomizedInvalidationClientNameGenerator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2013 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.sync.notifier;
-
-import android.util.Base64;
-
-import org.chromium.base.annotations.MainDex;
-
-import java.util.Random;
-
-/**
- * Generates a fully random client ID.
- *
- * This ID will not persist across restarts. Using this ID will break the invalidator's "reflection
- * blocking" feature. That's unfortunate, but better than using a hard-coded ID. A hard-coded ID
- * could prevent invalidations from being delivered.
- */
-@MainDex
-class RandomizedInvalidationClientNameGenerator implements InvalidationClientNameGenerator {
- private static final Random RANDOM = new Random();
-
- RandomizedInvalidationClientNameGenerator() {}
-
- /**
- * Generates a random ID prefixed with the string "BadID".
- *
- * The prefix is intended to grab attention. We should never use it in real builds. Hopefully,
- * it will induce someone to file a bug if they see it.
- *
- * However, as bad as it is, this ID is better than a hard-coded default or none at all. See
- * the class description for more details.
- */
- public byte[] generateInvalidatorClientName() {
- byte[] randomBytes = new byte[8];
- RANDOM.nextBytes(randomBytes);
- String encoded = Base64.encodeToString(randomBytes, 0, randomBytes.length, Base64.NO_WRAP);
- String idString = "BadID" + encoded;
- return idString.getBytes();
- }
-}

Powered by Google App Engine
This is Rietveld 408576698