WebContents.java revision 5f1c94371a64b3196d4be9466099bb892df9b88e
1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.content_public.browser; 6 7/** 8 * The WebContents Java wrapper to allow communicating with the native WebContents object. 9 */ 10public interface WebContents { 11 /** 12 * @return The navigation controller associated with this WebContents. 13 */ 14 NavigationController getNavigationController(); 15 16 /** 17 * @return The title for the current visible page. 18 */ 19 String getTitle(); 20 21 /** 22 * @return The URL for the current visible page. 23 */ 24 String getVisibleUrl(); 25 26 /** 27 * Stop any pending navigation. 28 */ 29 void stop(); 30 31 /** 32 * Inserts css into main frame's document. 33 */ 34 void insertCSS(String css); 35 /** 36 * To be called when the ContentView is hidden. 37 */ 38 public void onHide(); 39 40 /** 41 * To be called when the ContentView is shown. 42 */ 43 public void onShow(); 44 45 /** 46 * Get the Background color from underlying RenderWidgetHost for this WebContent. 47 */ 48 public int getBackgroundColor(); 49 50 /** 51 * Requests the renderer insert a link to the specified stylesheet in the 52 * main frame's document. 53 */ 54 void addStyleSheetByURL(String url); 55 56 /** 57 * Shows an interstitial page driven by the passed in delegate. 58 * 59 * @param url The URL being blocked by the interstitial. 60 * @param delegate The delegate handling the interstitial. 61 */ 62 public void showInterstitialPage( 63 String url, long interstitialPageDelegateAndroid); 64 65 /** 66 * @return Whether the page is currently showing an interstitial, such as a bad HTTPS page. 67 */ 68 public boolean isShowingInterstitialPage(); 69 70 /** 71 * If the view is ready to draw contents to the screen. In hardware mode, 72 * the initialization of the surface texture may not occur until after the 73 * view has been added to the layout. This method will return {@code true} 74 * once the texture is actually ready. 75 */ 76 public boolean isReady(); 77 78 /** 79 * Inform WebKit that Fullscreen mode has been exited by the user. 80 */ 81 public void exitFullscreen(); 82 83 /** 84 * Changes whether hiding the top controls is enabled. 85 * 86 * @param enableHiding Whether hiding the top controls should be enabled or not. 87 * @param enableShowing Whether showing the top controls should be enabled or not. 88 * @param animate Whether the transition should be animated or not. 89 */ 90 public void updateTopControlsState(boolean enableHiding, boolean enableShowing, 91 boolean animate); 92 93 /** 94 * Shows the IME if the focused widget could accept text input. 95 */ 96 public void showImeIfNeeded(); 97 98 /** 99 * Brings the Editable to the visible area while IME is up to make easier for inputing text. 100 */ 101 public void scrollFocusedEditableNodeIntoView(); 102 103 /** 104 * Selects the word around the caret, if any. 105 * The caller can check if selection actually occurred by listening to OnSelectionChanged. 106 */ 107 public void selectWordAroundCaret(); 108 109} 110