summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 10:51:16 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 10:51:16 +0000
commit1ccb3568d81cf47adf6f062067c186fdf43dd56d (patch)
treeb8200bd953cbc88db64a09cc8fb6f7eca7237088 /chrome/browser/browser.cc
parent0f0acb414b3e4ad3febc85bc3e6364a8b206ab76 (diff)
downloadchromium_src-1ccb3568d81cf47adf6f062067c186fdf43dd56d.zip
chromium_src-1ccb3568d81cf47adf6f062067c186fdf43dd56d.tar.gz
chromium_src-1ccb3568d81cf47adf6f062067c186fdf43dd56d.tar.bz2
linux: plumb shift-reload down into new shift-reload API
Currently Linux-only, but the Mac/Win bits should now be trivial. While I was add it, I tweaked a NavigationController function that took a bare boolean into an enum to make the call sites more explicit about what they're doing. (In most places I added new functions that call into a shared backing function; this is so I don't need to change every single caller of e.g. Reload() to pass through an extra flag that will be the same for almost every caller.) BUG=1906 TEST=visit astronomy picture of the day; hit reload, picture pops up quickly; hit shift-reload, picture loads slowly Review URL: http://codereview.chromium.org/594063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r--chrome/browser/browser.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index ac41f0b..c5608a8 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -824,7 +824,15 @@ void Browser::GoForward(WindowOpenDisposition disp) {
void Browser::Reload() {
UserMetrics::RecordAction("Reload", profile_);
+ ReloadInternal(false);
+}
+
+void Browser::ReloadIgnoringCache() {
+ UserMetrics::RecordAction("ReloadIgnoringCache", profile_);
+ ReloadInternal(true);
+}
+void Browser::ReloadInternal(bool ignore_cache) {
// If we are showing an interstitial, treat this as an OpenURL.
TabContents* current_tab = GetSelectedTabContents();
if (current_tab) {
@@ -838,7 +846,10 @@ void Browser::Reload() {
// As this is caused by a user action, give the focus to the page.
if (!current_tab->FocusLocationBarByDefault())
current_tab->Focus();
- current_tab->controller().Reload(true);
+ if (ignore_cache)
+ current_tab->controller().ReloadIgnoringCache(true);
+ else
+ current_tab->controller().Reload(true);
}
}
@@ -1469,6 +1480,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_BACK: GoBack(disposition); break;
case IDC_FORWARD: GoForward(disposition); break;
case IDC_RELOAD: Reload(); break;
+ case IDC_RELOAD_IGNORING_CACHE: ReloadIgnoringCache(); break;
case IDC_HOME: Home(disposition); break;
case IDC_OPEN_CURRENT_URL: OpenCurrentURL(); break;
case IDC_GO: Go(disposition); break;
@@ -2509,6 +2521,7 @@ void Browser::InitCommandState() {
// Navigation commands
command_updater_.UpdateCommandEnabled(IDC_RELOAD, true);
+ command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, true);
// Window management commands
command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW, true);
@@ -2700,6 +2713,8 @@ void Browser::UpdateCommandsForTabState() {
// Disable certain items if running DevTools
command_updater_.UpdateCommandEnabled(IDC_RELOAD,
CanReloadContents(current_tab));
+ command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
+ CanReloadContents(current_tab));
bool enabled_for_non_devtools = type() != TYPE_DEVTOOLS;
command_updater_.UpdateCommandEnabled(IDC_FIND, enabled_for_non_devtools);
command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT,