WebSettings.java revision 06d268e3ad1129814829af5d3b84752d84c1acf2
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.os.Message; 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 (effectively) 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 class WebSettings { 33 // TODO: Remove MustOverrideException and make all methods throwing it abstract instead; 34 // needs API file update. 35 private static class MustOverrideException extends RuntimeException { 36 MustOverrideException() { 37 super("abstract function called: must be overriden!"); 38 } 39 } 40 41 /** 42 * Enum for controlling the layout of html. 43 * NORMAL means no rendering changes. 44 * SINGLE_COLUMN moves all content into one column that is the width of the 45 * view. 46 * NARROW_COLUMNS makes all columns no wider than the screen if possible. 47 */ 48 // XXX: These must match LayoutAlgorithm in Settings.h in WebCore. 49 public enum LayoutAlgorithm { 50 NORMAL, 51 /** 52 * @deprecated This algorithm is now obsolete. 53 */ 54 @Deprecated 55 SINGLE_COLUMN, 56 NARROW_COLUMNS 57 } 58 59 /** 60 * Enum for specifying the text size. 61 * SMALLEST is 50% 62 * SMALLER is 75% 63 * NORMAL is 100% 64 * LARGER is 150% 65 * LARGEST is 200% 66 * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead. 67 */ 68 public enum TextSize { 69 SMALLEST(50), 70 SMALLER(75), 71 NORMAL(100), 72 LARGER(150), 73 LARGEST(200); 74 TextSize(int size) { 75 value = size; 76 } 77 int value; 78 } 79 80 /** 81 * Enum for specifying the WebView's desired density. 82 * FAR makes 100% looking like in 240dpi 83 * MEDIUM makes 100% looking like in 160dpi 84 * CLOSE makes 100% looking like in 120dpi 85 */ 86 public enum ZoomDensity { 87 FAR(150), // 240dpi 88 MEDIUM(100), // 160dpi 89 CLOSE(75); // 120dpi 90 ZoomDensity(int size) { 91 value = size; 92 } 93 int value; 94 } 95 96 /** 97 * Default cache usage pattern Use with {@link #setCacheMode}. 98 */ 99 public static final int LOAD_DEFAULT = -1; 100 101 /** 102 * Normal cache usage pattern Use with {@link #setCacheMode}. 103 */ 104 public static final int LOAD_NORMAL = 0; 105 106 /** 107 * Use cache if content is there, even if expired (eg, history nav) 108 * If it is not in the cache, load from network. 109 * Use with {@link #setCacheMode}. 110 */ 111 public static final int LOAD_CACHE_ELSE_NETWORK = 1; 112 113 /** 114 * Don't use the cache, load from network 115 * Use with {@link #setCacheMode}. 116 */ 117 public static final int LOAD_NO_CACHE = 2; 118 119 /** 120 * Don't use the network, load from cache only. 121 * Use with {@link #setCacheMode}. 122 */ 123 public static final int LOAD_CACHE_ONLY = 3; 124 125 public enum RenderPriority { 126 NORMAL, 127 HIGH, 128 LOW 129 } 130 131 /** 132 * The plugin state effects how plugins are treated on a page. ON means 133 * that any object will be loaded even if a plugin does not exist to handle 134 * the content. ON_DEMAND means that if there is a plugin installed that 135 * can handle the content, a placeholder is shown until the user clicks on 136 * the placeholder. Once clicked, the plugin will be enabled on the page. 137 * OFF means that all plugins will be turned off and any fallback content 138 * will be used. 139 */ 140 public enum PluginState { 141 ON, 142 ON_DEMAND, 143 OFF 144 } 145 146 /** 147 * Hidden constructor to prevent clients from creating a new settings 148 * instance or deriving the class. 149 * @hide 150 */ 151 protected WebSettings() { 152 } 153 154 /** 155 * Enables dumping the pages navigation cache to a text file. 156 * @deprecated This method is now obsolete. 157 */ 158 @Deprecated 159 public void setNavDump(boolean enabled) { 160 throw new MustOverrideException(); 161 } 162 163 /** 164 * Returns true if dumping the navigation cache is enabled. 165 * @deprecated This method is now obsolete. 166 */ 167 @Deprecated 168 public boolean getNavDump() { 169 throw new MustOverrideException(); 170 } 171 172 /** 173 * Sets whether the WebView should support zooming using its on-screen zoom 174 * controls and gestures. The particular zoom mechanisms that should be used 175 * can be set with {@link #setBuiltInZoomControls}. This setting does not 176 * affect zooming performed using the {@link WebView#zoomIn()} and 177 * {@link WebView#zoomOut()} methods. 178 * @param support Whether the WebView should support zoom. 179 */ 180 public void setSupportZoom(boolean support) { 181 throw new MustOverrideException(); 182 } 183 184 /** 185 * Returns true if the WebView supports zoom. The default is true. 186 * @return True if the WebView supports zoom. 187 */ 188 public boolean supportZoom() { 189 throw new MustOverrideException(); 190 } 191 192 /** 193 * Sets whether the WebView should use its built-in zoom mechanisms. The 194 * built-in zoom mechanisms comprise on-screen zoom controls, which are 195 * displayed over the WebView's content, and the use of a pinch gesture to 196 * control zooming. Whether or not these on-screen controls are displayed 197 * can be set with {@link #setDisplayZoomControls}. 198 * <p> 199 * The built-in mechanisms are the only currently supported zoom 200 * mechanisms, so it is recommended that this setting is always enabled. 201 * @param enabled Whether the WebView should use its built-in zoom mechanisms. 202 */ 203 // This method was intended to select between the built-in zoom mechanisms 204 // and the separate zoom controls. The latter were obtained using 205 // {@link WebView#getZoomControls}, which is now hidden. 206 public void setBuiltInZoomControls(boolean enabled) { 207 throw new MustOverrideException(); 208 } 209 210 /** 211 * Returns true if the zoom mechanisms built into WebView are being used. 212 * The default is false. 213 * @return True if the zoom mechanisms built into WebView are being used. 214 */ 215 public boolean getBuiltInZoomControls() { 216 throw new MustOverrideException(); 217 } 218 219 /** 220 * Sets whether the WebView should display on-screen zoom controls when 221 * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}. 222 * @param enabled Whether the WebView should display on-screen zoom controls. 223 */ 224 public void setDisplayZoomControls(boolean enabled) { 225 throw new MustOverrideException(); 226 } 227 228 /** 229 * Returns true if the WebView displays on-screen zoom controls when using 230 * the built-in zoom mechanisms. The default is true. 231 * @return True if the WebView displays on-screen zoom controls when using 232 * the built-in zoom mechanisms. 233 */ 234 public boolean getDisplayZoomControls() { 235 throw new MustOverrideException(); 236 } 237 238 /** 239 * Enable or disable file access within WebView. File access is enabled by 240 * default. Note that this enables or disables file system access only. 241 * Assets and resources are still accessible using file:///android_asset and 242 * file:///android_res. 243 */ 244 public void setAllowFileAccess(boolean allow) { 245 throw new MustOverrideException(); 246 } 247 248 /** 249 * Returns true if this WebView supports file access. 250 */ 251 public boolean getAllowFileAccess() { 252 throw new MustOverrideException(); 253 } 254 255 /** 256 * Enable or disable content url access within WebView. Content url access 257 * allows WebView to load content from a content provider installed in the 258 * system. The default is enabled. 259 */ 260 public void setAllowContentAccess(boolean allow) { 261 throw new MustOverrideException(); 262 } 263 264 /** 265 * Returns true if this WebView supports content url access. 266 */ 267 public boolean getAllowContentAccess() { 268 throw new MustOverrideException(); 269 } 270 271 /** 272 * Set whether the WebView loads a page with overview mode. 273 */ 274 public void setLoadWithOverviewMode(boolean overview) { 275 throw new MustOverrideException(); 276 } 277 278 /** 279 * Returns true if this WebView loads page with overview mode 280 */ 281 public boolean getLoadWithOverviewMode() { 282 throw new MustOverrideException(); 283 } 284 285 /** 286 * Set whether the WebView will enable smooth transition while panning or 287 * zooming or while the window hosting the WebView does not have focus. 288 * If it is true, WebView will choose a solution to maximize the performance. 289 * e.g. the WebView's content may not be updated during the transition. 290 * If it is false, WebView will keep its fidelity. The default value is false. 291 */ 292 public void setEnableSmoothTransition(boolean enable) { 293 throw new MustOverrideException(); 294 } 295 /** 296 * Returns true if the WebView enables smooth transition while panning or 297 * zooming. 298 */ 299 public boolean enableSmoothTransition() { 300 throw new MustOverrideException(); 301 } 302 303 /** 304 * Set whether the WebView uses its background for over scroll background. 305 * If true, it will use the WebView's background. If false, it will use an 306 * internal pattern. Default is true. 307 * @deprecated This method is now obsolete. 308 */ 309 @Deprecated 310 public void setUseWebViewBackgroundForOverscrollBackground(boolean view) { 311 throw new MustOverrideException(); 312 } 313 314 /** 315 * Returns true if this WebView uses WebView's background instead of 316 * internal pattern for over scroll background. 317 * @deprecated This method is now obsolete. 318 */ 319 @Deprecated 320 public boolean getUseWebViewBackgroundForOverscrollBackground() { 321 throw new MustOverrideException(); 322 } 323 324 /** 325 * Store whether the WebView is saving form data. 326 */ 327 public void setSaveFormData(boolean save) { 328 throw new MustOverrideException(); 329 } 330 331 /** 332 * Return whether the WebView is saving form data and displaying prior 333 * entries/autofill++. Always false in private browsing mode. 334 */ 335 public boolean getSaveFormData() { 336 throw new MustOverrideException(); 337 } 338 339 /** 340 * Store whether the WebView is saving password. 341 */ 342 public void setSavePassword(boolean save) { 343 throw new MustOverrideException(); 344 } 345 346 /** 347 * Return whether the WebView is saving password. 348 */ 349 public boolean getSavePassword() { 350 throw new MustOverrideException(); 351 } 352 353 /** 354 * Set the text zoom of the page in percent. Default is 100. 355 * @param textZoom A percent value for increasing or decreasing the text. 356 */ 357 public synchronized void setTextZoom(int textZoom) { 358 throw new MustOverrideException(); 359 } 360 361 /** 362 * Get the text zoom of the page in percent. 363 * @return A percent value describing the text zoom. 364 * @see setTextSizeZoom 365 */ 366 public synchronized int getTextZoom() { 367 throw new MustOverrideException(); 368 } 369 370 /** 371 * Set the text size of the page. 372 * @param t A TextSize value for increasing or decreasing the text. 373 * @see WebSettings.TextSize 374 * @deprecated Use {@link #setTextZoom(int)} instead 375 */ 376 public synchronized void setTextSize(TextSize t) { 377 throw new MustOverrideException(); 378 } 379 380 /** 381 * Get the text size of the page. If the text size was previously specified 382 * in percent using {@link #setTextZoom(int)}, this will return 383 * the closest matching {@link TextSize}. 384 * @return A TextSize enum value describing the text size. 385 * @see WebSettings.TextSize 386 * @deprecated Use {@link #getTextZoom()} instead 387 */ 388 public synchronized TextSize getTextSize() { 389 throw new MustOverrideException(); 390 } 391 392 /** 393 * Set the default zoom density of the page. This should be called from UI 394 * thread. 395 * @param zoom A ZoomDensity value 396 * @see WebSettings.ZoomDensity 397 */ 398 public void setDefaultZoom(ZoomDensity zoom) { 399 throw new MustOverrideException(); 400 } 401 402 /** 403 * Get the default zoom density of the page. This should be called from UI 404 * thread. 405 * @return A ZoomDensity value 406 * @see WebSettings.ZoomDensity 407 */ 408 public ZoomDensity getDefaultZoom() { 409 throw new MustOverrideException(); 410 } 411 412 /** 413 * Enables using light touches to make a selection and activate mouseovers. 414 */ 415 public void setLightTouchEnabled(boolean enabled) { 416 throw new MustOverrideException(); 417 } 418 419 /** 420 * Returns true if light touches are enabled. 421 */ 422 public boolean getLightTouchEnabled() { 423 throw new MustOverrideException(); 424 } 425 426 /** 427 * @deprecated This setting controlled a rendering optimization 428 * that is no longer present. Setting it now has no effect. 429 */ 430 @Deprecated 431 public synchronized void setUseDoubleTree(boolean use) { 432 // Specified to do nothing, so no need for derived classes to override. 433 } 434 435 /** 436 * @deprecated This setting controlled a rendering optimization 437 * that is no longer present. Setting it now has no effect. 438 */ 439 @Deprecated 440 public synchronized boolean getUseDoubleTree() { 441 // Returns false unconditionally, so no need for derived classes to override. 442 return false; 443 } 444 445 /** 446 * Tell the WebView about user-agent string. 447 * @param ua 0 if the WebView should use an Android user-agent string, 448 * 1 if the WebView should use a desktop user-agent string. 449 * 450 * @deprecated Please use setUserAgentString instead. 451 */ 452 @Deprecated 453 public synchronized void setUserAgent(int ua) { 454 throw new MustOverrideException(); 455 } 456 457 /** 458 * Return user-agent as int 459 * @return int 0 if the WebView is using an Android user-agent string. 460 * 1 if the WebView is using a desktop user-agent string. 461 * -1 if the WebView is using user defined user-agent string. 462 * 463 * @deprecated Please use getUserAgentString instead. 464 */ 465 @Deprecated 466 public synchronized int getUserAgent() { 467 throw new MustOverrideException(); 468 } 469 470 /** 471 * Tell the WebView to use the wide viewport 472 */ 473 public synchronized void setUseWideViewPort(boolean use) { 474 throw new MustOverrideException(); 475 } 476 477 /** 478 * @return True if the WebView is using a wide viewport 479 */ 480 public synchronized boolean getUseWideViewPort() { 481 throw new MustOverrideException(); 482 } 483 484 /** 485 * Tell the WebView whether it supports multiple windows. TRUE means 486 * that {@link WebChromeClient#onCreateWindow(WebView, boolean, 487 * boolean, Message)} is implemented by the host application. 488 */ 489 public synchronized void setSupportMultipleWindows(boolean support) { 490 throw new MustOverrideException(); 491 } 492 493 /** 494 * @return True if the WebView is supporting multiple windows. This means 495 * that {@link WebChromeClient#onCreateWindow(WebView, boolean, 496 * boolean, Message)} is implemented by the host application. 497 */ 498 public synchronized boolean supportMultipleWindows() { 499 throw new MustOverrideException(); 500 } 501 502 /** 503 * Set the underlying layout algorithm. This will cause a relayout of the 504 * WebView. 505 * @param l A LayoutAlgorithm enum specifying the algorithm to use. 506 * @see WebSettings.LayoutAlgorithm 507 */ 508 public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) { 509 throw new MustOverrideException(); 510 } 511 512 /** 513 * Return the current layout algorithm. The default is NARROW_COLUMNS. 514 * @return LayoutAlgorithm enum value describing the layout algorithm 515 * being used. 516 * @see WebSettings.LayoutAlgorithm 517 */ 518 public synchronized LayoutAlgorithm getLayoutAlgorithm() { 519 throw new MustOverrideException(); 520 } 521 522 /** 523 * Set the standard font family name. 524 * @param font A font family name. 525 */ 526 public synchronized void setStandardFontFamily(String font) { 527 throw new MustOverrideException(); 528 } 529 530 /** 531 * Get the standard font family name. The default is "sans-serif". 532 * @return The standard font family name as a string. 533 */ 534 public synchronized String getStandardFontFamily() { 535 throw new MustOverrideException(); 536 } 537 538 /** 539 * Set the fixed font family name. 540 * @param font A font family name. 541 */ 542 public synchronized void setFixedFontFamily(String font) { 543 throw new MustOverrideException(); 544 } 545 546 /** 547 * Get the fixed font family name. The default is "monospace". 548 * @return The fixed font family name as a string. 549 */ 550 public synchronized String getFixedFontFamily() { 551 throw new MustOverrideException(); 552 } 553 554 /** 555 * Set the sans-serif font family name. 556 * @param font A font family name. 557 */ 558 public synchronized void setSansSerifFontFamily(String font) { 559 throw new MustOverrideException(); 560 } 561 562 /** 563 * Get the sans-serif font family name. 564 * @return The sans-serif font family name as a string. 565 */ 566 public synchronized String getSansSerifFontFamily() { 567 throw new MustOverrideException(); 568 } 569 570 /** 571 * Set the serif font family name. The default is "sans-serif". 572 * @param font A font family name. 573 */ 574 public synchronized void setSerifFontFamily(String font) { 575 throw new MustOverrideException(); 576 } 577 578 /** 579 * Get the serif font family name. The default is "serif". 580 * @return The serif font family name as a string. 581 */ 582 public synchronized String getSerifFontFamily() { 583 throw new MustOverrideException(); 584 } 585 586 /** 587 * Set the cursive font family name. 588 * @param font A font family name. 589 */ 590 public synchronized void setCursiveFontFamily(String font) { 591 throw new MustOverrideException(); 592 } 593 594 /** 595 * Get the cursive font family name. The default is "cursive". 596 * @return The cursive font family name as a string. 597 */ 598 public synchronized String getCursiveFontFamily() { 599 throw new MustOverrideException(); 600 } 601 602 /** 603 * Set the fantasy font family name. 604 * @param font A font family name. 605 */ 606 public synchronized void setFantasyFontFamily(String font) { 607 throw new MustOverrideException(); 608 } 609 610 /** 611 * Get the fantasy font family name. The default is "fantasy". 612 * @return The fantasy font family name as a string. 613 */ 614 public synchronized String getFantasyFontFamily() { 615 throw new MustOverrideException(); 616 } 617 618 /** 619 * Set the minimum font size. 620 * @param size A non-negative integer between 1 and 72. 621 * Any number outside the specified range will be pinned. 622 */ 623 public synchronized void setMinimumFontSize(int size) { 624 throw new MustOverrideException(); 625 } 626 627 /** 628 * Get the minimum font size. The default is 8. 629 * @return A non-negative integer between 1 and 72. 630 */ 631 public synchronized int getMinimumFontSize() { 632 throw new MustOverrideException(); 633 } 634 635 /** 636 * Set the minimum logical font size. 637 * @param size A non-negative integer between 1 and 72. 638 * Any number outside the specified range will be pinned. 639 */ 640 public synchronized void setMinimumLogicalFontSize(int size) { 641 throw new MustOverrideException(); 642 } 643 644 /** 645 * Get the minimum logical font size. The default is 8. 646 * @return A non-negative integer between 1 and 72. 647 */ 648 public synchronized int getMinimumLogicalFontSize() { 649 throw new MustOverrideException(); 650 } 651 652 /** 653 * Set the default font size. 654 * @param size A non-negative integer between 1 and 72. 655 * Any number outside the specified range will be pinned. 656 */ 657 public synchronized void setDefaultFontSize(int size) { 658 throw new MustOverrideException(); 659 } 660 661 /** 662 * Get the default font size. The default is 16. 663 * @return A non-negative integer between 1 and 72. 664 */ 665 public synchronized int getDefaultFontSize() { 666 throw new MustOverrideException(); 667 } 668 669 /** 670 * Set the default fixed font size. 671 * @param size A non-negative integer between 1 and 72. 672 * Any number outside the specified range will be pinned. 673 */ 674 public synchronized void setDefaultFixedFontSize(int size) { 675 throw new MustOverrideException(); 676 } 677 678 /** 679 * Get the default fixed font size. The default is 16. 680 * @return A non-negative integer between 1 and 72. 681 */ 682 public synchronized int getDefaultFixedFontSize() { 683 throw new MustOverrideException(); 684 } 685 686 /** 687 * Sets whether the WebView should load image resources. Note that this method 688 * controls loading of all images, including those embedded using the data 689 * URI scheme. Use {@link #setBlockNetworkImage} to control loading only 690 * of images specified using network URI schemes. Note that if the value of this 691 * setting is changed from false to true, all images resources referenced 692 * by content currently displayed by the WebView are loaded automatically. 693 * @param flag Whether the WebView should load image resources. 694 */ 695 public synchronized void setLoadsImagesAutomatically(boolean flag) { 696 throw new MustOverrideException(); 697 } 698 699 /** 700 * Returns true if the WebView loads image resources. This includes 701 * images embedded using the data URI scheme. The default is true. 702 * @return True if the WebView loads image resources. 703 */ 704 public synchronized boolean getLoadsImagesAutomatically() { 705 throw new MustOverrideException(); 706 } 707 708 /** 709 * Sets whether the WebView should not load image resources from the 710 * network (resources accessed via http and https URI schemes). Note 711 * that this method has no effect unless 712 * {@link #getLoadsImagesAutomatically} returns true. Also note that 713 * disabling all network loads using {@link #setBlockNetworkLoads} 714 * will also prevent network images from loading, even if this flag is set 715 * to false. When the value of this setting is changed from true to false, 716 * network images resources referenced by content currently displayed by 717 * the WebView are fetched automatically. 718 * @param flag Whether the WebView should not load image resources from 719 * the network. 720 * @see #setBlockNetworkLoads 721 */ 722 public synchronized void setBlockNetworkImage(boolean flag) { 723 throw new MustOverrideException(); 724 } 725 726 /** 727 * Returns true if the WebView does not load image resources from the network. 728 * The default is false. 729 * @return True if the WebView does not load image resources from the network. 730 */ 731 public synchronized boolean getBlockNetworkImage() { 732 throw new MustOverrideException(); 733 } 734 735 /** 736 * Sets whether the WebView should not load resources from the network. 737 * Use {@link #setBlockNetworkImage} to only avoid loading 738 * image resources. Note that if the value of this setting is 739 * changed from true to false, network resources referenced by content 740 * currently displayed by the WebView are not fetched until 741 * {@link android.webkit.WebView#reload} is called. 742 * If the application does not have the 743 * {@link android.Manifest.permission#INTERNET} permission, attempts to set 744 * a value of false will cause a {@link java.lang.SecurityException} 745 * to be thrown. 746 * @param flag Whether the WebView should not load any resources 747 * from the network. 748 * @see android.webkit.WebView#reload 749 */ 750 public synchronized void setBlockNetworkLoads(boolean flag) { 751 throw new MustOverrideException(); 752 } 753 754 /** 755 * Returns true if the WebView does not load any resources from the network. 756 * The default value is false if the application has the 757 * {@link android.Manifest.permission#INTERNET} permission, otherwise it is 758 * true. 759 * @return True if the WebView does not load any resources from the network. 760 */ 761 public synchronized boolean getBlockNetworkLoads() { 762 throw new MustOverrideException(); 763 } 764 765 /** 766 * Tell the WebView to enable javascript execution. 767 * @param flag True if the WebView should execute javascript. 768 */ 769 public synchronized void setJavaScriptEnabled(boolean flag) { 770 throw new MustOverrideException(); 771 } 772 773 /** 774 * Tell the WebView to enable plugins. 775 * @param flag True if the WebView should load plugins. 776 * @deprecated This method has been deprecated in favor of 777 * {@link #setPluginState} 778 */ 779 @Deprecated 780 public synchronized void setPluginsEnabled(boolean flag) { 781 throw new MustOverrideException(); 782 } 783 784 /** 785 * Tell the WebView to enable, disable, or have plugins on demand. On 786 * demand mode means that if a plugin exists that can handle the embedded 787 * content, a placeholder icon will be shown instead of the plugin. When 788 * the placeholder is clicked, the plugin will be enabled. 789 * @param state One of the PluginState values. 790 */ 791 public synchronized void setPluginState(PluginState state) { 792 throw new MustOverrideException(); 793 } 794 795 /** 796 * Set a custom path to plugins used by the WebView. This method is 797 * obsolete since each plugin is now loaded from its own package. 798 * @param pluginsPath String path to the directory containing plugins. 799 * @deprecated This method is no longer used as plugins are loaded from 800 * their own APK via the system's package manager. 801 */ 802 @Deprecated 803 public synchronized void setPluginsPath(String pluginsPath) { 804 // Specified to do nothing, so no need for derived classes to override. 805 } 806 807 /** 808 * Set the path to where database storage API databases should be saved. 809 * Nota that the WebCore Database Tracker only allows the path to be set once. 810 * This will update WebCore when the Sync runs in the C++ side. 811 * @param databasePath String path to the directory where databases should 812 * be saved. May be the empty string but should never be null. 813 */ 814 public synchronized void setDatabasePath(String databasePath) { 815 throw new MustOverrideException(); 816 } 817 818 /** 819 * Set the path where the Geolocation permissions database should be saved. 820 * This will update WebCore when the Sync runs in the C++ side. 821 * @param databasePath String path to the directory where the Geolocation 822 * permissions database should be saved. May be the empty string but 823 * should never be null. 824 */ 825 public synchronized void setGeolocationDatabasePath(String databasePath) { 826 throw new MustOverrideException(); 827 } 828 829 /** 830 * Tell the WebView to enable Application Caches API. 831 * @param flag True if the WebView should enable Application Caches. 832 */ 833 public synchronized void setAppCacheEnabled(boolean flag) { 834 throw new MustOverrideException(); 835 } 836 837 /** 838 * Set a custom path to the Application Caches files. The client 839 * must ensure it exists before this call. 840 * @param appCachePath String path to the directory containing Application 841 * Caches files. The appCache path can be the empty string but should not 842 * be null. Passing null for this parameter will result in a no-op. 843 */ 844 public synchronized void setAppCachePath(String appCachePath) { 845 throw new MustOverrideException(); 846 } 847 848 /** 849 * Set the maximum size for the Application Caches content. 850 * @param appCacheMaxSize the maximum size in bytes. 851 */ 852 public synchronized void setAppCacheMaxSize(long appCacheMaxSize) { 853 throw new MustOverrideException(); 854 } 855 856 /** 857 * Set whether the database storage API is enabled. 858 * @param flag boolean True if the WebView should use the database storage 859 * API. 860 */ 861 public synchronized void setDatabaseEnabled(boolean flag) { 862 throw new MustOverrideException(); 863 } 864 865 /** 866 * Set whether the DOM storage API is enabled. 867 * @param flag boolean True if the WebView should use the DOM storage 868 * API. 869 */ 870 public synchronized void setDomStorageEnabled(boolean flag) { 871 throw new MustOverrideException(); 872 } 873 874 /** 875 * Returns true if the DOM Storage API's are enabled. 876 * @return True if the DOM Storage API's are enabled. 877 */ 878 public synchronized boolean getDomStorageEnabled() { 879 throw new MustOverrideException(); 880 } 881 /** 882 * Return the path to where database storage API databases are saved for 883 * the current WebView. 884 * @return the String path to the database storage API databases. 885 */ 886 public synchronized String getDatabasePath() { 887 throw new MustOverrideException(); 888 } 889 890 /** 891 * Returns true if database storage API is enabled. 892 * @return True if the database storage API is enabled. 893 */ 894 public synchronized boolean getDatabaseEnabled() { 895 throw new MustOverrideException(); 896 } 897 898 /** 899 * Sets whether Geolocation is enabled. 900 * @param flag Whether Geolocation should be enabled. 901 */ 902 public synchronized void setGeolocationEnabled(boolean flag) { 903 throw new MustOverrideException(); 904 } 905 906 /** 907 * Return true if javascript is enabled. <b>Note: The default is false.</b> 908 * @return True if javascript is enabled. 909 */ 910 public synchronized boolean getJavaScriptEnabled() { 911 throw new MustOverrideException(); 912 } 913 914 /** 915 * Return true if plugins are enabled. 916 * @return True if plugins are enabled. 917 * @deprecated This method has been replaced by {@link #getPluginState} 918 */ 919 @Deprecated 920 public synchronized boolean getPluginsEnabled() { 921 throw new MustOverrideException(); 922 } 923 924 /** 925 * Return the current plugin state. 926 * @return A value corresponding to the enum PluginState. 927 */ 928 public synchronized PluginState getPluginState() { 929 throw new MustOverrideException(); 930 } 931 932 /** 933 * Returns the directory that contains the plugin libraries. This method is 934 * obsolete since each plugin is now loaded from its own package. 935 * @return An empty string. 936 * @deprecated This method is no longer used as plugins are loaded from 937 * their own APK via the system's package manager. 938 */ 939 @Deprecated 940 public synchronized String getPluginsPath() { 941 // Unconditionally returns empty string, so no need for derived classes to override. 942 return ""; 943 } 944 945 /** 946 * Tell javascript to open windows automatically. This applies to the 947 * javascript function window.open(). 948 * @param flag True if javascript can open windows automatically. 949 */ 950 public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) { 951 throw new MustOverrideException(); 952 } 953 954 /** 955 * Return true if javascript can open windows automatically. The default 956 * is false. 957 * @return True if javascript can open windows automatically during 958 * window.open(). 959 */ 960 public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() { 961 throw new MustOverrideException(); 962 } 963 /** 964 * Set the default text encoding name to use when decoding html pages. 965 * @param encoding The text encoding name. 966 */ 967 public synchronized void setDefaultTextEncodingName(String encoding) { 968 throw new MustOverrideException(); 969 } 970 971 /** 972 * Get the default text encoding name. The default is "Latin-1". 973 * @return The default text encoding name as a string. 974 */ 975 public synchronized String getDefaultTextEncodingName() { 976 throw new MustOverrideException(); 977 } 978 979 /** 980 * Set the WebView's user-agent string. If the string "ua" is null or empty, 981 * it will use the system default user-agent string. 982 */ 983 public synchronized void setUserAgentString(String ua) { 984 throw new MustOverrideException(); 985 } 986 987 /** 988 * Return the WebView's user-agent string. 989 */ 990 public synchronized String getUserAgentString() { 991 throw new MustOverrideException(); 992 } 993 994 /** 995 * Tell the WebView whether it needs to set a node to have focus when 996 * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. 997 * 998 * @param flag 999 */ 1000 public void setNeedInitialFocus(boolean flag) { 1001 throw new MustOverrideException(); 1002 } 1003 1004 /** 1005 * Set the priority of the Render thread. Unlike the other settings, this 1006 * one only needs to be called once per process. The default is NORMAL. 1007 * 1008 * @param priority RenderPriority, can be normal, high or low. 1009 */ 1010 public synchronized void setRenderPriority(RenderPriority priority) { 1011 throw new MustOverrideException(); 1012 } 1013 1014 /** 1015 * Override the way the cache is used. The way the cache is used is based 1016 * on the navigation option. For a normal page load, the cache is checked 1017 * and content is re-validated as needed. When navigating back, content is 1018 * not revalidated, instead the content is just pulled from the cache. 1019 * This function allows the client to override this behavior. 1020 * @param mode One of the LOAD_ values. 1021 */ 1022 public void setCacheMode(int mode) { 1023 throw new MustOverrideException(); 1024 } 1025 1026 /** 1027 * Return the current setting for overriding the cache mode. For a full 1028 * description, see the {@link #setCacheMode(int)} function. 1029 */ 1030 public int getCacheMode() { 1031 throw new MustOverrideException(); 1032 } 1033} 1034