• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.base.shared_preferences;
6 
7 /**
8  * A SharedPreferences key checker that may check if the key is in use.
9  *
10  * In official builds, {@link NoOpPreferenceKeyChecker} is used, which is a no-op.
11  * In debug builds, {@link StrictPreferenceKeyChecker} is used, which checks if a key is registered.
12  */
13 interface PreferenceKeyChecker {
14     // Asserts that the SharedPreferences |key| is registered as "in use".
checkIsKeyInUse(String key)15     void checkIsKeyInUse(String key);
16 
17     // Asserts that the SharedPreferences KeyPrefix |prefix| is registered as "in use".
checkIsPrefixInUse(KeyPrefix prefix)18     void checkIsPrefixInUse(KeyPrefix prefix);
19 }
20