| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/reload_button.h" | 5 #include "chrome/browser/ui/views/reload_button.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/command_updater.h" | 9 #include "chrome/browser/command_updater.h" |
| 10 #include "chrome/browser/event_disposition.h" | 10 #include "chrome/browser/event_disposition.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (visible_mode_ == MODE_STOP) { | 114 if (visible_mode_ == MODE_STOP) { |
| 115 if (command_updater_) | 115 if (command_updater_) |
| 116 command_updater_->ExecuteCommandWithDisposition(IDC_STOP, CURRENT_TAB); | 116 command_updater_->ExecuteCommandWithDisposition(IDC_STOP, CURRENT_TAB); |
| 117 // The user has clicked, so we can feel free to update the button, | 117 // The user has clicked, so we can feel free to update the button, |
| 118 // even if the mouse is still hovering. | 118 // even if the mouse is still hovering. |
| 119 ChangeMode(MODE_RELOAD, true); | 119 ChangeMode(MODE_RELOAD, true); |
| 120 } else if (!double_click_timer_.IsRunning()) { | 120 } else if (!double_click_timer_.IsRunning()) { |
| 121 // Shift-clicking or ctrl-clicking the reload button means we should ignore | 121 // Shift-clicking or ctrl-clicking the reload button means we should ignore |
| 122 // any cached content. | 122 // any cached content. |
| 123 int command; | 123 int command; |
| 124 int flags = mouse_event_flags(); | 124 int flags = event.flags(); |
| 125 if (event.IsShiftDown() || event.IsControlDown()) { | 125 if (event.IsShiftDown() || event.IsControlDown()) { |
| 126 command = IDC_RELOAD_IGNORING_CACHE; | 126 command = IDC_RELOAD_IGNORING_CACHE; |
| 127 // Mask off Shift and Control so they don't affect the disposition below. | 127 // Mask off Shift and Control so they don't affect the disposition below. |
| 128 flags &= ~(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); | 128 flags &= ~(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); |
| 129 } else { | 129 } else { |
| 130 command = IDC_RELOAD; | 130 command = IDC_RELOAD; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Start a timer - while this timer is running, the reload button cannot be | 133 // Start a timer - while this timer is running, the reload button cannot be |
| 134 // changed to a stop button. We do not set |intended_mode_| to MODE_STOP | 134 // changed to a stop button. We do not set |intended_mode_| to MODE_STOP |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 void ReloadButton::OnDoubleClickTimer() { | 265 void ReloadButton::OnDoubleClickTimer() { |
| 266 if (!IsMenuShowing()) | 266 if (!IsMenuShowing()) |
| 267 ChangeMode(intended_mode_, false); | 267 ChangeMode(intended_mode_, false); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void ReloadButton::OnStopToReloadTimer() { | 270 void ReloadButton::OnStopToReloadTimer() { |
| 271 DCHECK(!IsMenuShowing()); | 271 DCHECK(!IsMenuShowing()); |
| 272 ChangeMode(intended_mode_, true); | 272 ChangeMode(intended_mode_, true); |
| 273 } | 273 } |
| OLD | NEW |