Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(880)

Side by Side Diff: chrome/browser/browser.cc

Issue 67156: Fix regression I introduced where Stop/Go button would toggle state instantly... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/idle_timer.h" 8 #include "base/idle_timer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 window_->GetLocationBar()->SaveStateToContents(old_contents); 1577 window_->GetLocationBar()->SaveStateToContents(old_contents);
1578 #else 1578 #else
1579 NOTIMPLEMENTED(); 1579 NOTIMPLEMENTED();
1580 #endif 1580 #endif
1581 } 1581 }
1582 1582
1583 // Propagate the profile to the location bar. 1583 // Propagate the profile to the location bar.
1584 UpdateToolbar(true); 1584 UpdateToolbar(true);
1585 1585
1586 // Update stop/go state. 1586 // Update stop/go state.
1587 UpdateStopGoState(new_contents->is_loading()); 1587 UpdateStopGoState(new_contents->is_loading(), true);
1588 1588
1589 // Update commands to reflect current state. 1589 // Update commands to reflect current state.
1590 UpdateCommandsForTabState(); 1590 UpdateCommandsForTabState();
1591 1591
1592 // Reset the status bubble. 1592 // Reset the status bubble.
1593 StatusBubble* status_bubble = GetStatusBubble(); 1593 StatusBubble* status_bubble = GetStatusBubble();
1594 if (status_bubble) { 1594 if (status_bubble) {
1595 status_bubble->Hide(); 1595 status_bubble->Hide();
1596 1596
1597 // Show the loading state (if any). 1597 // Show the loading state (if any).
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 tabstrip_model_.SelectTabContentsAt( 1829 tabstrip_model_.SelectTabContentsAt(
1830 tabstrip_model_.GetIndexOfTabContents(contents), false); 1830 tabstrip_model_.GetIndexOfTabContents(contents), false);
1831 window_->Activate(); 1831 window_->Activate();
1832 } 1832 }
1833 1833
1834 void Browser::LoadingStateChanged(TabContents* source) { 1834 void Browser::LoadingStateChanged(TabContents* source) {
1835 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading()); 1835 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading());
1836 window_->UpdateTitleBar(); 1836 window_->UpdateTitleBar();
1837 1837
1838 if (source == GetSelectedTabContents()) { 1838 if (source == GetSelectedTabContents()) {
1839 UpdateStopGoState(source->is_loading()); 1839 UpdateStopGoState(source->is_loading(), false);
1840 if (GetStatusBubble()) 1840 if (GetStatusBubble())
1841 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); 1841 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText());
1842 } 1842 }
1843 } 1843 }
1844 1844
1845 void Browser::CloseContents(TabContents* source) { 1845 void Browser::CloseContents(TabContents* source) {
1846 if (is_attempting_to_close_browser_) { 1846 if (is_attempting_to_close_browser_) {
1847 // If we're trying to close the browser, just clear the state related to 1847 // If we're trying to close the browser, just clear the state related to
1848 // waiting for unload to fire. Don't actually try to close the tab as it 1848 // waiting for unload to fire. Don't actually try to close the tab as it
1849 // will go down the slow shutdown path instead of the fast path of killing 1849 // will go down the slow shutdown path instead of the fast path of killing
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); 2242 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui);
2243 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); 2243 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui);
2244 command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, show_main_ui); 2244 command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, show_main_ui);
2245 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); 2245 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui);
2246 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); 2246 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui);
2247 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); 2247 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui);
2248 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); 2248 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui);
2249 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); 2249 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui);
2250 } 2250 }
2251 2251
2252 void Browser::UpdateStopGoState(bool is_loading) { 2252 void Browser::UpdateStopGoState(bool is_loading, bool force) {
2253 window_->UpdateStopGoState(is_loading); 2253 window_->UpdateStopGoState(is_loading, force);
2254 command_updater_.UpdateCommandEnabled(IDC_GO, !is_loading); 2254 command_updater_.UpdateCommandEnabled(IDC_GO, !is_loading);
2255 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); 2255 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading);
2256 } 2256 }
2257 2257
2258 2258
2259 /////////////////////////////////////////////////////////////////////////////// 2259 ///////////////////////////////////////////////////////////////////////////////
2260 // Browser, UI update coalescing and handling (private): 2260 // Browser, UI update coalescing and handling (private):
2261 2261
2262 void Browser::UpdateToolbar(bool should_restore_state) { 2262 void Browser::UpdateToolbar(bool should_restore_state) {
2263 window_->UpdateToolbar(GetSelectedTabContents(), should_restore_state); 2263 window_->UpdateToolbar(GetSelectedTabContents(), should_restore_state);
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 2648
2649 // We need to register the window position pref. 2649 // We need to register the window position pref.
2650 std::wstring window_pref(prefs::kBrowserWindowPlacement); 2650 std::wstring window_pref(prefs::kBrowserWindowPlacement);
2651 window_pref.append(L"_"); 2651 window_pref.append(L"_");
2652 window_pref.append(app_name); 2652 window_pref.append(app_name);
2653 PrefService* prefs = g_browser_process->local_state(); 2653 PrefService* prefs = g_browser_process->local_state();
2654 DCHECK(prefs); 2654 DCHECK(prefs);
2655 2655
2656 prefs->RegisterDictionaryPref(window_pref.c_str()); 2656 prefs->RegisterDictionaryPref(window_pref.c_str());
2657 } 2657 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698