summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/browser/Controller.java36
-rw-r--r--src/com/android/browser/Tab.java4
2 files changed, 20 insertions, 20 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 2a57edf..e8ae21d 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -207,8 +207,6 @@ public class Controller
*/
private boolean mExtendedMenuOpen;
- private boolean mInLoad;
-
private boolean mActivityPaused = true;
private boolean mLoadStopped;
@@ -874,17 +872,16 @@ public class Controller
// when the main frame completes loading regardless of the state of
// any sub frames so calls to onProgressChanges may continue after
// onPageFinished has executed)
- if (mInLoad) {
- mInLoad = false;
- updateInLoadMenuItems(mCachedMenu);
+ if (tab.inPageLoad()) {
+ updateInLoadMenuItems(mCachedMenu, tab);
}
} else {
- if (!mInLoad) {
+ if (!tab.inPageLoad()) {
// onPageFinished may have already been called but a subframe is
- // still loading and updating the progress. Reset mInLoad and
+ // still loading
+ // updating the progress and
// update the menu items.
- mInLoad = true;
- updateInLoadMenuItems(mCachedMenu);
+ updateInLoadMenuItems(mCachedMenu, tab);
}
}
mUi.onProgressChanged(tab);
@@ -1423,12 +1420,12 @@ public class Controller
* we must manually update the state of the stop/reload menu
* item
*/
- private void updateInLoadMenuItems(Menu menu) {
+ private void updateInLoadMenuItems(Menu menu, Tab tab) {
if (menu == null) {
return;
}
MenuItem dest = menu.findItem(R.id.stop_reload_menu_id);
- MenuItem src = mInLoad ?
+ MenuItem src = tab.inPageLoad() ?
menu.findItem(R.id.stop_menu_id):
menu.findItem(R.id.reload_menu_id);
if (src != null) {
@@ -1438,7 +1435,7 @@ public class Controller
}
boolean onPrepareOptionsMenu(Menu menu) {
- updateInLoadMenuItems(menu);
+ updateInLoadMenuItems(menu, getCurrentTab());
// hold on to the menu reference here; it is used by the page callbacks
// to update the menu based on loading state
mCachedMenu = menu;
@@ -1489,7 +1486,8 @@ public class Controller
final MenuItem forward = menu.findItem(R.id.forward_menu_id);
forward.setEnabled(canGoForward);
- final MenuItem source = menu.findItem(mInLoad ? R.id.stop_menu_id : R.id.reload_menu_id);
+ final MenuItem source = menu.findItem(isInLoad() ? R.id.stop_menu_id
+ : R.id.reload_menu_id);
final MenuItem dest = menu.findItem(R.id.stop_reload_menu_id);
if (source != null && dest != null) {
dest.setTitle(source.getTitle());
@@ -1572,7 +1570,7 @@ public class Controller
break;
case R.id.stop_reload_menu_id:
- if (mInLoad) {
+ if (isInLoad()) {
stopLoading();
} else {
getCurrentTopWebView().reload();
@@ -1791,7 +1789,7 @@ public class Controller
// Switching the menu back to icon view, so show the
// title bar once again.
mExtendedMenuOpen = false;
- mUi.onExtendedMenuClosed(mInLoad);
+ mUi.onExtendedMenuClosed(isInLoad());
}
}
} else {
@@ -1806,11 +1804,11 @@ public class Controller
public void onOptionsMenuClosed(Menu menu) {
mOptionsMenuOpen = false;
- mUi.onOptionsMenuClosed(mInLoad);
+ mUi.onOptionsMenuClosed(isInLoad());
}
public void onContextMenuClosed(Menu menu) {
- mUi.onContextMenuClosed(menu, mInLoad);
+ mUi.onContextMenuClosed(menu, isInLoad());
}
// Helper method for getting the top window.
@@ -1873,12 +1871,12 @@ public class Controller
*/
public void onActionModeFinished(ActionMode mode) {
if (!isInCustomActionMode()) return;
- mUi.onActionModeFinished(mInLoad);
+ mUi.onActionModeFinished(isInLoad());
mActionMode = null;
}
boolean isInLoad() {
- return mInLoad;
+ return getCurrentTab().inPageLoad();
}
// bookmark handling
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index dd97960..0abc86b 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -619,7 +619,6 @@ class Tab implements PictureListener {
LogTag.logPageFinishedLoading(
url, SystemClock.uptimeMillis() - mLoadStartTime);
}
- mInPageLoad = false;
syncCurrentState(view, url);
mWebViewController.onPageFinished(Tab.this);
}
@@ -1044,6 +1043,9 @@ class Tab implements PictureListener {
@Override
public void onProgressChanged(WebView view, int newProgress) {
mPageLoadProgress = newProgress;
+ if (newProgress == 100) {
+ mInPageLoad = false;
+ }
mWebViewController.onProgressChanged(Tab.this);
}