summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 19:35:15 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 19:35:15 +0000
commit5e5df50b03c73dad60d81c989b11d8e1ee436dbe (patch)
tree9d64b42c5c109dfe14581e56c9bb6a731d82e352 /chrome/browser/views
parentd62232baeefd5a2b0385238647266d26332628d0 (diff)
downloadchromium_src-5e5df50b03c73dad60d81c989b11d8e1ee436dbe.zip
chromium_src-5e5df50b03c73dad60d81c989b11d8e1ee436dbe.tar.gz
chromium_src-5e5df50b03c73dad60d81c989b11d8e1ee436dbe.tar.bz2
Reverting r12383, caused a build breakage on all platforms.
TBR=idanan Review URL: http://codereview.chromium.org/42571 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/go_button.cc14
-rw-r--r--chrome/browser/views/go_button.h10
-rw-r--r--chrome/browser/views/location_bar_view.cc4
-rw-r--r--chrome/browser/views/location_bar_view.h1
-rw-r--r--chrome/browser/views/toolbar_view.cc13
5 files changed, 14 insertions, 28 deletions
diff --git a/chrome/browser/views/go_button.cc b/chrome/browser/views/go_button.cc
index 48773ae..db205c4 100644
--- a/chrome/browser/views/go_button.cc
+++ b/chrome/browser/views/go_button.cc
@@ -5,8 +5,7 @@
#include "chrome/browser/views/go_button.h"
#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/views/event_utils.h"
+#include "chrome/browser/command_updater.h"
#include "chrome/browser/views/location_bar_view.h"
#include "chrome/common/l10n_util.h"
#include "grit/generated_resources.h"
@@ -14,17 +13,16 @@
////////////////////////////////////////////////////////////////////////////////
// GoButton, public:
-GoButton::GoButton(LocationBarView* location_bar, Browser* browser)
+GoButton::GoButton(LocationBarView* location_bar,
+ CommandUpdater* command_updater)
: ToggleImageButton(this),
location_bar_(location_bar),
- browser_(browser),
+ command_updater_(command_updater),
intended_mode_(MODE_GO),
visible_mode_(MODE_GO),
button_delay_(NULL),
stop_timer_(this) {
DCHECK(location_bar_);
- set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
- views::Event::EF_MIDDLE_BUTTON_DOWN);
}
GoButton::~GoButton() {
@@ -66,14 +64,14 @@ void GoButton::ScheduleChangeMode(Mode mode) {
void GoButton::ButtonPressed(views::Button* button) {
if (visible_mode_ == MODE_STOP) {
- browser_->Stop();
+ 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_GO);
} else if (visible_mode_ == MODE_GO && stop_timer_.empty()) {
// If the go button is visible and not within the double click timer, go.
- browser_->Go(event_utils::DispositionFromEventFlags(mouse_event_flags()));
+ command_updater_->ExecuteCommand(IDC_GO);
// Figure out the system double-click time.
if (button_delay_ == NULL)
diff --git a/chrome/browser/views/go_button.h b/chrome/browser/views/go_button.h
index a830191..c9d8252 100644
--- a/chrome/browser/views/go_button.h
+++ b/chrome/browser/views/go_button.h
@@ -8,7 +8,7 @@
#include "chrome/views/controls/button/image_button.h"
#include "base/task.h"
-class Browser;
+class CommandUpdater;
class LocationBarView;
////////////////////////////////////////////////////////////////////////////////
@@ -26,7 +26,9 @@ class LocationBarView;
class GoButton : public views::ToggleImageButton,
public views::ButtonListener {
public:
- GoButton(LocationBarView* location_bar, Browser* Browser);
+ // TODO(beng): get rid of the command updater param and instead have a
+ // delegate.
+ GoButton(LocationBarView* location_bar, CommandUpdater* command_updater);
virtual ~GoButton();
typedef enum Mode { MODE_GO = 0, MODE_STOP };
@@ -40,7 +42,7 @@ class GoButton : public views::ToggleImageButton,
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* button);
-
+
// Overridden from views::View:
virtual void OnMouseExited(const views::MouseEvent& e);
virtual bool GetTooltipText(int x, int y, std::wstring* tooltip);
@@ -52,7 +54,7 @@ class GoButton : public views::ToggleImageButton,
ScopedRunnableMethodFactory<GoButton> stop_timer_;
LocationBarView* location_bar_;
- Browser* browser_;
+ CommandUpdater* command_updater_;
// The mode we should be in
Mode intended_mode_;
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 2ece304..1bbc95c 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -1082,10 +1082,6 @@ void LocationBarView::AcceptInput() {
location_entry_->model()->AcceptInput(CURRENT_TAB, false);
}
-void LocationBarView::AcceptInputWithDisposition(WindowOpenDisposition disp) {
- location_entry_->model()->AcceptInput(disp, false);
-}
-
void LocationBarView::FocusLocation() {
location_entry_->SetFocus();
location_entry_->SelectAll(true);
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index d0bcdb2..920fc88 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -118,7 +118,6 @@ class LocationBarView : public LocationBar,
virtual WindowOpenDisposition GetWindowOpenDisposition() const;
virtual PageTransition::Type GetPageTransition() const;
virtual void AcceptInput();
- virtual void AcceptInputWithDisposition(WindowOpenDisposition);
virtual void FocusLocation();
virtual void FocusSearch();
virtual void UpdateFeedIcon();
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 78a8ae6..5695eac 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/user_data_manager.h"
#include "chrome/browser/views/bookmark_menu_button.h"
#include "chrome/browser/views/dom_view.h"
-#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/go_button.h"
#include "chrome/browser/views/location_bar_view.h"
#include "chrome/browser/views/theme_helpers.h"
@@ -134,8 +133,6 @@ void BrowserToolbarView::CreateLeftSideControls() {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
back_ = new views::ButtonDropDown(this, back_menu_model_.get());
- back_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
- views::Event::EF_MIDDLE_BUTTON_DOWN);
back_->set_tag(IDC_BACK);
back_->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
views::ImageButton::ALIGN_TOP);
@@ -151,8 +148,6 @@ void BrowserToolbarView::CreateLeftSideControls() {
AddChildView(back_);
forward_ = new views::ButtonDropDown(this, forward_menu_model_.get());
- forward_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
- views::Event::EF_MIDDLE_BUTTON_DOWN);
forward_->set_tag(IDC_FORWARD);
forward_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_FORWARD));
@@ -181,8 +176,6 @@ void BrowserToolbarView::CreateLeftSideControls() {
AddChildView(reload_);
home_ = new views::ImageButton(this);
- home_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
- views::Event::EF_MIDDLE_BUTTON_DOWN);
home_->set_tag(IDC_HOME);
home_->SetImage(views::CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_HOME));
home_->SetImage(views::CustomButton::BS_HOT, rb.GetBitmapNamed(IDR_HOME_H));
@@ -225,7 +218,7 @@ void BrowserToolbarView::CreateCenterStack(Profile *profile) {
location_bar_->Init();
// The Go button.
- go_ = new GoButton(location_bar_, browser_);
+ go_ = new GoButton(location_bar_, browser_->command_updater());
go_->SetImage(views::CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_GO));
go_->SetImage(views::CustomButton::BS_HOT, rb.GetBitmapNamed(IDR_GO_H));
go_->SetImage(views::CustomButton::BS_PUSHED, rb.GetBitmapNamed(IDR_GO_P));
@@ -839,9 +832,7 @@ void BrowserToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
}
void BrowserToolbarView::ButtonPressed(views::Button* sender) {
- browser_->ExecuteCommandWithDisposition(
- sender->tag(),
- event_utils::DispositionFromEventFlags(sender->mouse_event_flags()));
+ browser_->ExecuteCommand(sender->tag());
}
// static