Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
|
Ted C
2014/10/21 16:57:21
2014
Yaron
2014/10/21 17:40:13
Done.
| |
| 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.chrome.browser.preferences; | |
| 6 | |
| 7 import org.chromium.base.CalledByNative; | |
| 8 import org.chromium.base.ThreadUtils; | |
| 9 import org.chromium.chrome.browser.search_engines.TemplateUrlService; | |
| 10 | |
| 11 import java.util.ArrayList; | |
| 12 | |
| 13 /** | |
| 14 * PrefServiceBridge is a singleton which provides access to some native prefere nces. Ideally | |
| 15 * preferences should be grouped with their relevant functionality but this is a grab-bag for other | |
|
Ted C
2014/10/21 16:57:20
:-) so honest
Yaron
2014/10/21 17:40:13
Acknowledged.
| |
| 16 * prefernces. | |
| 17 */ | |
| 18 public final class PrefServiceBridge { | |
| 19 | |
| 20 // Does not need sync with native; used for the popup settings check | |
| 21 public static final String EXCEPTION_SETTING_ALLOW = "allow"; | |
| 22 public static final String EXCEPTION_SETTING_BLOCK = "block"; | |
| 23 public static final String EXCEPTION_SETTING_DEFAULT = "default"; | |
| 24 | |
| 25 // These values must match the native enum values in | |
| 26 // SupervisedUserURLFilter::FilteringBehavior | |
| 27 public static final int SUPERVISED_USER_FILTERING_ALLOW = 0; | |
| 28 public static final int SUPERVISED_USER_FILTERING_WARN = 1; | |
| 29 public static final int SUPERVISED_USER_FILTERING_BLOCK = 2; | |
| 30 | |
| 31 private static String sProfilePathValue; | |
| 32 | |
| 33 // Object to notify when "clear browsing data" completes. | |
| 34 private OnClearBrowsingDataListener mClearBrowsingDataListener; | |
| 35 private static final String LOG_TAG = "PrefServiceBridge"; | |
| 36 | |
| 37 // Constants related to the Contextual Search preference. | |
| 38 private static final String CONTEXTUAL_SEARCH_DISABLED = "false"; | |
| 39 private static final String CONTEXTUAL_SEARCH_ENABLED = "true"; | |
| 40 | |
| 41 /** | |
| 42 * Structure that holds all the version information about the current Chrome browser. | |
| 43 */ | |
| 44 public static class AboutVersionStrings { | |
| 45 private final String mApplicationVersion; | |
| 46 private final String mWebkitVersion; | |
| 47 private final String mJavascriptVersion; | |
| 48 private final String mOSVersion; | |
| 49 | |
| 50 private AboutVersionStrings(String applicationVersion, String webkitVers ion, | |
| 51 String javascriptVersion, String osVersion) { | |
| 52 mApplicationVersion = applicationVersion; | |
| 53 mWebkitVersion = webkitVersion; | |
| 54 mJavascriptVersion = javascriptVersion; | |
| 55 mOSVersion = osVersion; | |
| 56 } | |
| 57 | |
| 58 public String getApplicationVersion() { | |
| 59 return mApplicationVersion; | |
|
Ted C
2014/10/21 16:57:20
not that you want to change these as part of upstr
Yaron
2014/10/21 17:40:13
Ya, that would probably be cleaner. Noted for futu
| |
| 60 } | |
| 61 | |
| 62 public String getWebkitVersion() { | |
| 63 return mWebkitVersion; | |
| 64 } | |
| 65 | |
| 66 public String getJavascriptVersion() { | |
| 67 return mJavascriptVersion; | |
| 68 } | |
| 69 | |
| 70 public String getOSVersion() { | |
| 71 return mOSVersion; | |
| 72 } | |
| 73 } | |
| 74 | |
| 75 /** | |
| 76 * Website popup exception entry. | |
| 77 */ | |
| 78 public static class PopupExceptionInfo { | |
| 79 private final String mPattern; | |
| 80 private final String mSetting; | |
| 81 private final String mSource; | |
| 82 | |
| 83 private PopupExceptionInfo(String pattern, String setting, String source ) { | |
| 84 mPattern = pattern; | |
| 85 mSetting = setting; | |
| 86 mSource = source; | |
| 87 } | |
| 88 | |
| 89 public String getPattern() { | |
| 90 return mPattern; | |
| 91 } | |
|
Ted C
2014/10/21 16:57:21
I would add blank spaces between these to be consi
Yaron
2014/10/21 17:40:13
Done.
| |
| 92 public String getSetting() { | |
| 93 return mSetting; | |
| 94 } | |
| 95 public String getSource() { | |
| 96 return mSource; | |
| 97 } | |
| 98 } | |
| 99 | |
| 100 @CalledByNative | |
| 101 private static AboutVersionStrings createAboutVersionStrings( | |
| 102 String applicationVersion, String webkitVersion, String javascriptVe rsion, | |
| 103 String osVersion) { | |
| 104 return new AboutVersionStrings( | |
| 105 applicationVersion, webkitVersion, javascriptVersion, osVersion) ; | |
| 106 } | |
| 107 | |
| 108 private PrefServiceBridge() { | |
| 109 TemplateUrlService.getInstance().load(); | |
| 110 } | |
| 111 | |
| 112 private static PrefServiceBridge sInstance; | |
| 113 | |
| 114 /** | |
| 115 * @return The singleton preferences object. | |
| 116 */ | |
| 117 public static PrefServiceBridge getInstance() { | |
| 118 ThreadUtils.assertOnUiThread(); | |
| 119 if (sInstance == null) sInstance = new PrefServiceBridge(); | |
| 120 return sInstance; | |
| 121 } | |
| 122 | |
| 123 /** | |
| 124 * @return Whether the preferences have been initialized. | |
| 125 */ | |
| 126 public static boolean isInitialized() { | |
| 127 return sInstance != null; | |
| 128 } | |
| 129 | |
| 130 /** | |
| 131 * Return the About Chrome value for profile path. | |
|
Ted C
2014/10/21 16:57:20
@return instead of Return
Looks like this file is
Yaron
2014/10/21 17:40:13
Done.
| |
| 132 */ | |
| 133 public String getProfilePathValue() { | |
| 134 return sProfilePathValue; | |
| 135 } | |
| 136 | |
| 137 /** | |
| 138 * Set the About Chrome value for profile path. | |
| 139 */ | |
| 140 @CalledByNative | |
| 141 public static void setProfilePathValue(String pathValue) { | |
| 142 sProfilePathValue = pathValue; | |
| 143 } | |
| 144 | |
| 145 /** | |
| 146 * @return the mAcceptCookiesEnabled | |
|
Ted C
2014/10/21 16:57:21
that is an impressive comment. I won't make you w
Yaron
2014/10/21 17:40:13
Done.
| |
| 147 */ | |
| 148 public boolean isAcceptCookiesEnabled() { | |
| 149 return nativeGetAcceptCookiesEnabled(); | |
| 150 } | |
| 151 | |
| 152 /** | |
| 153 * @return whether cookies acceptance is managed | |
| 154 */ | |
| 155 public boolean isAcceptCookiesManaged() { | |
| 156 return nativeGetAcceptCookiesManaged(); | |
| 157 } | |
| 158 | |
| 159 /** | |
| 160 * @return the mRememberPasswordsEnabled | |
| 161 */ | |
| 162 public boolean isRememberPasswordsEnabled() { | |
| 163 return nativeGetRememberPasswordsEnabled(); | |
| 164 } | |
| 165 | |
| 166 /** | |
| 167 * @return the mRememberPasswordsManaged | |
| 168 */ | |
| 169 public boolean isRememberPasswordsManaged() { | |
| 170 return nativeGetRememberPasswordsManaged(); | |
| 171 } | |
| 172 | |
| 173 /** | |
| 174 * @return the mAllowLocationEnabled | |
| 175 */ | |
| 176 public boolean isAllowLocationEnabled() { | |
| 177 return nativeGetAllowLocationEnabled(); | |
| 178 } | |
| 179 | |
| 180 /** | |
| 181 * @return whether the location preference is configured by policy | |
| 182 */ | |
| 183 public boolean isAllowLocationManaged() { | |
| 184 return nativeGetAllowLocationManaged(); | |
| 185 } | |
| 186 | |
| 187 /** | |
| 188 * @return whether Do Not Track is enabled | |
| 189 */ | |
| 190 public boolean isDoNotTrackEnabled() { | |
| 191 return nativeGetDoNotTrackEnabled(); | |
| 192 } | |
| 193 | |
| 194 public boolean getPasswordEchoEnabled() { | |
| 195 return nativeGetPasswordEchoEnabled(); | |
| 196 } | |
| 197 | |
| 198 /** | |
| 199 * @return Whether EULA has been accepted by the user. | |
| 200 */ | |
| 201 public boolean isFirstRunEulaAccepted() { | |
| 202 return nativeGetFirstRunEulaAccepted(); | |
| 203 } | |
| 204 | |
| 205 /** | |
| 206 * Returns true if JavaScript is enabled. It may return the temporary value set by | |
| 207 * {@link #setJavaScriptEnabled}. The default is true. | |
| 208 */ | |
| 209 public boolean javaScriptEnabled() { | |
| 210 return nativeGetJavaScriptEnabled(); | |
| 211 } | |
| 212 | |
| 213 /** | |
| 214 * @return whether Javascript is managed by policy | |
| 215 */ | |
| 216 public boolean javaScriptManaged() { | |
| 217 return nativeGetJavaScriptManaged(); | |
| 218 } | |
| 219 | |
| 220 /** | |
| 221 * Sets the preference that controls protected media identifier. | |
| 222 */ | |
| 223 public void setProtectedMediaIdentifierEnabled(boolean enabled) { | |
| 224 nativeSetProtectedMediaIdentifierEnabled(enabled); | |
| 225 } | |
| 226 | |
| 227 /** | |
| 228 * Sets the preference that controls translate | |
| 229 */ | |
| 230 public void setTranslateEnabled(boolean enabled) { | |
| 231 nativeSetTranslateEnabled(enabled); | |
| 232 } | |
| 233 | |
| 234 /** | |
| 235 * Sets the preference that signals when the user has accepted the EULA. | |
| 236 */ | |
| 237 public void setEulaAccepted() { | |
| 238 nativeSetEulaAccepted(); | |
| 239 } | |
| 240 | |
| 241 /** | |
| 242 * Resets translate defaults if needed | |
| 243 */ | |
| 244 public void resetTranslateDefaults() { | |
| 245 nativeResetTranslateDefaults(); | |
| 246 } | |
| 247 | |
| 248 /** | |
| 249 * Enable or disable JavaScript. If "immediately" is true, the change is app lied right away. | |
| 250 * Otherwise the change will be applied when {@link #sync} is called. | |
|
Ted C
2014/10/21 16:57:21
This comment seems no longer valid.
Yaron
2014/10/21 17:40:13
Done.
| |
| 251 */ | |
| 252 public void setJavaScriptEnabled(boolean enabled) { | |
| 253 nativeSetJavaScriptEnabled(enabled); | |
| 254 } | |
| 255 | |
| 256 /** | |
| 257 * Returns the last account username associated with sync. | |
| 258 */ | |
| 259 public String getSyncLastAccountName() { | |
| 260 return nativeGetSyncLastAccountName(); | |
| 261 } | |
| 262 | |
| 263 /** | |
| 264 * Enable or disable x-auto-login | |
| 265 */ | |
| 266 public void setAutologinEnabled(boolean autologinEnabled) { | |
| 267 nativeSetAutologinEnabled(autologinEnabled); | |
| 268 } | |
| 269 | |
| 270 /** | |
| 271 * Return true if x-auto-login is enabled, false otherwise. | |
| 272 */ | |
| 273 public boolean isAutologinEnabled() { | |
| 274 return nativeGetAutologinEnabled(); | |
| 275 } | |
| 276 | |
| 277 /** | |
| 278 * Enable or disable crashes_ui. | |
| 279 */ | |
| 280 public void setCrashReporting(boolean reporting) { | |
| 281 nativeSetCrashReporting(reporting); | |
| 282 } | |
| 283 | |
| 284 /** | |
| 285 * Return whether Search Suggest is enabled. | |
| 286 */ | |
| 287 public boolean isSearchSuggestEnabled() { | |
| 288 return nativeGetSearchSuggestEnabled(); | |
| 289 } | |
| 290 | |
| 291 /** | |
| 292 * Sets whether search suggest should be enabled. | |
| 293 */ | |
| 294 public void setSearchSuggestEnabled(boolean enabled) { | |
| 295 nativeSetSearchSuggestEnabled(enabled); | |
| 296 } | |
| 297 | |
| 298 /** | |
| 299 * Return whether Search Suggest is managed. | |
| 300 */ | |
| 301 public boolean isSearchSuggestManaged() { | |
| 302 return nativeGetSearchSuggestManaged(); | |
| 303 } | |
| 304 | |
| 305 /** | |
| 306 * Return the Contextual Search preference. | |
| 307 */ | |
| 308 public String getContextualSearchPreference() { | |
| 309 return nativeGetContextualSearchPreference(); | |
| 310 } | |
| 311 | |
| 312 /** | |
| 313 * Sets the Contextual Search preference and sends a notification. | |
|
Ted C
2014/10/21 16:57:21
is this sends a notification still valid?
Yaron
2014/10/21 17:40:13
nah, I removed that junk prior to upstreaming :)
| |
| 314 * @param prefValue one of "", CONTEXTUAL_SEARCH_ENABLED or CONTEXTUAL_SEARC H_DISABLED. | |
| 315 */ | |
| 316 public void setContextualSearchPreference(String prefValue) { | |
| 317 nativeSetContextualSearchPreference(prefValue); | |
| 318 } | |
| 319 | |
| 320 /** | |
| 321 * @return whether the Contextual Search feature was disabled by the user ex plicitly. | |
| 322 */ | |
| 323 public boolean isContextualSearchDisabled() { | |
| 324 return getContextualSearchPreference().equals(CONTEXTUAL_SEARCH_DISABLED ); | |
| 325 } | |
| 326 | |
| 327 /** | |
| 328 * @return whether the Contextual Search feature is uninitialized (preferenc e unset by the | |
| 329 * user). | |
|
Ted C
2014/10/21 16:57:21
this should align with "whether" above
Yaron
2014/10/21 17:40:13
Done.
| |
| 330 */ | |
| 331 public boolean isContextualSearchUninitialized() { | |
| 332 return getContextualSearchPreference().isEmpty(); | |
| 333 } | |
| 334 | |
| 335 /** | |
| 336 * @param whether Contextual Search should be enabled. | |
| 337 */ | |
| 338 public void setContextualSearchState(boolean enabled) { | |
| 339 setContextualSearchPreference(enabled | |
| 340 ? CONTEXTUAL_SEARCH_ENABLED : CONTEXTUAL_SEARCH_DISABLED); | |
| 341 } | |
| 342 | |
| 343 /** | |
| 344 * Return whether there is a user set value for kNetworkPredictionEnabled. This should only be | |
| 345 * used for preference migration. | |
| 346 */ | |
| 347 public boolean networkPredictionEnabledHasUserSetting() { | |
| 348 return nativeNetworkPredictionEnabledHasUserSetting(); | |
| 349 } | |
| 350 | |
| 351 /** | |
| 352 * Return whether there is a user set value for kNetworkPredictionOptions. This should only be | |
| 353 * used for preference migration. | |
| 354 */ | |
| 355 public boolean networkPredictionOptionsHasUserSetting() { | |
| 356 return nativeNetworkPredictionOptionsHasUserSetting(); | |
| 357 } | |
| 358 | |
| 359 /** | |
| 360 * Return the user set value for kNetworkPredictionEnabled. This should only be used for | |
| 361 * preference migration. | |
| 362 */ | |
| 363 public boolean getNetworkPredictionEnabledUserPrefValue() { | |
| 364 return nativeGetNetworkPredictionEnabledUserPrefValue(); | |
| 365 } | |
| 366 | |
| 367 /** | |
| 368 * Return Network Predictions option. It is stored as an int and converted t o an enum. | |
|
Ted C
2014/10/21 16:57:20
The storage information seems to be very implement
Yaron
2014/10/21 17:40:13
Done.
| |
| 369 */ | |
| 370 public NetworkPredictionOptions getNetworkPredictionOptions() { | |
| 371 return NetworkPredictionOptions.intToEnum(nativeGetNetworkPredictionOpti ons()); | |
| 372 } | |
| 373 | |
| 374 /** | |
| 375 * Sets network predictions preference. It is received as an enum and conver ted to an int. | |
| 376 */ | |
| 377 public void setNetworkPredictionOptions(NetworkPredictionOptions option) { | |
| 378 nativeSetNetworkPredictionOptions(option.enumToInt()); | |
| 379 } | |
| 380 | |
| 381 /** | |
| 382 * Return whether Network Predictions is managed. | |
| 383 */ | |
| 384 public boolean isNetworkPredictionManaged() { | |
| 385 return nativeGetNetworkPredictionManaged(); | |
| 386 } | |
| 387 | |
| 388 /** | |
| 389 * Checks whether network predictions are allowed given preferences and curr ent network | |
| 390 * connection type. | |
| 391 * @return Whether network predictions are allowed. | |
| 392 */ | |
| 393 public boolean canPredictNetworkActions() { | |
| 394 return nativeCanPredictNetworkActions(); | |
| 395 } | |
| 396 | |
| 397 /** | |
| 398 * Return whether the web service to resolve navigation error is enabled. | |
| 399 */ | |
| 400 public boolean isResolveNavigationErrorEnabled() { | |
| 401 return nativeGetResolveNavigationErrorEnabled(); | |
| 402 } | |
| 403 | |
| 404 /** | |
| 405 * Return whether the web service to resolve navigation error is managed. | |
| 406 */ | |
| 407 public boolean isResolveNavigationErrorManaged() { | |
| 408 return nativeGetResolveNavigationErrorManaged(); | |
| 409 } | |
| 410 | |
| 411 /** | |
| 412 * Return whether usage and crash report is managed. | |
| 413 */ | |
| 414 public boolean isCrashReportManaged() { | |
|
Ted C
2014/10/21 16:57:21
should this go up with setCrashReporting?
Yaron
2014/10/21 17:40:13
Done.
| |
| 415 return nativeGetCrashReportManaged(); | |
| 416 } | |
| 417 | |
| 418 /** | |
| 419 * @return whether or not the protected media identifier is enabled. | |
| 420 */ | |
| 421 public boolean isProtectedMediaIdentifierEnabled() { | |
| 422 return nativeGetProtectedMediaIdentifierEnabled(); | |
| 423 } | |
| 424 | |
| 425 /** | |
| 426 * Return true if translate is enabled, false otherwise. | |
| 427 */ | |
| 428 public boolean isTranslateEnabled() { | |
| 429 return nativeGetTranslateEnabled(); | |
| 430 } | |
| 431 | |
| 432 /** | |
| 433 * @return whether translate is configured by policy | |
| 434 */ | |
| 435 public boolean isTranslateManaged() { | |
| 436 return nativeGetTranslateManaged(); | |
| 437 } | |
| 438 | |
| 439 /** | |
| 440 * Sets whether the web service to resolve navigation error should be enable d. | |
| 441 */ | |
| 442 public void setResolveNavigationErrorEnabled(boolean enabled) { | |
| 443 nativeSetResolveNavigationErrorEnabled(enabled); | |
| 444 } | |
| 445 | |
| 446 /** | |
| 447 * Interface for a class that is listening to clear browser data events. | |
| 448 */ | |
| 449 public interface OnClearBrowsingDataListener { | |
| 450 public abstract void onBrowsingDataCleared(); | |
| 451 } | |
| 452 | |
| 453 /** | |
| 454 * Clear the specified types of browsing data asynchronously. | |
| 455 * |listener| is an object to be notified when clearing completes. | |
| 456 * It can be null, but many operations (e.g. navigation) are | |
| 457 * ill-advised while browsing data is being cleared. | |
| 458 */ | |
| 459 public void clearBrowsingData(OnClearBrowsingDataListener listener, | |
| 460 boolean history, boolean cache, boolean cookiesAndSiteData, | |
| 461 boolean passwords, boolean formData) { | |
| 462 mClearBrowsingDataListener = listener; | |
|
Ted C
2014/10/21 16:57:21
Seems like we should be checking that mClearBrowsi
Yaron
2014/10/21 17:40:14
Agreed - added an assert. I even considered fixing
| |
| 463 nativeClearBrowsingData(history, cache, cookiesAndSiteData, passwords, f ormData); | |
| 464 } | |
| 465 | |
| 466 @CalledByNative | |
| 467 private void browsingDataCleared() { | |
| 468 if (mClearBrowsingDataListener != null) { | |
| 469 mClearBrowsingDataListener.onBrowsingDataCleared(); | |
| 470 mClearBrowsingDataListener = null; | |
| 471 } | |
| 472 } | |
| 473 | |
| 474 public void setAllowCookiesEnabled(boolean allow) { | |
| 475 nativeSetAllowCookiesEnabled(allow); | |
| 476 } | |
| 477 | |
| 478 public void setDoNotTrackEnabled(boolean enabled) { | |
| 479 nativeSetDoNotTrackEnabled(enabled); | |
| 480 } | |
| 481 | |
| 482 public void setRememberPasswordsEnabled(boolean allow) { | |
| 483 nativeSetRememberPasswordsEnabled(allow); | |
| 484 } | |
| 485 | |
| 486 public void setAllowLocationEnabled(boolean allow) { | |
| 487 nativeSetAllowLocationEnabled(allow); | |
| 488 } | |
| 489 | |
| 490 public void setPasswordEchoEnabled(boolean enabled) { | |
| 491 nativeSetPasswordEchoEnabled(enabled); | |
| 492 } | |
| 493 | |
| 494 /** | |
| 495 * @return The setting if popups are enabled | |
| 496 */ | |
| 497 public boolean popupsEnabled() { | |
| 498 return nativeGetAllowPopupsEnabled(); | |
| 499 } | |
| 500 | |
| 501 /** | |
| 502 * @return Whether the setting to allow popups is managed | |
| 503 */ | |
| 504 public boolean isPopupsManaged() { | |
| 505 return nativeGetAllowPopupsManaged(); | |
| 506 } | |
| 507 | |
| 508 /** | |
| 509 * Sets the preferences on whether to enable/disable popups | |
| 510 * | |
| 511 * @param allow attribute to enable/disable popups | |
| 512 */ | |
| 513 public void setAllowPopupsEnabled(boolean allow) { | |
| 514 nativeSetAllowPopupsEnabled(allow); | |
| 515 } | |
| 516 | |
| 517 /** | |
| 518 * @return true if incognito mode is enabled. | |
| 519 */ | |
| 520 public boolean isIncognitoModeEnabled() { | |
| 521 return nativeGetIncognitoModeEnabled(); | |
| 522 } | |
| 523 | |
| 524 /** | |
| 525 * @return true if incognito mode is managed by policy. | |
| 526 */ | |
| 527 public boolean isIncognitoModeManaged() { | |
| 528 return nativeGetIncognitoModeManaged(); | |
| 529 } | |
| 530 | |
| 531 /** | |
| 532 * @return Whether printing is enabled. | |
| 533 */ | |
| 534 public boolean isPrintingEnabled() { | |
| 535 return nativeGetPrintingEnabled(); | |
| 536 } | |
| 537 | |
| 538 /** | |
| 539 * Adds/Edit a popup exception | |
| 540 * | |
| 541 * @param pattern attribute for the popup exception pattern | |
| 542 * @param allow attribute to specify whether to allow or block pattern | |
| 543 */ | |
| 544 public void setPopupException(String pattern, boolean allow) { | |
| 545 nativeSetPopupException(pattern, allow); | |
| 546 } | |
| 547 | |
| 548 /** | |
| 549 * Removes a popup exception | |
| 550 * | |
| 551 * @param pattern attribute for the popup exception pattern | |
| 552 */ | |
| 553 public void removePopupException(String pattern) { | |
| 554 nativeRemovePopupException(pattern); | |
| 555 } | |
| 556 | |
| 557 /** | |
| 558 * get all the currently saved popup exceptions | |
| 559 * | |
| 560 * @return HashMap array of all the exceptions and their settings | |
|
Ted C
2014/10/21 16:57:21
s/HashMap array/List
Yaron
2014/10/21 17:40:13
Done.
| |
| 561 */ | |
| 562 public ArrayList<PopupExceptionInfo> getPopupExceptions() { | |
|
Ted C
2014/10/21 16:57:21
This should be just returning a list instead of Ar
Yaron
2014/10/21 17:40:13
Done.
| |
| 563 ArrayList<PopupExceptionInfo> list = new ArrayList<PopupExceptionInfo>() ; | |
| 564 nativeGetPopupExceptions(list); | |
| 565 return list; | |
| 566 } | |
| 567 | |
| 568 @CalledByNative | |
| 569 private static void insertPopupExceptionToList( | |
| 570 ArrayList<PopupExceptionInfo> list, String pattern, String setting, String source) { | |
| 571 PopupExceptionInfo exception = new PopupExceptionInfo(pattern, setting, source); | |
| 572 list.add(exception); | |
| 573 } | |
| 574 | |
| 575 /** | |
| 576 * Get all the version strings from native. | |
| 577 * @return AboutVersionStrings about version strings. | |
| 578 */ | |
| 579 public AboutVersionStrings getAboutVersionStrings() { | |
| 580 return nativeGetAboutVersionStrings(); | |
| 581 } | |
| 582 | |
| 583 /** | |
| 584 * Set profile path value needed for about chrome. | |
| 585 */ | |
| 586 public void setPathValuesForAboutChrome() { | |
| 587 if (sProfilePathValue == null) { | |
| 588 nativeSetPathValuesForAboutChrome(); | |
| 589 } | |
| 590 } | |
| 591 | |
| 592 /** | |
| 593 * Reset accept-languages to its default value. | |
| 594 * | |
| 595 * @param defaultLocale A fall-back value such as en_US, de_DE, zh_CN, etc. | |
| 596 */ | |
| 597 public void resetAcceptLanguages(String defaultLocale) { | |
| 598 nativeResetAcceptLanguages(defaultLocale); | |
| 599 } | |
| 600 | |
| 601 /** | |
| 602 * @return whether ForceSafeSearch is set | |
| 603 */ | |
| 604 public boolean isForceSafeSearch() { | |
| 605 return nativeGetForceSafeSearch(); | |
| 606 } | |
| 607 | |
| 608 /** | |
| 609 * @return the default supervised user filtering behavior | |
| 610 */ | |
| 611 public int getDefaultSupervisedUserFilteringBehavior() { | |
| 612 return nativeGetDefaultSupervisedUserFilteringBehavior(); | |
| 613 } | |
| 614 | |
| 615 public String getSupervisedUserCustodianName() { | |
| 616 return nativeGetSupervisedUserCustodianName(); | |
| 617 } | |
| 618 | |
| 619 public String getSupervisedUserCustodianEmail() { | |
| 620 return nativeGetSupervisedUserCustodianEmail(); | |
| 621 } | |
| 622 | |
| 623 public String getSupervisedUserCustodianProfileImageURL() { | |
| 624 return nativeGetSupervisedUserCustodianProfileImageURL(); | |
| 625 } | |
| 626 | |
| 627 public String getSupervisedUserSecondCustodianName() { | |
| 628 return nativeGetSupervisedUserSecondCustodianName(); | |
| 629 } | |
| 630 | |
| 631 public String getSupervisedUserSecondCustodianEmail() { | |
| 632 return nativeGetSupervisedUserSecondCustodianEmail(); | |
| 633 } | |
| 634 | |
| 635 public String getSupervisedUserSecondCustodianProfileImageURL() { | |
| 636 return nativeGetSupervisedUserSecondCustodianProfileImageURL(); | |
| 637 } | |
| 638 | |
| 639 private native boolean nativeGetAcceptCookiesEnabled(); | |
| 640 private native boolean nativeGetAcceptCookiesManaged(); | |
| 641 private native boolean nativeGetRememberPasswordsEnabled(); | |
| 642 private native boolean nativeGetRememberPasswordsManaged(); | |
| 643 private native boolean nativeGetAllowLocationManaged(); | |
| 644 private native boolean nativeGetDoNotTrackEnabled(); | |
| 645 private native boolean nativeGetPasswordEchoEnabled(); | |
| 646 private native boolean nativeGetFirstRunEulaAccepted(); | |
| 647 private native boolean nativeGetJavaScriptManaged(); | |
| 648 private native boolean nativeGetTranslateEnabled(); | |
| 649 private native boolean nativeGetTranslateManaged(); | |
| 650 private native boolean nativeGetResolveNavigationErrorEnabled(); | |
| 651 private native boolean nativeGetResolveNavigationErrorManaged(); | |
| 652 private native boolean nativeGetProtectedMediaIdentifierEnabled(); | |
| 653 private native boolean nativeGetCrashReportManaged(); | |
| 654 private native boolean nativeGetIncognitoModeEnabled(); | |
| 655 private native boolean nativeGetIncognitoModeManaged(); | |
| 656 private native boolean nativeGetPrintingEnabled(); | |
| 657 private native boolean nativeGetForceSafeSearch(); | |
| 658 private native void nativeSetTranslateEnabled(boolean enabled); | |
| 659 private native void nativeResetTranslateDefaults(); | |
| 660 private native boolean nativeGetJavaScriptEnabled(); | |
| 661 private native void nativeSetJavaScriptEnabled(boolean enabled); | |
| 662 private native void nativeClearBrowsingData(boolean history, boolean cache, | |
| 663 boolean cookiesAndSiteData, boolean passwords, boolean formData); | |
| 664 private native boolean nativeGetAllowCookiesEnabled(); | |
| 665 private native void nativeSetAllowCookiesEnabled(boolean allow); | |
| 666 private native void nativeSetDoNotTrackEnabled(boolean enabled); | |
| 667 private native void nativeSetRememberPasswordsEnabled(boolean allow); | |
| 668 private native void nativeSetProtectedMediaIdentifierEnabled(boolean enabled ); | |
| 669 private native boolean nativeGetAllowLocationEnabled(); | |
| 670 private native void nativeSetAllowLocationEnabled(boolean allow); | |
| 671 private native void nativeSetPasswordEchoEnabled(boolean enabled); | |
| 672 private native boolean nativeGetAllowPopupsEnabled(); | |
| 673 private native boolean nativeGetAllowPopupsManaged(); | |
| 674 private native void nativeSetAllowPopupsEnabled(boolean allow); | |
| 675 private native void nativeSetPopupException(String pattern, boolean allow); | |
| 676 private native void nativeRemovePopupException(String pattern); | |
| 677 private native void nativeGetPopupExceptions(Object list); | |
| 678 private native boolean nativeGetAutologinEnabled(); | |
| 679 private native void nativeSetAutologinEnabled(boolean autologinEnabled); | |
| 680 private native void nativeSetCrashReporting(boolean reporting); | |
| 681 private native boolean nativeCanPredictNetworkActions(); | |
| 682 private native AboutVersionStrings nativeGetAboutVersionStrings(); | |
| 683 private native void nativeSetPathValuesForAboutChrome(); | |
| 684 private native void nativeSetContextualSearchPreference(String preference); | |
| 685 private native String nativeGetContextualSearchPreference(); | |
| 686 private native boolean nativeGetSearchSuggestEnabled(); | |
| 687 private native void nativeSetSearchSuggestEnabled(boolean enabled); | |
| 688 private native boolean nativeGetSearchSuggestManaged(); | |
| 689 private native boolean nativeGetNetworkPredictionManaged(); | |
| 690 private native boolean nativeNetworkPredictionEnabledHasUserSetting(); | |
| 691 private native boolean nativeNetworkPredictionOptionsHasUserSetting(); | |
| 692 private native boolean nativeGetNetworkPredictionEnabledUserPrefValue(); | |
| 693 private native int nativeGetNetworkPredictionOptions(); | |
| 694 private native void nativeSetNetworkPredictionOptions(int option); | |
| 695 private native void nativeSetResolveNavigationErrorEnabled(boolean enabled); | |
| 696 private native void nativeSetEulaAccepted(); | |
| 697 private native void nativeResetAcceptLanguages(String defaultLocale); | |
| 698 private native String nativeGetSyncLastAccountName(); | |
| 699 private native String nativeGetSupervisedUserCustodianName(); | |
| 700 private native String nativeGetSupervisedUserCustodianEmail(); | |
| 701 private native String nativeGetSupervisedUserCustodianProfileImageURL(); | |
| 702 private native int nativeGetDefaultSupervisedUserFilteringBehavior(); | |
| 703 private native String nativeGetSupervisedUserSecondCustodianName(); | |
| 704 private native String nativeGetSupervisedUserSecondCustodianEmail(); | |
| 705 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( ); | |
| 706 } | |
| OLD | NEW |