OLD | NEW |
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 package org.chromium.chrome.browser.preferences; | 5 package org.chromium.chrome.browser.preferences; |
6 | 6 |
7 import android.content.SharedPreferences; | 7 import android.content.SharedPreferences; |
8 | 8 |
9 import org.chromium.base.ContextUtils; | 9 import org.chromium.base.ContextUtils; |
10 import org.chromium.base.annotations.SuppressFBWarnings; | 10 import org.chromium.base.annotations.SuppressFBWarnings; |
(...skipping 27 matching lines...) Expand all Loading... |
38 "contextual_search_peek_promo_show_count"; | 38 "contextual_search_peek_promo_show_count"; |
39 private static final String CONTEXTUAL_SEARCH_LAST_ANIMATION_TIME = | 39 private static final String CONTEXTUAL_SEARCH_LAST_ANIMATION_TIME = |
40 "contextual_search_last_animation_time"; | 40 "contextual_search_last_animation_time"; |
41 private static final String CONTEXTUAL_SEARCH_TAP_QUICK_ANSWER_COUNT = | 41 private static final String CONTEXTUAL_SEARCH_TAP_QUICK_ANSWER_COUNT = |
42 "contextual_search_tap_quick_answer_count"; | 42 "contextual_search_tap_quick_answer_count"; |
43 private static final String CONTEXTUAL_SEARCH_CURRENT_WEEK_NUMBER = | 43 private static final String CONTEXTUAL_SEARCH_CURRENT_WEEK_NUMBER = |
44 "contextual_search_current_week_number"; | 44 "contextual_search_current_week_number"; |
45 private static final String HERB_FLAVOR_KEY = "herb_flavor"; | 45 private static final String HERB_FLAVOR_KEY = "herb_flavor"; |
46 private static final String WEBAPK_COMMAND_LINE_KEY = "webapk.command_line_e
nabled"; | 46 private static final String WEBAPK_COMMAND_LINE_KEY = "webapk.command_line_e
nabled"; |
47 private static final String WEBAPK_RUNTIME_KEY = "webapk.runtime_enabled"; | 47 private static final String WEBAPK_RUNTIME_KEY = "webapk.runtime_enabled"; |
| 48 private static final String WEBAPK_ANY_PACKAGE_KEY = "webapk.any_package_nam
e"; |
48 private static final String CHROME_HOME_ENABLED_KEY = "chrome_home_enabled"; | 49 private static final String CHROME_HOME_ENABLED_KEY = "chrome_home_enabled"; |
49 | 50 |
50 private static final String CHROME_DEFAULT_BROWSER = "applink.chrome_default
_browser"; | 51 private static final String CHROME_DEFAULT_BROWSER = "applink.chrome_default
_browser"; |
51 | 52 |
52 private static final String NTP_SIGNIN_PROMO_DISMISSED = "ntp.signin_promo_d
ismissed"; | 53 private static final String NTP_SIGNIN_PROMO_DISMISSED = "ntp.signin_promo_d
ismissed"; |
53 private static final String NTP_ANIMATION_RUN_COUNT = "ntp_recycler_view_ani
mation_run_count"; | 54 private static final String NTP_ANIMATION_RUN_COUNT = "ntp_recycler_view_ani
mation_run_count"; |
54 | 55 |
55 private static final String SUCCESS_UPLOAD_SUFFIX = "_crash_success_upload"; | 56 private static final String SUCCESS_UPLOAD_SUFFIX = "_crash_success_upload"; |
56 private static final String FAILURE_UPLOAD_SUFFIX = "_crash_failure_upload"; | 57 private static final String FAILURE_UPLOAD_SUFFIX = "_crash_failure_upload"; |
57 | 58 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 /** Checks the cached value for the webapk feature. */ | 345 /** Checks the cached value for the webapk feature. */ |
345 public boolean getCachedWebApkRuntimeEnabled() { | 346 public boolean getCachedWebApkRuntimeEnabled() { |
346 return mSharedPreferences.getBoolean(WEBAPK_RUNTIME_KEY, false); | 347 return mSharedPreferences.getBoolean(WEBAPK_RUNTIME_KEY, false); |
347 } | 348 } |
348 | 349 |
349 /** Writes the cached value for the webapk feature is enabled. */ | 350 /** Writes the cached value for the webapk feature is enabled. */ |
350 public void setCachedWebApkRuntimeEnabled(boolean isEnabled) { | 351 public void setCachedWebApkRuntimeEnabled(boolean isEnabled) { |
351 writeBoolean(WEBAPK_RUNTIME_KEY, isEnabled); | 352 writeBoolean(WEBAPK_RUNTIME_KEY, isEnabled); |
352 } | 353 } |
353 | 354 |
| 355 /** Checks the cached value for the webapk any package name feature. */ |
| 356 public boolean getCachedWebApkAnyPackageName() { |
| 357 return mSharedPreferences.getBoolean(WEBAPK_ANY_PACKAGE_KEY, false); |
| 358 } |
| 359 |
| 360 /** Writes the cached value for the webapk any package name feature is enabl
ed. */ |
| 361 public void setCachedWebApkAnyPackageNameEnabled(boolean isEnabled) { |
| 362 writeBoolean(WEBAPK_ANY_PACKAGE_KEY, isEnabled); |
| 363 } |
| 364 |
354 public boolean getCachedChromeDefaultBrowser() { | 365 public boolean getCachedChromeDefaultBrowser() { |
355 return mSharedPreferences.getBoolean(CHROME_DEFAULT_BROWSER, false); | 366 return mSharedPreferences.getBoolean(CHROME_DEFAULT_BROWSER, false); |
356 } | 367 } |
357 | 368 |
358 public void setCachedChromeDefaultBrowser(boolean isDefault) { | 369 public void setCachedChromeDefaultBrowser(boolean isDefault) { |
359 writeBoolean(CHROME_DEFAULT_BROWSER, isDefault); | 370 writeBoolean(CHROME_DEFAULT_BROWSER, isDefault); |
360 } | 371 } |
361 | 372 |
362 /** Checks if the user dismissed the sign in promo from the new tab page. */ | 373 /** Checks if the user dismissed the sign in promo from the new tab page. */ |
363 public boolean getNewTabPageSigninPromoDismissed() { | 374 public boolean getNewTabPageSigninPromoDismissed() { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 * | 453 * |
443 * @param key The name of the preference to modify. | 454 * @param key The name of the preference to modify. |
444 * @param value The new value for the preference. | 455 * @param value The new value for the preference. |
445 */ | 456 */ |
446 private void writeBoolean(String key, boolean value) { | 457 private void writeBoolean(String key, boolean value) { |
447 SharedPreferences.Editor ed = mSharedPreferences.edit(); | 458 SharedPreferences.Editor ed = mSharedPreferences.edit(); |
448 ed.putBoolean(key, value); | 459 ed.putBoolean(key, value); |
449 ed.apply(); | 460 ed.apply(); |
450 } | 461 } |
451 } | 462 } |
OLD | NEW |