| Index: chrome/browser/ui/views/reload_button.cc
|
| diff --git a/chrome/browser/ui/views/reload_button.cc b/chrome/browser/ui/views/reload_button.cc
|
| index 34b78578346280a6028103087eef05c571136dc6..c36b1b0f39a56de973d2dec16c82206f09d0ae16 100644
|
| --- a/chrome/browser/ui/views/reload_button.cc
|
| +++ b/chrome/browser/ui/views/reload_button.cc
|
| @@ -6,7 +6,7 @@
|
|
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/app/chrome_command_ids.h"
|
| -#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/command_updater.h"
|
| #include "chrome/browser/ui/views/event_utils.h"
|
| #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
|
| #include "grit/generated_resources.h"
|
| @@ -19,10 +19,11 @@ const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton";
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // ReloadButton, public:
|
|
|
| -ReloadButton::ReloadButton(LocationBarView* location_bar, Browser* browser)
|
| +ReloadButton::ReloadButton(LocationBarView* location_bar,
|
| + CommandUpdater* command_updater)
|
| : ALLOW_THIS_IN_INITIALIZER_LIST(ToggleImageButton(this)),
|
| location_bar_(location_bar),
|
| - browser_(browser),
|
| + command_updater_(command_updater),
|
| intended_mode_(MODE_RELOAD),
|
| visible_mode_(MODE_RELOAD),
|
| double_click_timer_delay_(
|
| @@ -72,29 +73,22 @@ void ReloadButton::ChangeMode(Mode mode, bool force) {
|
| void ReloadButton::ButtonPressed(views::Button* /* button */,
|
| const views::Event& event) {
|
| if (visible_mode_ == MODE_STOP) {
|
| - if (browser_)
|
| - browser_->Stop();
|
| + if (command_updater_)
|
| + command_updater_->ExecuteCommand(IDC_STOP);
|
| // The user has clicked, so we can feel free to update the button,
|
| // even if the mouse is still hovering.
|
| ChangeMode(MODE_RELOAD, true);
|
| } else if (!double_click_timer_.IsRunning()) {
|
| // Shift-clicking or ctrl-clicking the reload button means we should ignore
|
| // any cached content.
|
| - // TODO(avayvod): eliminate duplication of this logic in
|
| - // CompactLocationBarView.
|
| int command;
|
| - int flags = mouse_event_flags();
|
| if (event.IsShiftDown() || event.IsControlDown()) {
|
| command = IDC_RELOAD_IGNORING_CACHE;
|
| - // Mask off Shift and Control so they don't affect the disposition below.
|
| - flags &= ~(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN);
|
| } else {
|
| command = IDC_RELOAD;
|
| }
|
|
|
| - WindowOpenDisposition disposition =
|
| - event_utils::DispositionFromEventFlags(flags);
|
| - if ((disposition == CURRENT_TAB) && location_bar_) {
|
| + if (location_bar_) {
|
| // Forcibly reset the location bar, since otherwise it won't discard any
|
| // ongoing user edits, since it doesn't realize this is a user-initiated
|
| // action.
|
| @@ -109,8 +103,8 @@ void ReloadButton::ButtonPressed(views::Button* /* button */,
|
| double_click_timer_.Start(FROM_HERE, double_click_timer_delay_, this,
|
| &ReloadButton::OnDoubleClickTimer);
|
|
|
| - if (browser_)
|
| - browser_->ExecuteCommandWithDisposition(command, disposition);
|
| + if (command_updater_)
|
| + command_updater_->ExecuteCommand(command);
|
| ++testing_reload_count_;
|
| }
|
| }
|
|
|