summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-17 01:08:33 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-17 01:08:33 +0000
commit0daf947343b0053b9a4361a6a2b37a0cad5fc032 (patch)
tree7396b31232ee9842d1ac3bb466379fb9ad4d51fe /chrome
parent300256b1ba6f740cafb6b15e3347f7aca0a06148 (diff)
downloadchromium_src-0daf947343b0053b9a4361a6a2b37a0cad5fc032.zip
chromium_src-0daf947343b0053b9a4361a6a2b37a0cad5fc032.tar.gz
chromium_src-0daf947343b0053b9a4361a6a2b37a0cad5fc032.tar.bz2
Make stop work again (I broke it). Rather than revert to the previous working-but-lame code, this cleans up the code a little further by actually enabling/disabling the stop command at the right times.
BUG=5542 Review URL: http://codereview.chromium.org/14498 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 34160db..ea85e3b 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -307,11 +307,6 @@ bool Browser::IsCommandEnabled(int id) const {
if (!GetSelectedTabContents())
return false;
- // TODO(pkasting): Should maybe enable/disable this in
- // NavigationStateChanged()?
- if (id == IDC_STOP)
- return IsCurrentPageLoading();
-
return controller_.IsCommandEnabled(id);
}
@@ -632,7 +627,7 @@ void Browser::Go() {
void Browser::Stop() {
UserMetrics::RecordAction(L"Stop", profile_);
- GetSelectedTabContents()->AsWebContents()->Stop();
+ GetSelectedTabContents()->Stop();
}
void Browser::NewWindow() {
@@ -1429,12 +1424,13 @@ void Browser::TabSelectedAt(TabContents* old_contents,
UpdateToolbar(true);
// Force the go/stop button to change.
- GetGoButton()->ChangeMode(
- (new_contents->AsWebContents() && new_contents->is_loading()) ?
+ bool is_loading = new_contents->is_loading();
+ GetGoButton()->ChangeMode(is_loading ?
GoButton::MODE_STOP : GoButton::MODE_GO);
// Update commands to reflect current state.
UpdateCommandsForTabState();
+ controller_.UpdateCommandEnabled(IDC_STOP, is_loading);
// Reset the status bubble.
GetStatusBubble()->Hide();
@@ -1686,10 +1682,13 @@ void Browser::LoadingStateChanged(TabContents* source) {
window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading());
window_->UpdateTitleBar();
- // Let the go button know that it should change appearance if possible.
if (source == GetSelectedTabContents()) {
- GetGoButton()->ScheduleChangeMode(
- source->is_loading() ? GoButton::MODE_STOP : GoButton::MODE_GO);
+ // Let the go button know that it should change appearance if possible.
+ bool is_loading = source->is_loading();
+ GetGoButton()->ScheduleChangeMode(is_loading ?
+ GoButton::MODE_STOP : GoButton::MODE_GO);
+
+ controller_.UpdateCommandEnabled(IDC_STOP, is_loading);
GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText());
}