+ /**
+ * Load the URL into the given WebView and update the title bar
+ * to reflect the new load. Call this instead of WebView.loadUrl
+ * directly.
+ * @param view The WebView used to load url.
+ * @param url The URL to load.
+ */
+ private void loadUrl(WebView view, String url) {
+ updateTitleBarForNewLoad(view, url);
+ view.loadUrl(url);
+ }
+
+ /**
+ * Load UrlData into a Tab and update the title bar to reflect the new
+ * load. Call this instead of UrlData.loadIn directly.
+ * @param t The Tab used to load.
+ * @param data The UrlData being loaded.
+ */
+ private void loadUrlDataIn(Tab t, UrlData data) {
+ updateTitleBarForNewLoad(t.getWebView(), data.mUrl);
+ data.loadIn(t);
+ }
+
+ /**
+ * If the WebView is the top window, update the title bar to reflect
+ * loading the new URL. i.e. set its text, clear the favicon (which
+ * will be set once the page begins loading), and set the progress to
+ * INITIAL_PROGRESS to show that the page has begun to load. Called
+ * by loadUrl and loadUrlDataIn.
+ * @param view The WebView that is starting a load.
+ * @param url The URL that is being loaded.
+ */
+ private void updateTitleBarForNewLoad(WebView view, String url) {
+ if (view == getTopWindow()) {
+ setUrlTitle(url, null);
+ setFavicon(null);
+ onProgressChanged(view, INITIAL_PROGRESS);
+ }
+ }
+