Ejemplo n.º 1
0
  /**
   * Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to make it
   * valid.
   *
   * @param url The URL to be loaded by the shell.
   */
  public void loadUrl(String url) {
    if (url == null) return;

    if (TextUtils.equals(url, mContentView.getUrl())) {
      mContentView.reload();
    } else {
      mContentView.loadUrl(new LoadUrlParams(sanitizeUrl(url)));
    }
    mUrlTextView.clearFocus();
  }
Ejemplo n.º 2
0
  /**
   * Navigates this Tab's {@link ContentView} to a sanitized version of {@code url}.
   *
   * @param url The potentially unsanitized URL to navigate to.
   */
  public void loadUrlWithSanitization(String url) {
    if (url == null) return;

    // Sanitize the URL.
    url = nativeFixupUrl(mNativeTabBaseAndroidImpl, url);

    // Invalid URLs will just return empty.
    if (TextUtils.isEmpty(url)) return;

    if (TextUtils.equals(url, mContentView.getUrl())) {
      mContentView.reload();
    } else {
      mContentView.loadUrl(new LoadUrlParams(url));
    }
  }