| 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.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
| 6 | 6 |
| 7 import android.text.TextUtils; | 7 import android.text.TextUtils; |
| 8 | 8 |
| 9 import org.chromium.base.CommandLine; | 9 import org.chromium.base.CommandLine; |
| 10 import org.chromium.base.SysUtils; | 10 import org.chromium.base.SysUtils; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // TODO(donnd): remove all supporting code once short-lived data collection
is done. | 74 // TODO(donnd): remove all supporting code once short-lived data collection
is done. |
| 75 private static final String SCREEN_TOP_SUPPRESSION_DPS = "screen_top_suppres
sion_dps"; | 75 private static final String SCREEN_TOP_SUPPRESSION_DPS = "screen_top_suppres
sion_dps"; |
| 76 private static final String ENABLE_BAR_OVERLAP_COLLECTION = "enable_bar_over
lap_collection"; | 76 private static final String ENABLE_BAR_OVERLAP_COLLECTION = "enable_bar_over
lap_collection"; |
| 77 private static final String BAR_OVERLAP_SUPPRESSION_ENABLED = "enable_bar_ov
erlap_suppression"; | 77 private static final String BAR_OVERLAP_SUPPRESSION_ENABLED = "enable_bar_ov
erlap_suppression"; |
| 78 | 78 |
| 79 // Safety switch for disabling online-detection. Also used to disable detec
tion when running | 79 // Safety switch for disabling online-detection. Also used to disable detec
tion when running |
| 80 // tests. | 80 // tests. |
| 81 @VisibleForTesting | 81 @VisibleForTesting |
| 82 static final String ONLINE_DETECTION_DISABLED = "disable_online_detection"; | 82 static final String ONLINE_DETECTION_DISABLED = "disable_online_detection"; |
| 83 | 83 |
| 84 private static final String ENABLE_AMP_AS_SEPARATE_TAB = "enable_amp_as_sepa
rate_tab"; | 84 private static final String DISABLE_AMP_AS_SEPARATE_TAB = "disable_amp_as_se
parate_tab"; |
| 85 | 85 |
| 86 // Privacy-related flags | 86 // Privacy-related flags |
| 87 private static final String ENABLE_SEND_HOME_COUNTRY = "enable_send_home_cou
ntry"; | 87 private static final String ENABLE_SEND_HOME_COUNTRY = "enable_send_home_cou
ntry"; |
| 88 | 88 |
| 89 // Cached values to avoid repeated and redundant JNI operations. | 89 // Cached values to avoid repeated and redundant JNI operations. |
| 90 private static Boolean sEnabled; | 90 private static Boolean sEnabled; |
| 91 private static Boolean sDisableSearchTermResolution; | 91 private static Boolean sDisableSearchTermResolution; |
| 92 private static Boolean sIsMandatoryPromoEnabled; | 92 private static Boolean sIsMandatoryPromoEnabled; |
| 93 private static Integer sMandatoryPromoLimit; | 93 private static Integer sMandatoryPromoLimit; |
| 94 private static Boolean sIsPeekPromoEnabled; | 94 private static Boolean sIsPeekPromoEnabled; |
| 95 private static Integer sPeekPromoMaxCount; | 95 private static Integer sPeekPromoMaxCount; |
| 96 private static Boolean sIsTranslationEnabled; | 96 private static Boolean sIsTranslationEnabled; |
| 97 private static Boolean sIsForceTranslationOneboxDisabled; | 97 private static Boolean sIsForceTranslationOneboxDisabled; |
| 98 private static Boolean sIsAutoDetectTranslationOneboxDisabled; | 98 private static Boolean sIsAutoDetectTranslationOneboxDisabled; |
| 99 private static Boolean sIsAcceptLanguagesForTranslationDisabled; | 99 private static Boolean sIsAcceptLanguagesForTranslationDisabled; |
| 100 private static Boolean sIsKeyboardLanguagesForTranslationDisabled; | 100 private static Boolean sIsKeyboardLanguagesForTranslationDisabled; |
| 101 private static Boolean sIsEnglishTargetTranslationEnabled; | 101 private static Boolean sIsEnglishTargetTranslationEnabled; |
| 102 private static Boolean sIsServerControlledOneboxEnabled; | 102 private static Boolean sIsServerControlledOneboxEnabled; |
| 103 private static Boolean sIsQuickAnswersEnabled; | 103 private static Boolean sIsQuickAnswersEnabled; |
| 104 private static Boolean sIsRecentScrollCollectionEnabled; | 104 private static Boolean sIsRecentScrollCollectionEnabled; |
| 105 private static Integer sRecentScrollDurationMs; | 105 private static Integer sRecentScrollDurationMs; |
| 106 private static Integer sScreenTopSuppressionDps; | 106 private static Integer sScreenTopSuppressionDps; |
| 107 private static Boolean sIsBarOverlapCollectionEnabled; | 107 private static Boolean sIsBarOverlapCollectionEnabled; |
| 108 private static Boolean sIsBarOverlapSuppressionEnabled; | 108 private static Boolean sIsBarOverlapSuppressionEnabled; |
| 109 private static Boolean sShouldHideContextualCardsData; | 109 private static Boolean sShouldHideContextualCardsData; |
| 110 private static Boolean sIsContextualCardsBarIntegrationEnabled; | 110 private static Boolean sIsContextualCardsBarIntegrationEnabled; |
| 111 private static Boolean sIsOnlineDetectionDisabled; | 111 private static Boolean sIsOnlineDetectionDisabled; |
| 112 private static Boolean sIsAmpAsSeparateTabEnabled; | 112 private static Boolean sIsAmpAsSeparateTabDisabled; |
| 113 private static Boolean sContextualSearchSingleActionsEnabled; | 113 private static Boolean sContextualSearchSingleActionsEnabled; |
| 114 private static Boolean sCanSendHomeCountry; | 114 private static Boolean sCanSendHomeCountry; |
| 115 private static Boolean sContextualSearchUrlActionsEnabled; | 115 private static Boolean sContextualSearchUrlActionsEnabled; |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * Don't instantiate. | 118 * Don't instantiate. |
| 119 */ | 119 */ |
| 120 private ContextualSearchFieldTrial() {} | 120 private ContextualSearchFieldTrial() {} |
| 121 | 121 |
| 122 /** | 122 /** |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 * Bar peeking location. | 360 * Bar peeking location. |
| 361 */ | 361 */ |
| 362 static boolean isBarOverlapSuppressionEnabled() { | 362 static boolean isBarOverlapSuppressionEnabled() { |
| 363 if (sIsBarOverlapSuppressionEnabled == null) { | 363 if (sIsBarOverlapSuppressionEnabled == null) { |
| 364 sIsBarOverlapSuppressionEnabled = getBooleanParam(BAR_OVERLAP_SUPPRE
SSION_ENABLED); | 364 sIsBarOverlapSuppressionEnabled = getBooleanParam(BAR_OVERLAP_SUPPRE
SSION_ENABLED); |
| 365 } | 365 } |
| 366 return sIsBarOverlapSuppressionEnabled.booleanValue(); | 366 return sIsBarOverlapSuppressionEnabled.booleanValue(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 /** | 369 /** |
| 370 * @return Whether to auto-promote clicks in the AMP carousel into a separat
e Tab. | 370 * @return Whether to disable auto-promotion of clicks in the AMP carousel i
nto a separate Tab. |
| 371 */ | 371 */ |
| 372 static boolean isAmpAsSeparateTabEnabled() { | 372 static boolean isAmpAsSeparateTabDisabled() { |
| 373 if (sIsAmpAsSeparateTabEnabled == null) { | 373 if (sIsAmpAsSeparateTabDisabled == null) { |
| 374 sIsAmpAsSeparateTabEnabled = getBooleanParam(ENABLE_AMP_AS_SEPARATE_
TAB); | 374 sIsAmpAsSeparateTabDisabled = getBooleanParam(DISABLE_AMP_AS_SEPARAT
E_TAB); |
| 375 } | 375 } |
| 376 return sIsAmpAsSeparateTabEnabled; | 376 return sIsAmpAsSeparateTabDisabled; |
| 377 } | 377 } |
| 378 | 378 |
| 379 // TODO(donnd): Remove once bar-integration is fully landed if still unused
(native only). | 379 // TODO(donnd): Remove once bar-integration is fully landed if still unused
(native only). |
| 380 static boolean isContextualCardsBarIntegrationEnabled() { | 380 static boolean isContextualCardsBarIntegrationEnabled() { |
| 381 if (sIsContextualCardsBarIntegrationEnabled == null) { | 381 if (sIsContextualCardsBarIntegrationEnabled == null) { |
| 382 sIsContextualCardsBarIntegrationEnabled = getBooleanParam( | 382 sIsContextualCardsBarIntegrationEnabled = getBooleanParam( |
| 383 ChromeSwitches.CONTEXTUAL_SEARCH_CONTEXTUAL_CARDS_BAR_INTEGR
ATION); | 383 ChromeSwitches.CONTEXTUAL_SEARCH_CONTEXTUAL_CARDS_BAR_INTEGR
ATION); |
| 384 } | 384 } |
| 385 return sIsContextualCardsBarIntegrationEnabled; | 385 return sIsContextualCardsBarIntegrationEnabled; |
| 386 } | 386 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 try { | 476 try { |
| 477 return Integer.parseInt(value); | 477 return Integer.parseInt(value); |
| 478 } catch (NumberFormatException e) { | 478 } catch (NumberFormatException e) { |
| 479 return defaultValue; | 479 return defaultValue; |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 return defaultValue; | 483 return defaultValue; |
| 484 } | 484 } |
| 485 } | 485 } |
| OLD | NEW |