WebSettings.java revision fe9fc3d1a34d879ded2b1cf2443600701e5c5fc5
1/* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.webkit; 18 19import android.content.Context; 20 21/** 22 * Manages settings state for a WebView. When a WebView is first created, it 23 * obtains a set of default settings. These default settings will be returned 24 * from any getter call. A WebSettings object obtained from 25 * WebView.getSettings() is tied to the life of the WebView. If a WebView has 26 * been destroyed, any method call on WebSettings will throw an 27 * IllegalStateException. 28 */ 29// This is an abstract base class: concrete WebViewProviders must 30// create a class derived from this, and return an instance of it in the 31// WebViewProvider.getWebSettingsProvider() method implementation. 32public abstract class WebSettings { 33 /** 34 * Enum for controlling the layout of html. 35 * <ul> 36 * <li>NORMAL means no rendering changes. This is the recommended choice for maximum 37 * compatibility across different platforms and Android versions.</li> 38 * <li>SINGLE_COLUMN moves all content into one column that is the width of the 39 * view.</li> 40 * <li>NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use 41 * this for API levels prior to {@link android.os.Build.VERSION_CODES#KITKAT}.</li> 42 * <li>TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make 43 * the text readable when viewing a wide-viewport layout in the overview mode. 44 * It is recommended to enable zoom support {@link #setSupportZoom} when 45 * using this mode. Supported from API level 46 * {@link android.os.Build.VERSION_CODES#KITKAT}</li> 47 * </ul> 48 */ 49 // XXX: These must match LayoutAlgorithm in Settings.h in WebCore. 50 public enum LayoutAlgorithm { 51 NORMAL, 52 /** 53 * @deprecated This algorithm is now obsolete. 54 */ 55 @Deprecated 56 SINGLE_COLUMN, 57 /** 58 * @deprecated This algorithm is now obsolete. 59 */ 60 @Deprecated 61 NARROW_COLUMNS, 62 TEXT_AUTOSIZING 63 } 64 65 /** 66 * Enum for specifying the text size. 67 * <ul> 68 * <li>SMALLEST is 50%</li> 69 * <li>SMALLER is 75%</li> 70 * <li>NORMAL is 100%</li> 71 * <li>LARGER is 150%</li> 72 * <li>LARGEST is 200%</li> 73 * </ul> 74 * 75 * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead. 76 */ 77 public enum TextSize { 78 SMALLEST(50), 79 SMALLER(75), 80 NORMAL(100), 81 LARGER(150), 82 LARGEST(200); 83 TextSize(int size) { 84 value = size; 85 } 86 int value; 87 } 88 89 /** 90 * Enum for specifying the WebView's desired density. 91 * <ul> 92 * <li>FAR makes 100% looking like in 240dpi</li> 93 * <li>MEDIUM makes 100% looking like in 160dpi</li> 94 * <li>CLOSE makes 100% looking like in 120dpi</li> 95 * </ul> 96 */ 97 public enum ZoomDensity { 98 FAR(150), // 240dpi 99 MEDIUM(100), // 160dpi 100 CLOSE(75); // 120dpi 101 ZoomDensity(int size) { 102 value = size; 103 } 104 105 /** 106 * @hide Only for use by WebViewProvider implementations 107 */ 108 public int getValue() { 109 return value; 110 } 111 112 int value; 113 } 114 115 /** 116 * Default cache usage mode. If the navigation type doesn't impose any 117 * specific behavior, use cached resources when they are available 118 * and not expired, otherwise load resources from the network. 119 * Use with {@link #setCacheMode}. 120 */ 121 public static final int LOAD_DEFAULT = -1; 122 123 /** 124 * Normal cache usage mode. Use with {@link #setCacheMode}. 125 * 126 * @deprecated This value is obsolete, as from API level 127 * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and onwards it has the 128 * same effect as {@link #LOAD_DEFAULT}. 129 */ 130 @Deprecated 131 public static final int LOAD_NORMAL = 0; 132 133 /** 134 * Use cached resources when they are available, even if they have expired. 135 * Otherwise load resources from the network. 136 * Use with {@link #setCacheMode}. 137 */ 138 public static final int LOAD_CACHE_ELSE_NETWORK = 1; 139 140 /** 141 * Don't use the cache, load from the network. 142 * Use with {@link #setCacheMode}. 143 */ 144 public static final int LOAD_NO_CACHE = 2; 145 146 /** 147 * Don't use the network, load from the cache. 148 * Use with {@link #setCacheMode}. 149 */ 150 public static final int LOAD_CACHE_ONLY = 3; 151 152 public enum RenderPriority { 153 NORMAL, 154 HIGH, 155 LOW 156 } 157 158 /** 159 * The plugin state effects how plugins are treated on a page. ON means 160 * that any object will be loaded even if a plugin does not exist to handle 161 * the content. ON_DEMAND means that if there is a plugin installed that 162 * can handle the content, a placeholder is shown until the user clicks on 163 * the placeholder. Once clicked, the plugin will be enabled on the page. 164 * OFF means that all plugins will be turned off and any fallback content 165 * will be used. 166 */ 167 public enum PluginState { 168 ON, 169 ON_DEMAND, 170 OFF 171 } 172 173 /** 174 * Used with {@link #setMixedContentMode} 175 * 176 * In this mode, the WebView will allow a secure origin to load content from any other origin, 177 * even if that origin is insecure. This is the least secure mode of operation for the WebView, 178 * and where possible apps should not set this mode. 179 */ 180 public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0; 181 182 /** 183 * Used with {@link #setMixedContentMode} 184 * 185 * In this mode, the WebView will not allow a secure origin to load content from an insecure 186 * origin. This is the preferred and most secure mode of operation for the WebView and apps are 187 * strongly advised to use this mode. 188 */ 189 public static final int MIXED_CONTENT_NEVER_ALLOW = 1; 190 191 /** 192 * Used with {@link #setMixedContentMode} 193 * 194 * In this mode, the WebView will attempt to be compatible with the approach of a modern web 195 * browser with regard to mixed content. Some insecure content may be allowed to be loaded by 196 * a secure origin and other types of content will be blocked. The types of content are allowed 197 * or blocked may change release to release and are not explicitly defined. 198 * 199 * This mode is intended to be used by apps that are not in control of the content that they 200 * render but desire to operate in a reasonably secure environment. For highest security, apps 201 * are recommended to use {@link #MIXED_CONTENT_NEVER_ALLOW}. 202 */ 203 public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2; 204 205 /** 206 * Hidden constructor to prevent clients from creating a new settings 207 * instance or deriving the class. 208 * 209 * @hide 210 */ 211 protected WebSettings() { 212 } 213 214 /** 215 * Enables dumping the pages navigation cache to a text file. The default 216 * is false. 217 * 218 * @deprecated This method is now obsolete. 219 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 220 */ 221 @Deprecated 222 public void setNavDump(boolean enabled) { 223 throw new MustOverrideException(); 224 } 225 226 /** 227 * Gets whether dumping the navigation cache is enabled. 228 * 229 * @return whether dumping the navigation cache is enabled 230 * @see #setNavDump 231 * @deprecated This method is now obsolete. 232 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 233 */ 234 @Deprecated 235 public boolean getNavDump() { 236 throw new MustOverrideException(); 237 } 238 239 /** 240 * Sets whether the WebView should support zooming using its on-screen zoom 241 * controls and gestures. The particular zoom mechanisms that should be used 242 * can be set with {@link #setBuiltInZoomControls}. This setting does not 243 * affect zooming performed using the {@link WebView#zoomIn()} and 244 * {@link WebView#zoomOut()} methods. The default is true. 245 * 246 * @param support whether the WebView should support zoom 247 */ 248 public void setSupportZoom(boolean support) { 249 throw new MustOverrideException(); 250 } 251 252 /** 253 * Gets whether the WebView supports zoom. 254 * 255 * @return true if the WebView supports zoom 256 * @see #setSupportZoom 257 */ 258 public boolean supportZoom() { 259 throw new MustOverrideException(); 260 } 261 262 /** 263 * Sets whether the WebView requires a user gesture to play media. 264 * The default is true. 265 * 266 * @param require whether the WebView requires a user gesture to play media 267 */ 268 public void setMediaPlaybackRequiresUserGesture(boolean require) { 269 throw new MustOverrideException(); 270 } 271 272 /** 273 * Gets whether the WebView requires a user gesture to play media. 274 * 275 * @return true if the WebView requires a user gesture to play media 276 * @see #setMediaPlaybackRequiresUserGesture 277 */ 278 public boolean getMediaPlaybackRequiresUserGesture() { 279 throw new MustOverrideException(); 280 } 281 282 /** 283 * Sets whether the WebView should use its built-in zoom mechanisms. The 284 * built-in zoom mechanisms comprise on-screen zoom controls, which are 285 * displayed over the WebView's content, and the use of a pinch gesture to 286 * control zooming. Whether or not these on-screen controls are displayed 287 * can be set with {@link #setDisplayZoomControls}. The default is false. 288 * <p> 289 * The built-in mechanisms are the only currently supported zoom 290 * mechanisms, so it is recommended that this setting is always enabled. 291 * 292 * @param enabled whether the WebView should use its built-in zoom mechanisms 293 */ 294 // This method was intended to select between the built-in zoom mechanisms 295 // and the separate zoom controls. The latter were obtained using 296 // {@link WebView#getZoomControls}, which is now hidden. 297 public void setBuiltInZoomControls(boolean enabled) { 298 throw new MustOverrideException(); 299 } 300 301 /** 302 * Gets whether the zoom mechanisms built into WebView are being used. 303 * 304 * @return true if the zoom mechanisms built into WebView are being used 305 * @see #setBuiltInZoomControls 306 */ 307 public boolean getBuiltInZoomControls() { 308 throw new MustOverrideException(); 309 } 310 311 /** 312 * Sets whether the WebView should display on-screen zoom controls when 313 * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}. 314 * The default is true. 315 * 316 * @param enabled whether the WebView should display on-screen zoom controls 317 */ 318 public void setDisplayZoomControls(boolean enabled) { 319 throw new MustOverrideException(); 320 } 321 322 /** 323 * Gets whether the WebView displays on-screen zoom controls when using 324 * the built-in zoom mechanisms. 325 * 326 * @return true if the WebView displays on-screen zoom controls when using 327 * the built-in zoom mechanisms 328 * @see #setDisplayZoomControls 329 */ 330 public boolean getDisplayZoomControls() { 331 throw new MustOverrideException(); 332 } 333 334 /** 335 * Enables or disables file access within WebView. File access is enabled by 336 * default. Note that this enables or disables file system access only. 337 * Assets and resources are still accessible using file:///android_asset and 338 * file:///android_res. 339 */ 340 public void setAllowFileAccess(boolean allow) { 341 throw new MustOverrideException(); 342 } 343 344 /** 345 * Gets whether this WebView supports file access. 346 * 347 * @see #setAllowFileAccess 348 */ 349 public boolean getAllowFileAccess() { 350 throw new MustOverrideException(); 351 } 352 353 /** 354 * Enables or disables content URL access within WebView. Content URL 355 * access allows WebView to load content from a content provider installed 356 * in the system. The default is enabled. 357 */ 358 public void setAllowContentAccess(boolean allow) { 359 throw new MustOverrideException(); 360 } 361 362 /** 363 * Gets whether this WebView supports content URL access. 364 * 365 * @see #setAllowContentAccess 366 */ 367 public boolean getAllowContentAccess() { 368 throw new MustOverrideException(); 369 } 370 371 /** 372 * Sets whether the WebView loads pages in overview mode, that is, 373 * zooms out the content to fit on screen by width. This setting is 374 * taken into account when the content width is greater than the width 375 * of the WebView control, for example, when {@link #getUseWideViewPort} 376 * is enabled. The default is false. 377 */ 378 public void setLoadWithOverviewMode(boolean overview) { 379 throw new MustOverrideException(); 380 } 381 382 /** 383 * Gets whether this WebView loads pages in overview mode. 384 * 385 * @return whether this WebView loads pages in overview mode 386 * @see #setLoadWithOverviewMode 387 */ 388 public boolean getLoadWithOverviewMode() { 389 throw new MustOverrideException(); 390 } 391 392 /** 393 * Sets whether the WebView will enable smooth transition while panning or 394 * zooming or while the window hosting the WebView does not have focus. 395 * If it is true, WebView will choose a solution to maximize the performance. 396 * e.g. the WebView's content may not be updated during the transition. 397 * If it is false, WebView will keep its fidelity. The default value is false. 398 * 399 * @deprecated This method is now obsolete, and will become a no-op in future. 400 */ 401 @Deprecated 402 public void setEnableSmoothTransition(boolean enable) { 403 throw new MustOverrideException(); 404 } 405 406 /** 407 * Gets whether the WebView enables smooth transition while panning or 408 * zooming. 409 * 410 * @see #setEnableSmoothTransition 411 * 412 * @deprecated This method is now obsolete, and will become a no-op in future. 413 */ 414 @Deprecated 415 public boolean enableSmoothTransition() { 416 throw new MustOverrideException(); 417 } 418 419 /** 420 * Sets whether the WebView uses its background for over scroll background. 421 * If true, it will use the WebView's background. If false, it will use an 422 * internal pattern. Default is true. 423 * 424 * @deprecated This method is now obsolete. 425 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 426 */ 427 @Deprecated 428 public void setUseWebViewBackgroundForOverscrollBackground(boolean view) { 429 throw new MustOverrideException(); 430 } 431 432 /** 433 * Gets whether this WebView uses WebView's background instead of 434 * internal pattern for over scroll background. 435 * 436 * @see #setUseWebViewBackgroundForOverscrollBackground 437 * @deprecated This method is now obsolete. 438 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 439 */ 440 @Deprecated 441 public boolean getUseWebViewBackgroundForOverscrollBackground() { 442 throw new MustOverrideException(); 443 } 444 445 /** 446 * Sets whether the WebView should save form data. The default is true. 447 */ 448 public void setSaveFormData(boolean save) { 449 throw new MustOverrideException(); 450 } 451 452 /** 453 * Gets whether the WebView saves form data. 454 * 455 * @return whether the WebView saves form data 456 * @see #setSaveFormData 457 */ 458 public boolean getSaveFormData() { 459 throw new MustOverrideException(); 460 } 461 462 /** 463 * Sets whether the WebView should save passwords. The default is true. 464 * @deprecated Saving passwords in WebView will not be supported in future versions. 465 */ 466 @Deprecated 467 public void setSavePassword(boolean save) { 468 throw new MustOverrideException(); 469 } 470 471 /** 472 * Gets whether the WebView saves passwords. 473 * 474 * @return whether the WebView saves passwords 475 * @see #setSavePassword 476 * @deprecated Saving passwords in WebView will not be supported in future versions. 477 */ 478 @Deprecated 479 public boolean getSavePassword() { 480 throw new MustOverrideException(); 481 } 482 483 /** 484 * Sets the text zoom of the page in percent. The default is 100. 485 * 486 * @param textZoom the text zoom in percent 487 */ 488 public synchronized void setTextZoom(int textZoom) { 489 throw new MustOverrideException(); 490 } 491 492 /** 493 * Gets the text zoom of the page in percent. 494 * 495 * @return the text zoom of the page in percent 496 * @see #setTextZoom 497 */ 498 public synchronized int getTextZoom() { 499 throw new MustOverrideException(); 500 } 501 502 /** 503 * Sets the text size of the page. The default is {@link TextSize#NORMAL}. 504 * 505 * @param t the text size as a {@link TextSize} value 506 * @deprecated Use {@link #setTextZoom} instead. 507 */ 508 public synchronized void setTextSize(TextSize t) { 509 setTextZoom(t.value); 510 } 511 512 /** 513 * Gets the text size of the page. If the text size was previously specified 514 * in percent using {@link #setTextZoom}, this will return the closest 515 * matching {@link TextSize}. 516 * 517 * @return the text size as a {@link TextSize} value 518 * @see #setTextSize 519 * @deprecated Use {@link #getTextZoom} instead. 520 */ 521 public synchronized TextSize getTextSize() { 522 TextSize closestSize = null; 523 int smallestDelta = Integer.MAX_VALUE; 524 int textSize = getTextZoom(); 525 for (TextSize size : TextSize.values()) { 526 int delta = Math.abs(textSize - size.value); 527 if (delta == 0) { 528 return size; 529 } 530 if (delta < smallestDelta) { 531 smallestDelta = delta; 532 closestSize = size; 533 } 534 } 535 return closestSize != null ? closestSize : TextSize.NORMAL; 536 } 537 538 /** 539 * Sets the default zoom density of the page. This must be called from the UI 540 * thread. The default is {@link ZoomDensity#MEDIUM}. 541 * 542 * This setting is not recommended for use in new applications. If the WebView 543 * is utilized to display mobile-oriented pages, the desired effect can be achieved by 544 * adjusting 'width' and 'initial-scale' attributes of page's 'meta viewport' 545 * tag. For pages lacking the tag, {@link android.webkit.WebView#setInitialScale} 546 * and {@link #setUseWideViewPort} can be used. 547 * 548 * @param zoom the zoom density 549 * @deprecated This method is no longer supported, see the function documentation for 550 * recommended alternatives. 551 */ 552 @Deprecated 553 public void setDefaultZoom(ZoomDensity zoom) { 554 throw new MustOverrideException(); 555 } 556 557 /** 558 * Gets the default zoom density of the page. This should be called from 559 * the UI thread. 560 * 561 * This setting is not recommended for use in new applications. 562 * 563 * @return the zoom density 564 * @see #setDefaultZoom 565 * @deprecated Will only return the default value. 566 */ 567 public ZoomDensity getDefaultZoom() { 568 throw new MustOverrideException(); 569 } 570 571 /** 572 * Enables using light touches to make a selection and activate mouseovers. 573 * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this 574 * setting is obsolete and has no effect. 575 */ 576 @Deprecated 577 public void setLightTouchEnabled(boolean enabled) { 578 throw new MustOverrideException(); 579 } 580 581 /** 582 * Gets whether light touches are enabled. 583 * @see #setLightTouchEnabled 584 * @deprecated This setting is obsolete. 585 */ 586 @Deprecated 587 public boolean getLightTouchEnabled() { 588 throw new MustOverrideException(); 589 } 590 591 /** 592 * Controlled a rendering optimization that is no longer present. Setting 593 * it now has no effect. 594 * 595 * @deprecated This setting now has no effect. 596 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 597 */ 598 @Deprecated 599 public synchronized void setUseDoubleTree(boolean use) { 600 // Specified to do nothing, so no need for derived classes to override. 601 } 602 603 /** 604 * Controlled a rendering optimization that is no longer present. Setting 605 * it now has no effect. 606 * 607 * @deprecated This setting now has no effect. 608 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 609 */ 610 @Deprecated 611 public synchronized boolean getUseDoubleTree() { 612 // Returns false unconditionally, so no need for derived classes to override. 613 return false; 614 } 615 616 /** 617 * Sets the user-agent string using an integer code. 618 * <ul> 619 * <li>0 means the WebView should use an Android user-agent string</li> 620 * <li>1 means the WebView should use a desktop user-agent string</li> 621 * </ul> 622 * Other values are ignored. The default is an Android user-agent string, 623 * i.e. code value 0. 624 * 625 * @param ua the integer code for the user-agent string 626 * @deprecated Please use {@link #setUserAgentString} instead. 627 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 628 */ 629 @Deprecated 630 public synchronized void setUserAgent(int ua) { 631 throw new MustOverrideException(); 632 } 633 634 /** 635 * Gets the user-agent as an integer code. 636 * <ul> 637 * <li>-1 means the WebView is using a custom user-agent string set with 638 * {@link #setUserAgentString}</li> 639 * <li>0 means the WebView should use an Android user-agent string</li> 640 * <li>1 means the WebView should use a desktop user-agent string</li> 641 * </ul> 642 * 643 * @return the integer code for the user-agent string 644 * @see #setUserAgent 645 * @deprecated Please use {@link #getUserAgentString} instead. 646 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} 647 */ 648 @Deprecated 649 public synchronized int getUserAgent() { 650 throw new MustOverrideException(); 651 } 652 653 /** 654 * Sets whether the WebView should enable support for the "viewport" 655 * HTML meta tag or should use a wide viewport. 656 * When the value of the setting is false, the layout width is always set to the 657 * width of the WebView control in device-independent (CSS) pixels. 658 * When the value is true and the page contains the viewport meta tag, the value 659 * of the width specified in the tag is used. If the page does not contain the tag or 660 * does not provide a width, then a wide viewport will be used. 661 * 662 * @param use whether to enable support for the viewport meta tag 663 */ 664 public synchronized void setUseWideViewPort(boolean use) { 665 throw new MustOverrideException(); 666 } 667 668 /** 669 * Gets whether the WebView supports the "viewport" 670 * HTML meta tag or will use a wide viewport. 671 * 672 * @return true if the WebView supports the viewport meta tag 673 * @see #setUseWideViewPort 674 */ 675 public synchronized boolean getUseWideViewPort() { 676 throw new MustOverrideException(); 677 } 678 679 /** 680 * Sets whether the WebView whether supports multiple windows. If set to 681 * true, {@link WebChromeClient#onCreateWindow} must be implemented by the 682 * host application. The default is false. 683 * 684 * @param support whether to suport multiple windows 685 */ 686 public synchronized void setSupportMultipleWindows(boolean support) { 687 throw new MustOverrideException(); 688 } 689 690 /** 691 * Gets whether the WebView supports multiple windows. 692 * 693 * @return true if the WebView supports multiple windows 694 * @see #setSupportMultipleWindows 695 */ 696 public synchronized boolean supportMultipleWindows() { 697 throw new MustOverrideException(); 698 } 699 700 /** 701 * Sets the underlying layout algorithm. This will cause a relayout of the 702 * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}. 703 * 704 * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value 705 */ 706 public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) { 707 throw new MustOverrideException(); 708 } 709 710 /** 711 * Gets the current layout algorithm. 712 * 713 * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value 714 * @see #setLayoutAlgorithm 715 */ 716 public synchronized LayoutAlgorithm getLayoutAlgorithm() { 717 throw new MustOverrideException(); 718 } 719 720 /** 721 * Sets the standard font family name. The default is "sans-serif". 722 * 723 * @param font a font family name 724 */ 725 public synchronized void setStandardFontFamily(String font) { 726 throw new MustOverrideException(); 727 } 728 729 /** 730 * Gets the standard font family name. 731 * 732 * @return the standard font family name as a string 733 * @see #setStandardFontFamily 734 */ 735 public synchronized String getStandardFontFamily() { 736 throw new MustOverrideException(); 737 } 738 739 /** 740 * Sets the fixed font family name. The default is "monospace". 741 * 742 * @param font a font family name 743 */ 744 public synchronized void setFixedFontFamily(String font) { 745 throw new MustOverrideException(); 746 } 747 748 /** 749 * Gets the fixed font family name. 750 * 751 * @return the fixed font family name as a string 752 * @see #setFixedFontFamily 753 */ 754 public synchronized String getFixedFontFamily() { 755 throw new MustOverrideException(); 756 } 757 758 /** 759 * Sets the sans-serif font family name. The default is "sans-serif". 760 * 761 * @param font a font family name 762 */ 763 public synchronized void setSansSerifFontFamily(String font) { 764 throw new MustOverrideException(); 765 } 766 767 /** 768 * Gets the sans-serif font family name. 769 * 770 * @return the sans-serif font family name as a string 771 * @see #setSansSerifFontFamily 772 */ 773 public synchronized String getSansSerifFontFamily() { 774 throw new MustOverrideException(); 775 } 776 777 /** 778 * Sets the serif font family name. The default is "sans-serif". 779 * 780 * @param font a font family name 781 */ 782 public synchronized void setSerifFontFamily(String font) { 783 throw new MustOverrideException(); 784 } 785 786 /** 787 * Gets the serif font family name. The default is "serif". 788 * 789 * @return the serif font family name as a string 790 * @see #setSerifFontFamily 791 */ 792 public synchronized String getSerifFontFamily() { 793 throw new MustOverrideException(); 794 } 795 796 /** 797 * Sets the cursive font family name. The default is "cursive". 798 * 799 * @param font a font family name 800 */ 801 public synchronized void setCursiveFontFamily(String font) { 802 throw new MustOverrideException(); 803 } 804 805 /** 806 * Gets the cursive font family name. 807 * 808 * @return the cursive font family name as a string 809 * @see #setCursiveFontFamily 810 */ 811 public synchronized String getCursiveFontFamily() { 812 throw new MustOverrideException(); 813 } 814 815 /** 816 * Sets the fantasy font family name. The default is "fantasy". 817 * 818 * @param font a font family name 819 */ 820 public synchronized void setFantasyFontFamily(String font) { 821 throw new MustOverrideException(); 822 } 823 824 /** 825 * Gets the fantasy font family name. 826 * 827 * @return the fantasy font family name as a string 828 * @see #setFantasyFontFamily 829 */ 830 public synchronized String getFantasyFontFamily() { 831 throw new MustOverrideException(); 832 } 833 834 /** 835 * Sets the minimum font size. The default is 8. 836 * 837 * @param size a non-negative integer between 1 and 72. Any number outside 838 * the specified range will be pinned. 839 */ 840 public synchronized void setMinimumFontSize(int size) { 841 throw new MustOverrideException(); 842 } 843 844 /** 845 * Gets the minimum font size. 846 * 847 * @return a non-negative integer between 1 and 72 848 * @see #setMinimumFontSize 849 */ 850 public synchronized int getMinimumFontSize() { 851 throw new MustOverrideException(); 852 } 853 854 /** 855 * Sets the minimum logical font size. The default is 8. 856 * 857 * @param size a non-negative integer between 1 and 72. Any number outside 858 * the specified range will be pinned. 859 */ 860 public synchronized void setMinimumLogicalFontSize(int size) { 861 throw new MustOverrideException(); 862 } 863 864 /** 865 * Gets the minimum logical font size. 866 * 867 * @return a non-negative integer between 1 and 72 868 * @see #setMinimumLogicalFontSize 869 */ 870 public synchronized int getMinimumLogicalFontSize() { 871 throw new MustOverrideException(); 872 } 873 874 /** 875 * Sets the default font size. The default is 16. 876 * 877 * @param size a non-negative integer between 1 and 72. Any number outside 878 * the specified range will be pinned. 879 */ 880 public synchronized void setDefaultFontSize(int size) { 881 throw new MustOverrideException(); 882 } 883 884 /** 885 * Gets the default font size. 886 * 887 * @return a non-negative integer between 1 and 72 888 * @see #setDefaultFontSize 889 */ 890 public synchronized int getDefaultFontSize() { 891 throw new MustOverrideException(); 892 } 893 894 /** 895 * Sets the default fixed font size. The default is 16. 896 * 897 * @param size a non-negative integer between 1 and 72. Any number outside 898 * the specified range will be pinned. 899 */ 900 public synchronized void setDefaultFixedFontSize(int size) { 901 throw new MustOverrideException(); 902 } 903 904 /** 905 * Gets the default fixed font size. 906 * 907 * @return a non-negative integer between 1 and 72 908 * @see #setDefaultFixedFontSize 909 */ 910 public synchronized int getDefaultFixedFontSize() { 911 throw new MustOverrideException(); 912 } 913 914 /** 915 * Sets whether the WebView should load image resources. Note that this method 916 * controls loading of all images, including those embedded using the data 917 * URI scheme. Use {@link #setBlockNetworkImage} to control loading only 918 * of images specified using network URI schemes. Note that if the value of this 919 * setting is changed from false to true, all images resources referenced 920 * by content currently displayed by the WebView are loaded automatically. 921 * The default is true. 922 * 923 * @param flag whether the WebView should load image resources 924 */ 925 public synchronized void setLoadsImagesAutomatically(boolean flag) { 926 throw new MustOverrideException(); 927 } 928 929 /** 930 * Gets whether the WebView loads image resources. This includes 931 * images embedded using the data URI scheme. 932 * 933 * @return true if the WebView loads image resources 934 * @see #setLoadsImagesAutomatically 935 */ 936 public synchronized boolean getLoadsImagesAutomatically() { 937 throw new MustOverrideException(); 938 } 939 940 /** 941 * Sets whether the WebView should not load image resources from the 942 * network (resources accessed via http and https URI schemes). Note 943 * that this method has no effect unless 944 * {@link #getLoadsImagesAutomatically} returns true. Also note that 945 * disabling all network loads using {@link #setBlockNetworkLoads} 946 * will also prevent network images from loading, even if this flag is set 947 * to false. When the value of this setting is changed from true to false, 948 * network images resources referenced by content currently displayed by 949 * the WebView are fetched automatically. The default is false. 950 * 951 * @param flag whether the WebView should not load image resources from the 952 * network 953 * @see #setBlockNetworkLoads 954 */ 955 public synchronized void setBlockNetworkImage(boolean flag) { 956 throw new MustOverrideException(); 957 } 958 959 /** 960 * Gets whether the WebView does not load image resources from the network. 961 * 962 * @return true if the WebView does not load image resources from the network 963 * @see #setBlockNetworkImage 964 */ 965 public synchronized boolean getBlockNetworkImage() { 966 throw new MustOverrideException(); 967 } 968 969 /** 970 * Sets whether the WebView should not load resources from the network. 971 * Use {@link #setBlockNetworkImage} to only avoid loading 972 * image resources. Note that if the value of this setting is 973 * changed from true to false, network resources referenced by content 974 * currently displayed by the WebView are not fetched until 975 * {@link android.webkit.WebView#reload} is called. 976 * If the application does not have the 977 * {@link android.Manifest.permission#INTERNET} permission, attempts to set 978 * a value of false will cause a {@link java.lang.SecurityException} 979 * to be thrown. The default value is false if the application has the 980 * {@link android.Manifest.permission#INTERNET} permission, otherwise it is 981 * true. 982 * 983 * @param flag whether the WebView should not load any resources from the 984 * network 985 * @see android.webkit.WebView#reload 986 */ 987 public synchronized void setBlockNetworkLoads(boolean flag) { 988 throw new MustOverrideException(); 989 } 990 991 /** 992 * Gets whether the WebView does not load any resources from the network. 993 * 994 * @return true if the WebView does not load any resources from the network 995 * @see #setBlockNetworkLoads 996 */ 997 public synchronized boolean getBlockNetworkLoads() { 998 throw new MustOverrideException(); 999 } 1000 1001 /** 1002 * Tells the WebView to enable JavaScript execution. 1003 * <b>The default is false.</b> 1004 * 1005 * @param flag true if the WebView should execute JavaScript 1006 */ 1007 public synchronized void setJavaScriptEnabled(boolean flag) { 1008 throw new MustOverrideException(); 1009 } 1010 1011 /** 1012 * Sets whether JavaScript running in the context of a file scheme URL 1013 * should be allowed to access content from any origin. This includes 1014 * access to content from other file scheme URLs. See 1015 * {@link #setAllowFileAccessFromFileURLs}. To enable the most restrictive, 1016 * and therefore secure policy, this setting should be disabled. 1017 * Note that this setting affects only JavaScript access to file scheme 1018 * resources. Other access to such resources, for example, from image HTML 1019 * elements, is unaffected. 1020 * <p> 1021 * The default value is true for API level 1022 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below, 1023 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} 1024 * and above. 1025 * 1026 * @param flag whether JavaScript running in the context of a file scheme 1027 * URL should be allowed to access content from any origin 1028 */ 1029 public abstract void setAllowUniversalAccessFromFileURLs(boolean flag); 1030 1031 /** 1032 * Sets whether JavaScript running in the context of a file scheme URL 1033 * should be allowed to access content from other file scheme URLs. To 1034 * enable the most restrictive, and therefore secure policy, this setting 1035 * should be disabled. Note that the value of this setting is ignored if 1036 * the value of {@link #getAllowUniversalAccessFromFileURLs} is true. 1037 * Note too, that this setting affects only JavaScript access to file scheme 1038 * resources. Other access to such resources, for example, from image HTML 1039 * elements, is unaffected. 1040 * <p> 1041 * The default value is true for API level 1042 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below, 1043 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} 1044 * and above. 1045 * 1046 * @param flag whether JavaScript running in the context of a file scheme 1047 * URL should be allowed to access content from other file 1048 * scheme URLs 1049 */ 1050 public abstract void setAllowFileAccessFromFileURLs(boolean flag); 1051 1052 /** 1053 * Sets whether the WebView should enable plugins. The default is false. 1054 * 1055 * @param flag true if plugins should be enabled 1056 * @deprecated This method has been deprecated in favor of 1057 * {@link #setPluginState} 1058 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} 1059 */ 1060 @Deprecated 1061 public synchronized void setPluginsEnabled(boolean flag) { 1062 throw new MustOverrideException(); 1063 } 1064 1065 /** 1066 * Tells the WebView to enable, disable, or have plugins on demand. On 1067 * demand mode means that if a plugin exists that can handle the embedded 1068 * content, a placeholder icon will be shown instead of the plugin. When 1069 * the placeholder is clicked, the plugin will be enabled. The default is 1070 * {@link PluginState#OFF}. 1071 * 1072 * @param state a PluginState value 1073 * @deprecated Plugins will not be supported in future, and should not be used. 1074 */ 1075 @Deprecated 1076 public synchronized void setPluginState(PluginState state) { 1077 throw new MustOverrideException(); 1078 } 1079 1080 /** 1081 * Sets a custom path to plugins used by the WebView. This method is 1082 * obsolete since each plugin is now loaded from its own package. 1083 * 1084 * @param pluginsPath a String path to the directory containing plugins 1085 * @deprecated This method is no longer used as plugins are loaded from 1086 * their own APK via the system's package manager. 1087 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} 1088 */ 1089 @Deprecated 1090 public synchronized void setPluginsPath(String pluginsPath) { 1091 // Specified to do nothing, so no need for derived classes to override. 1092 } 1093 1094 /** 1095 * Sets the path to where database storage API databases should be saved. 1096 * In order for the database storage API to function correctly, this method 1097 * must be called with a path to which the application can write. This 1098 * method should only be called once: repeated calls are ignored. 1099 * 1100 * @param databasePath a path to the directory where databases should be 1101 * saved. 1102 * @deprecated Database paths are managed by the implementation and calling this method 1103 * will have no effect. 1104 */ 1105 // This will update WebCore when the Sync runs in the C++ side. 1106 // Note that the WebCore Database Tracker only allows the path to be set 1107 // once. 1108 @Deprecated 1109 public synchronized void setDatabasePath(String databasePath) { 1110 throw new MustOverrideException(); 1111 } 1112 1113 /** 1114 * Sets the path where the Geolocation databases should be saved. In order 1115 * for Geolocation permissions and cached positions to be persisted, this 1116 * method must be called with a path to which the application can write. 1117 * 1118 * @param databasePath a path to the directory where databases should be 1119 * saved. 1120 */ 1121 // This will update WebCore when the Sync runs in the C++ side. 1122 public synchronized void setGeolocationDatabasePath(String databasePath) { 1123 throw new MustOverrideException(); 1124 } 1125 1126 /** 1127 * Sets whether the Application Caches API should be enabled. The default 1128 * is false. Note that in order for the Application Caches API to be 1129 * enabled, a valid database path must also be supplied to 1130 * {@link #setAppCachePath}. 1131 * 1132 * @param flag true if the WebView should enable Application Caches 1133 */ 1134 public synchronized void setAppCacheEnabled(boolean flag) { 1135 throw new MustOverrideException(); 1136 } 1137 1138 /** 1139 * Sets the path to the Application Caches files. In order for the 1140 * Application Caches API to be enabled, this method must be called with a 1141 * path to which the application can write. This method should only be 1142 * called once: repeated calls are ignored. 1143 * 1144 * @param appCachePath a String path to the directory containing 1145 * Application Caches files. 1146 * @see #setAppCacheEnabled 1147 */ 1148 public synchronized void setAppCachePath(String appCachePath) { 1149 throw new MustOverrideException(); 1150 } 1151 1152 /** 1153 * Sets the maximum size for the Application Cache content. The passed size 1154 * will be rounded to the nearest value that the database can support, so 1155 * this should be viewed as a guide, not a hard limit. Setting the 1156 * size to a value less than current database size does not cause the 1157 * database to be trimmed. The default size is {@link Long#MAX_VALUE}. 1158 * It is recommended to leave the maximum size set to the default value. 1159 * 1160 * @param appCacheMaxSize the maximum size in bytes 1161 * @deprecated In future quota will be managed automatically. 1162 */ 1163 @Deprecated 1164 public synchronized void setAppCacheMaxSize(long appCacheMaxSize) { 1165 throw new MustOverrideException(); 1166 } 1167 1168 /** 1169 * Sets whether the database storage API is enabled. The default value is 1170 * false. See also {@link #setDatabasePath} for how to correctly set up the 1171 * database storage API. 1172 * 1173 * This setting is global in effect, across all WebView instances in a process. 1174 * Note you should only modify this setting prior to making <b>any</b> WebView 1175 * page load within a given process, as the WebView implementation may ignore 1176 * changes to this setting after that point. 1177 * 1178 * @param flag true if the WebView should use the database storage API 1179 */ 1180 public synchronized void setDatabaseEnabled(boolean flag) { 1181 throw new MustOverrideException(); 1182 } 1183 1184 /** 1185 * Sets whether the DOM storage API is enabled. The default value is false. 1186 * 1187 * @param flag true if the WebView should use the DOM storage API 1188 */ 1189 public synchronized void setDomStorageEnabled(boolean flag) { 1190 throw new MustOverrideException(); 1191 } 1192 1193 /** 1194 * Gets whether the DOM Storage APIs are enabled. 1195 * 1196 * @return true if the DOM Storage APIs are enabled 1197 * @see #setDomStorageEnabled 1198 */ 1199 public synchronized boolean getDomStorageEnabled() { 1200 throw new MustOverrideException(); 1201 } 1202 /** 1203 * Gets the path to where database storage API databases are saved. 1204 * 1205 * @return the String path to the database storage API databases 1206 * @see #setDatabasePath 1207 * @deprecated Database paths are managed by the implementation this method is obsolete. 1208 */ 1209 @Deprecated 1210 public synchronized String getDatabasePath() { 1211 throw new MustOverrideException(); 1212 } 1213 1214 /** 1215 * Gets whether the database storage API is enabled. 1216 * 1217 * @return true if the database storage API is enabled 1218 * @see #setDatabaseEnabled 1219 */ 1220 public synchronized boolean getDatabaseEnabled() { 1221 throw new MustOverrideException(); 1222 } 1223 1224 /** 1225 * Sets whether Geolocation is enabled. The default is true. 1226 * <p> 1227 * Please note that in order for the Geolocation API to be usable 1228 * by a page in the WebView, the following requirements must be met: 1229 * <ul> 1230 * <li>an application must have permission to access the device location, 1231 * see {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}, 1232 * {@link android.Manifest.permission#ACCESS_FINE_LOCATION}; 1233 * <li>an application must provide an implementation of the 1234 * {@link WebChromeClient#onGeolocationPermissionsShowPrompt} callback 1235 * to receive notifications that a page is requesting access to location 1236 * via the JavaScript Geolocation API. 1237 * </ul> 1238 * <p> 1239 * As an option, it is possible to store previous locations and web origin 1240 * permissions in a database. See {@link #setGeolocationDatabasePath}. 1241 * 1242 * @param flag whether Geolocation should be enabled 1243 */ 1244 public synchronized void setGeolocationEnabled(boolean flag) { 1245 throw new MustOverrideException(); 1246 } 1247 1248 /** 1249 * Gets whether JavaScript is enabled. 1250 * 1251 * @return true if JavaScript is enabled 1252 * @see #setJavaScriptEnabled 1253 */ 1254 public synchronized boolean getJavaScriptEnabled() { 1255 throw new MustOverrideException(); 1256 } 1257 1258 /** 1259 * Gets whether JavaScript running in the context of a file scheme URL can 1260 * access content from any origin. This includes access to content from 1261 * other file scheme URLs. 1262 * 1263 * @return whether JavaScript running in the context of a file scheme URL 1264 * can access content from any origin 1265 * @see #setAllowUniversalAccessFromFileURLs 1266 */ 1267 public abstract boolean getAllowUniversalAccessFromFileURLs(); 1268 1269 /** 1270 * Gets whether JavaScript running in the context of a file scheme URL can 1271 * access content from other file scheme URLs. 1272 * 1273 * @return whether JavaScript running in the context of a file scheme URL 1274 * can access content from other file scheme URLs 1275 * @see #setAllowFileAccessFromFileURLs 1276 */ 1277 public abstract boolean getAllowFileAccessFromFileURLs(); 1278 1279 /** 1280 * Gets whether plugins are enabled. 1281 * 1282 * @return true if plugins are enabled 1283 * @see #setPluginsEnabled 1284 * @deprecated This method has been replaced by {@link #getPluginState} 1285 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} 1286 */ 1287 @Deprecated 1288 public synchronized boolean getPluginsEnabled() { 1289 throw new MustOverrideException(); 1290 } 1291 1292 /** 1293 * Gets the current state regarding whether plugins are enabled. 1294 * 1295 * @return the plugin state as a {@link PluginState} value 1296 * @see #setPluginState 1297 * @deprecated Plugins will not be supported in future, and should not be used. 1298 */ 1299 @Deprecated 1300 public synchronized PluginState getPluginState() { 1301 throw new MustOverrideException(); 1302 } 1303 1304 /** 1305 * Gets the directory that contains the plugin libraries. This method is 1306 * obsolete since each plugin is now loaded from its own package. 1307 * 1308 * @return an empty string 1309 * @deprecated This method is no longer used as plugins are loaded from 1310 * their own APK via the system's package manager. 1311 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} 1312 */ 1313 @Deprecated 1314 public synchronized String getPluginsPath() { 1315 // Unconditionally returns empty string, so no need for derived classes to override. 1316 return ""; 1317 } 1318 1319 /** 1320 * Tells JavaScript to open windows automatically. This applies to the 1321 * JavaScript function window.open(). The default is false. 1322 * 1323 * @param flag true if JavaScript can open windows automatically 1324 */ 1325 public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) { 1326 throw new MustOverrideException(); 1327 } 1328 1329 /** 1330 * Gets whether JavaScript can open windows automatically. 1331 * 1332 * @return true if JavaScript can open windows automatically during 1333 * window.open() 1334 * @see #setJavaScriptCanOpenWindowsAutomatically 1335 */ 1336 public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() { 1337 throw new MustOverrideException(); 1338 } 1339 /** 1340 * Sets the default text encoding name to use when decoding html pages. 1341 * The default is "Latin-1". 1342 * 1343 * @param encoding the text encoding name 1344 */ 1345 public synchronized void setDefaultTextEncodingName(String encoding) { 1346 throw new MustOverrideException(); 1347 } 1348 1349 /** 1350 * Gets the default text encoding name. 1351 * 1352 * @return the default text encoding name as a string 1353 * @see #setDefaultTextEncodingName 1354 */ 1355 public synchronized String getDefaultTextEncodingName() { 1356 throw new MustOverrideException(); 1357 } 1358 1359 /** 1360 * Sets the WebView's user-agent string. If the string is null or empty, 1361 * the system default value will be used. 1362 */ 1363 public synchronized void setUserAgentString(String ua) { 1364 throw new MustOverrideException(); 1365 } 1366 1367 /** 1368 * Gets the WebView's user-agent string. 1369 * 1370 * @return the WebView's user-agent string 1371 * @see #setUserAgentString 1372 */ 1373 public synchronized String getUserAgentString() { 1374 throw new MustOverrideException(); 1375 } 1376 1377 /** 1378 * Returns the default User-Agent used by a WebView. 1379 * An instance of WebView could use a different User-Agent if a call 1380 * is made to {@link WebSettings#setUserAgentString(String)}. 1381 * 1382 * @param context a Context object used to access application assets 1383 */ 1384 public static String getDefaultUserAgent(Context context) { 1385 return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context); 1386 } 1387 1388 /** 1389 * Tells the WebView whether it needs to set a node to have focus when 1390 * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The 1391 * default value is true. 1392 * 1393 * @param flag whether the WebView needs to set a node 1394 */ 1395 public void setNeedInitialFocus(boolean flag) { 1396 throw new MustOverrideException(); 1397 } 1398 1399 /** 1400 * Sets the priority of the Render thread. Unlike the other settings, this 1401 * one only needs to be called once per process. The default value is 1402 * {@link RenderPriority#NORMAL}. 1403 * 1404 * @param priority the priority 1405 * @deprecated It is not recommended to adjust thread priorities, and this will 1406 * not be supported in future versions. 1407 */ 1408 @Deprecated 1409 public synchronized void setRenderPriority(RenderPriority priority) { 1410 throw new MustOverrideException(); 1411 } 1412 1413 /** 1414 * Overrides the way the cache is used. The way the cache is used is based 1415 * on the navigation type. For a normal page load, the cache is checked 1416 * and content is re-validated as needed. When navigating back, content is 1417 * not revalidated, instead the content is just retrieved from the cache. 1418 * This method allows the client to override this behavior by specifying 1419 * one of {@link #LOAD_DEFAULT}, 1420 * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or 1421 * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}. 1422 * 1423 * @param mode the mode to use 1424 */ 1425 public void setCacheMode(int mode) { 1426 throw new MustOverrideException(); 1427 } 1428 1429 /** 1430 * Gets the current setting for overriding the cache mode. 1431 * 1432 * @return the current setting for overriding the cache mode 1433 * @see #setCacheMode 1434 */ 1435 public int getCacheMode() { 1436 throw new MustOverrideException(); 1437 } 1438 1439 /** 1440 * Configures the WebView's behavior when a secure origin attempts to load a resource from an 1441 * insecure origin. 1442 * 1443 * By default, apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below default 1444 * to {@link #MIXED_CONTENT_ALWAYS_ALLOW}. Apps targeting 1445 * {@link android.os.Build.VERSION_CODES#L} default to {@link #MIXED_CONTENT_NEVER_ALLOW}. 1446 * 1447 * The preferred and most secure mode of operation for the WebView is 1448 * {@link #MIXED_CONTENT_NEVER_ALLOW} and use of {@link #MIXED_CONTENT_ALWAYS_ALLOW} is 1449 * strongly discouraged. 1450 * 1451 * @param mode The mixed content mode to use. One of {@link #MIXED_CONTENT_NEVER_ALLOW}, 1452 * {@link #MIXED_CONTENT_NEVER_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}. 1453 */ 1454 public abstract void setMixedContentMode(int mode); 1455 1456 /** 1457 * Gets the current behavior of the WebView with regard to loading insecure content from a 1458 * secure origin. 1459 * @return The current setting, one of {@link #MIXED_CONTENT_NEVER_ALLOW}, 1460 * {@link #MIXED_CONTENT_NEVER_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}. 1461 */ 1462 public abstract int getMixedContentMode(); 1463} 1464