summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/about_ipc_dialog.cc11
-rw-r--r--chrome/browser/views/about_ipc_dialog.h8
-rw-r--r--chrome/browser/views/about_network_dialog.cc11
-rw-r--r--chrome/browser/views/about_network_dialog.h8
-rw-r--r--chrome/browser/views/blocked_popup_container.cc17
-rw-r--r--chrome/browser/views/blocked_popup_container.h14
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc34
-rw-r--r--chrome/browser/views/bookmark_bar_view.h6
-rw-r--r--chrome/browser/views/bookmark_bar_view_test.cc6
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc4
-rw-r--r--chrome/browser/views/constrained_window_impl.cc28
-rw-r--r--chrome/browser/views/download_shelf_view.cc13
-rw-r--r--chrome/browser/views/download_shelf_view.h7
-rw-r--r--chrome/browser/views/find_bar_view.cc39
-rw-r--r--chrome/browser/views/find_bar_view.h13
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.h1
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.cc63
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.h15
-rw-r--r--chrome/browser/views/go_button.cc107
-rw-r--r--chrome/browser/views/go_button.h16
-rw-r--r--chrome/browser/views/infobars/infobars.cc15
-rw-r--r--chrome/browser/views/infobars/infobars.h13
-rw-r--r--chrome/browser/views/tabs/tab.cc5
-rw-r--r--chrome/browser/views/tabs/tab.h8
-rw-r--r--chrome/browser/views/tabs/tab_renderer.cc20
-rw-r--r--chrome/browser/views/tabs/tab_renderer.h10
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc17
-rw-r--r--chrome/browser/views/tabs/tab_strip.h10
-rw-r--r--chrome/browser/views/toolbar_star_toggle.cc16
-rw-r--r--chrome/browser/views/toolbar_star_toggle.h8
-rw-r--r--chrome/browser/views/toolbar_view.cc98
-rw-r--r--chrome/browser/views/toolbar_view.h12
32 files changed, 339 insertions, 314 deletions
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc
index 6e9848c..a614f86 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/views/about_ipc_dialog.cc
@@ -298,12 +298,9 @@ void AboutIPCDialog::SetupControls() {
views::GridLayout* layout = CreatePanelGridLayout(this);
SetLayoutManager(layout);
- track_toggle_ = new views::TextButton(kStartTrackingLabel);
- track_toggle_->SetListener(this, 1);
- clear_button_ = new views::TextButton(kClearLabel);
- clear_button_->SetListener(this, 2);
- filter_button_ = new views::TextButton(kFilterLabel);
- filter_button_->SetListener(this, 3);
+ track_toggle_ = new views::TextButton(this, kStartTrackingLabel);
+ clear_button_ = new views::TextButton(this, kClearLabel);
+ filter_button_ = new views::TextButton(this, kFilterLabel);
table_ = new views::HWNDView();
@@ -419,7 +416,7 @@ bool AboutIPCDialog::CanResize() const {
return true;
}
-void AboutIPCDialog::ButtonPressed(views::BaseButton* button) {
+void AboutIPCDialog::ButtonPressed(views::Button* button) {
if (button == track_toggle_) {
if (tracking_) {
track_toggle_->SetText(kStartTrackingLabel);
diff --git a/chrome/browser/views/about_ipc_dialog.h b/chrome/browser/views/about_ipc_dialog.h
index 0aa6b06..15c41c2 100644
--- a/chrome/browser/views/about_ipc_dialog.h
+++ b/chrome/browser/views/about_ipc_dialog.h
@@ -13,7 +13,7 @@
#include "base/singleton.h"
#include "chrome/common/ipc_logging.h"
-#include "chrome/views/base_button.h"
+#include "chrome/views/button.h"
#include "chrome/views/dialog_delegate.h"
#include "chrome/views/table_view.h"
@@ -26,7 +26,7 @@ class HWNDView;
} // namespace views
class AboutIPCDialog : public views::DialogDelegate,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public IPC::Logging::Consumer,
public views::View {
public:
@@ -57,8 +57,8 @@ class AboutIPCDialog : public views::DialogDelegate,
// views::WindowDelegate (via view::DialogDelegate).
virtual bool CanResize() const;
- // views::BaseButton::ButtonListener.
- virtual void ButtonPressed(views::BaseButton* button);
+ // views::ButtonListener.
+ virtual void ButtonPressed(views::Button* button);
CListViewCtrl message_list_;
diff --git a/chrome/browser/views/about_network_dialog.cc b/chrome/browser/views/about_network_dialog.cc
index 9631a3e..7028d2b 100644
--- a/chrome/browser/views/about_network_dialog.cc
+++ b/chrome/browser/views/about_network_dialog.cc
@@ -295,12 +295,9 @@ void AboutNetworkDialog::SetupControls() {
views::GridLayout* layout = CreatePanelGridLayout(this);
SetLayoutManager(layout);
- track_toggle_ = new views::TextButton(kStartTrackingLabel);
- track_toggle_->SetListener(this, 1);
- show_button_ = new views::TextButton(kShowCurrentLabel);
- show_button_->SetListener(this, 2);
- clear_button_ = new views::TextButton(kClearLabel);
- clear_button_->SetListener(this, 3);
+ track_toggle_ = new views::TextButton(this, kStartTrackingLabel);
+ show_button_ = new views::TextButton(this, kShowCurrentLabel);
+ clear_button_ = new views::TextButton(this, kClearLabel);
text_field_ = new views::TextField(static_cast<views::TextField::StyleFlags>(
views::TextField::STYLE_MULTILINE));
@@ -358,7 +355,7 @@ bool AboutNetworkDialog::CanResize() const {
return true;
}
-void AboutNetworkDialog::ButtonPressed(views::BaseButton* button) {
+void AboutNetworkDialog::ButtonPressed(views::Button* button) {
if (button == track_toggle_) {
if (tracking_) {
track_toggle_->SetText(kStartTrackingLabel);
diff --git a/chrome/browser/views/about_network_dialog.h b/chrome/browser/views/about_network_dialog.h
index e9fe81d..768cd97 100644
--- a/chrome/browser/views/about_network_dialog.h
+++ b/chrome/browser/views/about_network_dialog.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_VIEWS_ABOUT_NETWORK_DIALOG_H_
#include "base/singleton.h"
-#include "chrome/views/base_button.h"
+#include "chrome/views/button.h"
#include "chrome/views/dialog_delegate.h"
namespace views {
@@ -15,7 +15,7 @@ class TextField;
} // namespace views
class AboutNetworkDialog : public views::DialogDelegate,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public views::View {
public:
// This dialog is a singleton. If the dialog is already opened, it won't do
@@ -47,8 +47,8 @@ class AboutNetworkDialog : public views::DialogDelegate,
// views::WindowDelegate (via view::DialogDelegate).
virtual bool CanResize() const;
- // views::BaseButton::ButtonListener.
- virtual void ButtonPressed(views::BaseButton* button);
+ // views::ButtonListener.
+ virtual void ButtonPressed(views::Button* button);
views::TextButton* track_toggle_;
views::TextButton* show_button_;
diff --git a/chrome/browser/views/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc
index bd513cf..8ae1801 100644
--- a/chrome/browser/views/blocked_popup_container.cc
+++ b/chrome/browser/views/blocked_popup_container.cc
@@ -22,7 +22,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/background.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/menu_button.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -90,23 +90,22 @@ BlockedPopupContainerView::BlockedPopupContainerView(
// Create a button with a multidigit number to reserve space.
popup_count_label_ = new views::MenuButton(
+ this,
l10n_util::GetStringF(IDS_POPUPS_BLOCKED_COUNT,
IntToWString(kWidestNumber)),
NULL, true);
- popup_count_label_->SetTextAlignment(views::TextButton::ALIGN_CENTER);
- popup_count_label_->SetListener(this, 1);
+ popup_count_label_->set_alignment(views::TextButton::ALIGN_CENTER);
AddChildView(popup_count_label_);
// For now, we steal the Find close button, since it looks OK.
- close_button_ = new views::Button();
+ close_button_ = new views::ImageButton(this);
close_button_->SetFocusable(true);
- close_button_->SetImage(views::Button::BS_NORMAL,
+ close_button_->SetImage(views::CustomButton::BS_NORMAL,
resource_bundle.GetBitmapNamed(IDR_CLOSE_BAR));
- close_button_->SetImage(views::Button::BS_HOT,
+ close_button_->SetImage(views::CustomButton::BS_HOT,
resource_bundle.GetBitmapNamed(IDR_CLOSE_BAR_H));
- close_button_->SetImage(views::Button::BS_PUSHED,
+ close_button_->SetImage(views::CustomButton::BS_PUSHED,
resource_bundle.GetBitmapNamed(IDR_CLOSE_BAR_P));
- close_button_->SetListener(this, 0);
AddChildView(close_button_);
set_background(views::Background::CreateStandardPanelBackground());
@@ -174,7 +173,7 @@ gfx::Size BlockedPopupContainerView::GetPreferredSize() {
return preferred_size;
}
-void BlockedPopupContainerView::ButtonPressed(views::BaseButton* sender) {
+void BlockedPopupContainerView::ButtonPressed(views::Button* sender) {
if (sender == popup_count_label_) {
launch_menu_.reset(new Menu(this, Menu::TOPLEFT,
container_->GetNativeView()));
diff --git a/chrome/browser/views/blocked_popup_container.h b/chrome/browser/views/blocked_popup_container.h
index 3b012a8..215246b 100644
--- a/chrome/browser/views/blocked_popup_container.h
+++ b/chrome/browser/views/blocked_popup_container.h
@@ -18,7 +18,7 @@
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/animation.h"
#include "chrome/common/pref_member.h"
-#include "chrome/views/base_button.h"
+#include "chrome/views/button.h"
#include "chrome/views/menu.h"
#include "chrome/views/view.h"
#include "chrome/views/widget_win.h"
@@ -29,7 +29,7 @@ class TabContents;
class TextButton;
namespace views {
-class Button;
+class ImageButton;
class Menu;
class MenuButton;
}
@@ -37,7 +37,7 @@ class MenuButton;
// The view presented to the user notifying them of the number of popups
// blocked. This view should only be used inside of BlockedPopupContainer.
class BlockedPopupContainerView : public views::View,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public Menu::Delegate {
public:
explicit BlockedPopupContainerView(BlockedPopupContainer* container);
@@ -55,10 +55,8 @@ class BlockedPopupContainerView : public views::View,
// Gets the desired size of the popup notification.
virtual gfx::Size GetPreferredSize();
- // Overridden from views::ButtonListener::ButtonPressed:
-
- // Called when either the menu button or close button is pressed.
- virtual void ButtonPressed(views::BaseButton* sender);
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender);
// Overridden from Menu::Delegate:
@@ -75,7 +73,7 @@ class BlockedPopupContainerView : public views::View,
views::MenuButton* popup_count_label_;
// Our "X" button.
- views::Button* close_button_;
+ views::ImageButton* close_button_;
// Popup menu shown to user.
scoped_ptr<Menu> launch_menu_;
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 5c95b08..5cf84f0 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -41,7 +41,7 @@
#include "grit/theme_resources.h"
#include "skia/ext/skia_utils.h"
-using views::BaseButton;
+using views::CustomButton;
using views::DropTargetEvent;
using views::MenuButton;
using views::MenuItemView;
@@ -190,10 +190,11 @@ static std::wstring CreateToolTipForURLAndTitle(const gfx::Point& screen_loc,
class BookmarkButton : public views::TextButton {
public:
- BookmarkButton(const GURL& url,
+ BookmarkButton(views::ButtonListener* listener,
+ const GURL& url,
const std::wstring& title,
Profile* profile)
- : TextButton(title),
+ : TextButton(listener, title),
url_(url),
profile_(profile) {
show_animation_.reset(new SlideAnimation(this));
@@ -210,7 +211,7 @@ class BookmarkButton : public views::TextButton {
gfx::Point location(x, y);
ConvertPointToScreen(this, &location);
*tooltip = CreateToolTipForURLAndTitle(
- gfx::Point(location.x(), location.y()), url_, GetText(),
+ gfx::Point(location.x(), location.y()), url_, text(),
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
return !tooltip->empty();
}
@@ -257,10 +258,11 @@ class BookmarkButton : public views::TextButton {
// button.
class BookmarkFolderButton : public views::MenuButton {
public:
- BookmarkFolderButton(const std::wstring& title,
+ BookmarkFolderButton(views::ButtonListener* listener,
+ const std::wstring& title,
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker)
- : MenuButton(title, menu_delegate, show_menu_marker) {
+ : MenuButton(listener, title, menu_delegate, show_menu_marker) {
show_animation_.reset(new SlideAnimation(this));
if (BookmarkBarView::testing_) {
// For some reason during testing the events generated by animating
@@ -966,15 +968,16 @@ void BookmarkBarView::Init() {
MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() {
MenuButton* button = new BookmarkFolderButton(
- l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED), this, false);
+ this, l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED), this,
+ false);
button->SetIcon(GetGroupIcon());
button->SetContextMenuController(this);
- button->SetListener(this, kOtherFolderButtonTag);
+ button->set_tag(kOtherFolderButtonTag);
return button;
}
MenuButton* BookmarkBarView::CreateOverflowButton() {
- MenuButton* button = new MenuButton(std::wstring(), this, false);
+ MenuButton* button = new MenuButton(NULL, std::wstring(), this, false);
button->SetIcon(*ResourceBundle::GetSharedInstance().
GetBitmapNamed(IDR_BOOKMARK_BAR_CHEVRONS));
@@ -1240,9 +1243,9 @@ void BookmarkBarView::RunMenu(views::View* view,
anchor_point, false);
}
-void BookmarkBarView::ButtonPressed(views::BaseButton* sender) {
+void BookmarkBarView::ButtonPressed(views::Button* sender) {
BookmarkNode* node;
- if (sender->GetTag() == kOtherFolderButtonTag) {
+ if (sender->tag() == kOtherFolderButtonTag) {
node = model_->other_node();
} else {
int index = GetChildIndex(sender);
@@ -1302,17 +1305,16 @@ void BookmarkBarView::ShowContextMenu(View* source,
views::View* BookmarkBarView::CreateBookmarkButton(BookmarkNode* node) {
if (node->is_url()) {
- BookmarkButton* button = new BookmarkButton(node->GetURL(),
+ BookmarkButton* button = new BookmarkButton(this,
+ node->GetURL(),
node->GetTitle(),
GetProfile());
- button->SetListener(this, 0);
ConfigureButton(node, button);
return button;
} else {
views::MenuButton* button =
- new BookmarkFolderButton(node->GetTitle(), this, false);
+ new BookmarkFolderButton(this, node->GetTitle(), this, false);
button->SetIcon(GetGroupIcon());
- button->SetListener(this, 0);
ConfigureButton(node, button);
return button;
}
@@ -1643,7 +1645,7 @@ void BookmarkBarView::StartThrobbing() {
// Node is hidden, animate the overflow button.
throbbing_view_ = overflow_button_;
} else {
- throbbing_view_ = static_cast<BaseButton*>(GetChildViewAt(index));
+ throbbing_view_ = static_cast<CustomButton*>(GetChildViewAt(index));
}
} else {
throbbing_view_ = other_bookmarked_button_;
diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h
index 8b42251..14d7c81 100644
--- a/chrome/browser/views/bookmark_bar_view.h
+++ b/chrome/browser/views/bookmark_bar_view.h
@@ -40,7 +40,7 @@ class MenuItemView;
class BookmarkBarView : public views::View,
public BookmarkModelObserver,
public views::ViewMenuDelegate,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public Menu::Delegate,
public NotificationObserver,
public views::ContextMenuController,
@@ -307,7 +307,7 @@ class BookmarkBarView : public views::View,
// Invoked when a star entry corresponding to a URL on the bookmark bar is
// pressed. Forwards to the PageNavigator to open the URL.
- virtual void ButtonPressed(views::BaseButton* sender);
+ virtual void ButtonPressed(views::Button* sender);
// Invoked for this View, one of the buttons or the 'other' button. Shows the
// appropriate context menu.
@@ -431,7 +431,7 @@ class BookmarkBarView : public views::View,
// If the bookmark bubble is showing, this is the visible ancestor of the URL.
// The visible ancestor is either the other_bookmarked_button_,
// overflow_button_ or a button on the bar.
- views::BaseButton* throbbing_view_;
+ views::CustomButton* throbbing_view_;
// How many extension toolstrips we have showing in the toolbar.
int num_extension_toolstrips_;
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc
index 2a4740f..8c5294a 100644
--- a/chrome/browser/views/bookmark_bar_view_test.cc
+++ b/chrome/browser/views/bookmark_bar_view_test.cc
@@ -190,7 +190,7 @@ class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
// Button should be depressed.
views::TextButton* button = bb_view_->GetBookmarkButton(0);
- ASSERT_TRUE(button->GetState() == views::BaseButton::BS_PUSHED);
+ ASSERT_TRUE(button->state() == views::CustomButton::BS_PUSHED);
// Click on the 2nd menu item (A URL).
ASSERT_TRUE(menu->GetSubmenu());
@@ -210,7 +210,7 @@ class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
// Make sure button is no longer pushed.
views::TextButton* button = bb_view_->GetBookmarkButton(0);
- ASSERT_TRUE(button->GetState() == views::BaseButton::BS_NORMAL);
+ ASSERT_TRUE(button->state() == views::CustomButton::BS_NORMAL);
views::MenuItemView* menu = bb_view_->GetMenu();
ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing());
@@ -258,7 +258,7 @@ class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase {
// Make sure button is no longer pushed.
views::TextButton* button = bb_view_->GetBookmarkButton(0);
- ASSERT_TRUE(button->GetState() == views::BaseButton::BS_NORMAL);
+ ASSERT_TRUE(button->state() == views::CustomButton::BS_NORMAL);
window_->Activate();
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index a0de947..8701f2c 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -151,12 +151,12 @@ BookmarkManagerView::BookmarkManagerView(Profile* profile)
tree_view_->SetContextMenuController(this);
views::MenuButton* organize_menu_button = new views::MenuButton(
- l10n_util::GetString(IDS_BOOKMARK_MANAGER_ORGANIZE_MENU),
+ NULL, l10n_util::GetString(IDS_BOOKMARK_MANAGER_ORGANIZE_MENU),
this, true);
organize_menu_button->SetID(kOrganizeMenuButtonID);
views::MenuButton* tools_menu_button = new views::MenuButton(
- l10n_util::GetString(IDS_BOOKMARK_MANAGER_TOOLS_MENU),
+ NULL, l10n_util::GetString(IDS_BOOKMARK_MANAGER_TOOLS_MENU),
this, true);
tools_menu_button->SetID(kToolsMenuButtonID);
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index 8ffd4e0..ba436f0 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -25,7 +25,7 @@
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/client_view.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/hwnd_view.h"
@@ -188,7 +188,7 @@ SkBitmap* OTRWindowResources::bitmaps_[];
class ConstrainedWindowFrameView
: public views::NonClientFrameView,
- public views::BaseButton::ButtonListener {
+ public views::ButtonListener {
public:
explicit ConstrainedWindowFrameView(ConstrainedWindowImpl* container);
virtual ~ConstrainedWindowFrameView();
@@ -211,8 +211,8 @@ class ConstrainedWindowFrameView
virtual void Layout();
virtual void ThemeChanged();
- // Overridden from views::BaseButton::ButtonListener:
- virtual void ButtonPressed(views::BaseButton* sender);
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender);
private:
// Returns the thickness of the border that makes up the window frame edges.
@@ -259,7 +259,7 @@ class ConstrainedWindowFrameView
gfx::Rect title_bounds_;
- views::Button* close_button_;
+ views::ImageButton* close_button_;
// The bounds of the ClientView.
gfx::Rect client_view_bounds_;
@@ -309,19 +309,18 @@ ConstrainedWindowFrameView::ConstrainedWindowFrameView(
ConstrainedWindowImpl* container)
: NonClientFrameView(),
container_(container),
- close_button_(new views::Button) {
+ close_button_(new views::ImageButton(this)) {
InitClass();
InitWindowResources();
- close_button_->SetImage(views::Button::BS_NORMAL,
+ close_button_->SetImage(views::CustomButton::BS_NORMAL,
resources_->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON));
- close_button_->SetImage(views::Button::BS_HOT,
+ close_button_->SetImage(views::CustomButton::BS_HOT,
resources_->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON_H));
- close_button_->SetImage(views::Button::BS_PUSHED,
+ close_button_->SetImage(views::CustomButton::BS_PUSHED,
resources_->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON_P));
- close_button_->SetImageAlignment(views::Button::ALIGN_CENTER,
- views::Button::ALIGN_MIDDLE);
- close_button_->SetListener(this, 0);
+ close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
+ views::ImageButton::ALIGN_MIDDLE);
AddChildView(close_button_);
}
@@ -430,10 +429,9 @@ void ConstrainedWindowFrameView::ThemeChanged() {
}
////////////////////////////////////////////////////////////////////////////////
-// ConstrainedWindowFrameView, views::BaseButton::Button
-// implementation:
+// ConstrainedWindowFrameView, views::ButtonListener implementation:
-void ConstrainedWindowFrameView::ButtonPressed(views::BaseButton* sender) {
+void ConstrainedWindowFrameView::ButtonPressed(views::Button* sender) {
if (sender == close_button_)
container_->ExecuteSystemMenuCommand(SC_CLOSE);
}
diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc
index f9081e8..21cd338 100644
--- a/chrome/browser/views/download_shelf_view.cc
+++ b/chrome/browser/views/download_shelf_view.cc
@@ -16,7 +16,7 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/background.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/image_view.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -93,14 +93,13 @@ void DownloadShelfView::Init() {
show_all_view_->SetController(this);
AddChildView(show_all_view_);
- close_button_ = new views::Button();
- close_button_->SetImage(views::Button::BS_NORMAL,
+ close_button_ = new views::ImageButton(this);
+ close_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_CLOSE_BAR));
- close_button_->SetImage(views::Button::BS_HOT,
+ close_button_->SetImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
- close_button_->SetImage(views::Button::BS_PUSHED,
+ close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
- close_button_->SetListener(this, 0);
AddChildView(close_button_);
set_background(views::Background::CreateSolidBackground(kBackgroundColor));
@@ -263,7 +262,7 @@ void DownloadShelfView::LinkActivated(views::Link* source, int event_flags) {
ShowAllDownloads();
}
-void DownloadShelfView::ButtonPressed(views::BaseButton* button) {
+void DownloadShelfView::ButtonPressed(views::Button* button) {
shelf_animation_->Hide();
}
diff --git a/chrome/browser/views/download_shelf_view.h b/chrome/browser/views/download_shelf_view.h
index 36b2070..1cd7907 100644
--- a/chrome/browser/views/download_shelf_view.h
+++ b/chrome/browser/views/download_shelf_view.h
@@ -11,6 +11,7 @@
#include "chrome/views/link.h"
namespace views {
+class ImageButton;
class ImageView;
}
@@ -28,7 +29,7 @@ class DownloadAnimation;
// it'll automatically remove views once a certain point is reached.
class DownloadShelfView : public DownloadShelf,
public views::View,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public views::LinkController,
public AnimationDelegate {
public:
@@ -50,7 +51,7 @@ class DownloadShelfView : public DownloadShelf,
// Implementation of ButtonListener.
// Invoked when the user clicks the close button. Asks the browser to
// hide the download shelf.
- virtual void ButtonPressed(views::BaseButton* button);
+ virtual void ButtonPressed(views::Button* button);
// Implementation of DownloadShelf.
virtual void AddDownload(BaseDownloadItemModel* download_model);
@@ -90,7 +91,7 @@ class DownloadShelfView : public DownloadShelf,
// Button for closing the downloads. This is contained as a child, and
// deleted by View.
- views::Button* close_button_;
+ views::ImageButton* close_button_;
DISALLOW_COPY_AND_ASSIGN(DownloadShelfView);
};
diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc
index 1cb9481..56dfd29 100644
--- a/chrome/browser/views/find_bar_view.cc
+++ b/chrome/browser/views/find_bar_view.cc
@@ -15,6 +15,7 @@
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/background.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/label.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -109,39 +110,42 @@ FindBarView::FindBarView(FindBarWin* container)
focus_forwarder_view_ = new FocusForwarderView(find_text_);
AddChildView(focus_forwarder_view_);
- find_previous_button_ = new views::Button();
+ find_previous_button_ = new views::ImageButton(this);
+ find_previous_button_->set_tag(FIND_PREVIOUS_TAG);
find_previous_button_->SetEnabled(false);
find_previous_button_->SetFocusable(true);
- find_previous_button_->SetImage(views::Button::BS_NORMAL,
+ find_previous_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_FINDINPAGE_PREV));
- find_previous_button_->SetImage(views::Button::BS_HOT,
+ find_previous_button_->SetImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_H));
- find_previous_button_->SetImage(views::Button::BS_DISABLED,
+ find_previous_button_->SetImage(views::CustomButton::BS_DISABLED,
rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_P));
find_previous_button_->SetTooltipText(
l10n_util::GetString(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP));
AddChildView(find_previous_button_);
- find_next_button_ = new views::Button();
+ find_next_button_ = new views::ImageButton(this);
+ find_next_button_->set_tag(FIND_NEXT_TAG);
find_next_button_->SetEnabled(false);
find_next_button_->SetFocusable(true);
- find_next_button_->SetImage(views::Button::BS_NORMAL,
+ find_next_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT));
- find_next_button_->SetImage(views::Button::BS_HOT,
+ find_next_button_->SetImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_H));
- find_next_button_->SetImage(views::Button::BS_DISABLED,
+ find_next_button_->SetImage(views::CustomButton::BS_DISABLED,
rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_P));
find_next_button_->SetTooltipText(
l10n_util::GetString(IDS_FIND_IN_PAGE_NEXT_TOOLTIP));
AddChildView(find_next_button_);
- close_button_ = new views::Button();
+ close_button_ = new views::ImageButton(this);
+ close_button_->set_tag(CLOSE_TAG);
close_button_->SetFocusable(true);
- close_button_->SetImage(views::Button::BS_NORMAL,
+ close_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_CLOSE_BAR));
- close_button_->SetImage(views::Button::BS_HOT,
+ close_button_->SetImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
- close_button_->SetImage(views::Button::BS_PUSHED,
+ close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
close_button_->SetTooltipText(
l10n_util::GetString(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP));
@@ -345,7 +349,6 @@ void FindBarView::Layout() {
(height() - sz.height()) / 2,
sz.width(),
sz.height());
- close_button_->SetListener(this, CLOSE_TAG);
// Next, the FindNext button to the left the close button.
sz = find_next_button_->GetPreferredSize();
@@ -355,7 +358,6 @@ void FindBarView::Layout() {
(height() - sz.height()) / 2,
sz.width(),
sz.height());
- find_next_button_->SetListener(this, FIND_NEXT_TAG);
// Then, the FindPrevious button to the left the FindNext button.
sz = find_previous_button_->GetPreferredSize();
@@ -364,7 +366,6 @@ void FindBarView::Layout() {
(height() - sz.height()) / 2,
sz.width(),
sz.height());
- find_previous_button_->SetListener(this, FIND_PREVIOUS_TAG);
// Then the label showing the match count number.
sz = match_count_text_->GetPreferredSize();
@@ -421,16 +422,16 @@ gfx::Size FindBarView::GetPreferredSize() {
}
////////////////////////////////////////////////////////////////////////////////
-// FindBarView, views::BaseButton::ButtonListener implementation:
+// FindBarView, views::ButtonListener implementation:
-void FindBarView::ButtonPressed(views::BaseButton* sender) {
- switch (sender->GetTag()) {
+void FindBarView::ButtonPressed(views::Button* sender) {
+ switch (sender->tag()) {
case FIND_PREVIOUS_TAG:
case FIND_NEXT_TAG:
if (find_text_->GetText().length() > 0) {
container_->find_bar_controller()->web_contents()->StartFinding(
find_text_->GetText(),
- sender->GetTag() == FIND_NEXT_TAG);
+ sender->tag() == FIND_NEXT_TAG);
}
break;
case CLOSE_TAG:
diff --git a/chrome/browser/views/find_bar_view.h b/chrome/browser/views/find_bar_view.h
index 2818d6d..2b5748a 100644
--- a/chrome/browser/views/find_bar_view.h
+++ b/chrome/browser/views/find_bar_view.h
@@ -13,6 +13,7 @@
class FindBarWin;
namespace views {
+class ImageButton;
class Label;
class MouseEvent;
class View;
@@ -26,7 +27,7 @@ class View;
//
////////////////////////////////////////////////////////////////////////////////
class FindBarView : public views::View,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public views::TextField::Controller {
public:
// A tag denoting which button the user pressed.
@@ -60,8 +61,8 @@ class FindBarView : public views::View,
virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
- // Overridden from views::ButtonListener::ButtonPressed:
- virtual void ButtonPressed(views::BaseButton* sender);
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender);
// Overridden from views::TextField::Controller:
virtual void ContentsChanged(views::TextField* sender,
@@ -104,9 +105,9 @@ class FindBarView : public views::View,
views::TextField* find_text_;
views::Label* match_count_text_;
FocusForwarderView* focus_forwarder_view_;
- views::Button* find_previous_button_;
- views::Button* find_next_button_;
- views::Button* close_button_;
+ views::ImageButton* find_previous_button_;
+ views::ImageButton* find_next_button_;
+ views::ImageButton* close_button_;
// The last matchcount number we reported to the user.
int last_reported_matchcount_;
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.h b/chrome/browser/views/frame/glass_browser_frame_view.h
index 90bbc9c..585e075 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.h
+++ b/chrome/browser/views/frame/glass_browser_frame_view.h
@@ -11,6 +11,7 @@
class BrowserView;
class GlassBrowserWindowResources;
+class SkBitmap;
class GlassBrowserFrameView : public BrowserNonClientFrameView {
public:
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index 01b8632..0f6d3d1 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc
@@ -13,6 +13,7 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/root_view.h"
#include "chrome/views/window_resources.h"
#include "grit/chromium_strings.h"
@@ -332,10 +333,10 @@ const int kCaptionTopSpacing = 1;
OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame,
BrowserView* browser_view)
: BrowserNonClientFrameView(),
- minimize_button_(new views::Button),
- maximize_button_(new views::Button),
- restore_button_(new views::Button),
- close_button_(new views::Button),
+ minimize_button_(new views::ImageButton(this)),
+ maximize_button_(new views::ImageButton(this)),
+ restore_button_(new views::ImageButton(this)),
+ close_button_(new views::ImageButton(this)),
window_icon_(NULL),
frame_(frame),
browser_view_(browser_view) {
@@ -355,57 +356,53 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame,
views::WindowResources* resources = current_active_resources_;
minimize_button_->SetImage(
- views::Button::BS_NORMAL,
+ views::CustomButton::BS_NORMAL,
resources->GetPartBitmap(FRAME_MINIMIZE_BUTTON_ICON));
minimize_button_->SetImage(
- views::Button::BS_HOT,
+ views::CustomButton::BS_HOT,
resources->GetPartBitmap(FRAME_MINIMIZE_BUTTON_ICON_H));
minimize_button_->SetImage(
- views::Button::BS_PUSHED,
+ views::CustomButton::BS_PUSHED,
resources->GetPartBitmap(FRAME_MINIMIZE_BUTTON_ICON_P));
- minimize_button_->SetListener(this, -1);
minimize_button_->SetAccessibleName(
l10n_util::GetString(IDS_ACCNAME_MINIMIZE));
AddChildView(minimize_button_);
maximize_button_->SetImage(
- views::Button::BS_NORMAL,
+ views::CustomButton::BS_NORMAL,
resources->GetPartBitmap(FRAME_MAXIMIZE_BUTTON_ICON));
maximize_button_->SetImage(
- views::Button::BS_HOT,
+ views::CustomButton::BS_HOT,
resources->GetPartBitmap(FRAME_MAXIMIZE_BUTTON_ICON_H));
maximize_button_->SetImage(
- views::Button::BS_PUSHED,
+ views::CustomButton::BS_PUSHED,
resources->GetPartBitmap(FRAME_MAXIMIZE_BUTTON_ICON_P));
- maximize_button_->SetListener(this, -1);
maximize_button_->SetAccessibleName(
l10n_util::GetString(IDS_ACCNAME_MAXIMIZE));
AddChildView(maximize_button_);
restore_button_->SetImage(
- views::Button::BS_NORMAL,
+ views::CustomButton::BS_NORMAL,
resources->GetPartBitmap(FRAME_RESTORE_BUTTON_ICON));
restore_button_->SetImage(
- views::Button::BS_HOT,
+ views::CustomButton::BS_HOT,
resources->GetPartBitmap(FRAME_RESTORE_BUTTON_ICON_H));
restore_button_->SetImage(
- views::Button::BS_PUSHED,
+ views::CustomButton::BS_PUSHED,
resources->GetPartBitmap(FRAME_RESTORE_BUTTON_ICON_P));
- restore_button_->SetListener(this, -1);
restore_button_->SetAccessibleName(
l10n_util::GetString(IDS_ACCNAME_RESTORE));
AddChildView(restore_button_);
close_button_->SetImage(
- views::Button::BS_NORMAL,
+ views::CustomButton::BS_NORMAL,
resources->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON));
close_button_->SetImage(
- views::Button::BS_HOT,
+ views::CustomButton::BS_HOT,
resources->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON_H));
close_button_->SetImage(
- views::Button::BS_PUSHED,
+ views::CustomButton::BS_PUSHED,
resources->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON_P));
- close_button_->SetListener(this, -1);
close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
AddChildView(close_button_);
@@ -532,9 +529,9 @@ void OpaqueBrowserFrameView::EnableClose(bool enable) {
}
void OpaqueBrowserFrameView::ResetWindowControls() {
- restore_button_->SetState(views::Button::BS_NORMAL);
- minimize_button_->SetState(views::Button::BS_NORMAL);
- maximize_button_->SetState(views::Button::BS_NORMAL);
+ restore_button_->SetState(views::CustomButton::BS_NORMAL);
+ minimize_button_->SetState(views::CustomButton::BS_NORMAL);
+ maximize_button_->SetState(views::CustomButton::BS_NORMAL);
// The close button isn't affected by this constraint.
}
@@ -617,9 +614,9 @@ void OpaqueBrowserFrameView::SetAccessibleName(const std::wstring& name) {
}
///////////////////////////////////////////////////////////////////////////////
-// OpaqueBrowserFrameView, views::BaseButton::ButtonListener implementation:
+// OpaqueBrowserFrameView, views::ButtonListener implementation:
-void OpaqueBrowserFrameView::ButtonPressed(views::BaseButton* sender) {
+void OpaqueBrowserFrameView::ButtonPressed(views::Button* sender) {
if (sender == minimize_button_)
frame_->Minimize();
else if (sender == maximize_button_)
@@ -904,8 +901,8 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(ChromeCanvas* canvas) {
}
void OpaqueBrowserFrameView::LayoutWindowControls() {
- close_button_->SetImageAlignment(views::Button::ALIGN_LEFT,
- views::Button::ALIGN_BOTTOM);
+ close_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
+ views::ImageButton::ALIGN_BOTTOM);
// Maximized buttons start at window top so that even if their images aren't
// drawn flush with the screen edge, they still obey Fitts' Law.
bool is_maximized = frame_->IsMaximized();
@@ -926,23 +923,23 @@ void OpaqueBrowserFrameView::LayoutWindowControls() {
// When the window is restored, we show a maximized button; otherwise, we show
// a restore button.
bool is_restored = !is_maximized && !frame_->IsMinimized();
- views::Button* invisible_button = is_restored ?
+ views::ImageButton* invisible_button = is_restored ?
restore_button_ : maximize_button_;
invisible_button->SetVisible(false);
- views::Button* visible_button = is_restored ?
+ views::ImageButton* visible_button = is_restored ?
maximize_button_ : restore_button_;
visible_button->SetVisible(true);
- visible_button->SetImageAlignment(views::Button::ALIGN_LEFT,
- views::Button::ALIGN_BOTTOM);
+ visible_button->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
+ views::ImageButton::ALIGN_BOTTOM);
gfx::Size visible_button_size = visible_button->GetPreferredSize();
visible_button->SetBounds(close_button_->x() - visible_button_size.width(),
caption_y, visible_button_size.width(),
visible_button_size.height() + top_extra_height);
minimize_button_->SetVisible(true);
- minimize_button_->SetImageAlignment(views::Button::ALIGN_LEFT,
- views::Button::ALIGN_BOTTOM);
+ minimize_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
+ views::ImageButton::ALIGN_BOTTOM);
gfx::Size minimize_button_size = minimize_button_->GetPreferredSize();
minimize_button_->SetBounds(
visible_button->x() - minimize_button_size.width(), caption_y,
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h
index ee805f8..3a47ac4 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.h
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.h
@@ -15,11 +15,12 @@ class ChromeFont;
class TabContents;
class TabStrip;
namespace views {
+class ImageButton;
class WindowResources;
}
class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public TabIconView::TabIconViewModel {
public:
// Constructs a non-client view for an BrowserFrame. |is_otr| specifies if the
@@ -54,8 +55,8 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
virtual bool GetAccessibleName(std::wstring* name);
virtual void SetAccessibleName(const std::wstring& name);
- // Overridden from views::BaseButton::ButtonListener:
- virtual void ButtonPressed(views::BaseButton* sender);
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender);
// Overridden from TabIconView::TabIconViewModel:
virtual bool ShouldTabIconViewAnimate() const;
@@ -126,10 +127,10 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
gfx::Rect otr_avatar_bounds_;
// Window controls.
- views::Button* minimize_button_;
- views::Button* maximize_button_;
- views::Button* restore_button_;
- views::Button* close_button_;
+ views::ImageButton* minimize_button_;
+ views::ImageButton* maximize_button_;
+ views::ImageButton* restore_button_;
+ views::ImageButton* close_button_;
// The Window icon.
TabIconView* window_icon_;
diff --git a/chrome/browser/views/go_button.cc b/chrome/browser/views/go_button.cc
index fbdd6b8..db205c4 100644
--- a/chrome/browser/views/go_button.cc
+++ b/chrome/browser/views/go_button.cc
@@ -10,14 +10,18 @@
#include "chrome/common/l10n_util.h"
#include "grit/generated_resources.h"
+////////////////////////////////////////////////////////////////////////////////
+// GoButton, public:
+
GoButton::GoButton(LocationBarView* location_bar,
- CommandUpdater* command_updater) : ToggleButton(),
- location_bar_(location_bar),
- command_updater_(command_updater),
- intended_mode_(MODE_GO),
- visible_mode_(MODE_GO),
- button_delay_(NULL),
- stop_timer_(this) {
+ CommandUpdater* command_updater)
+ : ToggleImageButton(this),
+ location_bar_(location_bar),
+ command_updater_(command_updater),
+ intended_mode_(MODE_GO),
+ visible_mode_(MODE_GO),
+ button_delay_(NULL),
+ stop_timer_(this) {
DCHECK(location_bar_);
}
@@ -25,7 +29,40 @@ GoButton::~GoButton() {
stop_timer_.RevokeAll();
}
-void GoButton::NotifyClick(int mouse_event_flags) {
+void GoButton::ChangeMode(Mode mode) {
+ stop_timer_.RevokeAll();
+
+ SetToggled(mode == MODE_STOP);
+ intended_mode_ = mode;
+ visible_mode_ = mode;
+}
+
+void GoButton::ScheduleChangeMode(Mode mode) {
+ if (mode == MODE_STOP) {
+ // If we still have a timer running, we can't yet change to a stop sign,
+ // so we'll queue up the change for when the timer expires or for when
+ // the mouse exits the button.
+ if (!stop_timer_.empty() && state() == BS_HOT) {
+ intended_mode_ = MODE_STOP;
+ } else {
+ ChangeMode(MODE_STOP);
+ }
+ } else {
+ // If we want to change the button to a go button, but the user's mouse
+ // is hovering, don't change the mode just yet - this prevents the
+ // stop button changing to a go under the user's mouse cursor.
+ if (visible_mode_ == MODE_STOP && state() == BS_HOT) {
+ intended_mode_ = MODE_GO;
+ } else {
+ ChangeMode(MODE_GO);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// GoButton, views::ButtonListener implementation:
+
+void GoButton::ButtonPressed(views::Button* button) {
if (visible_mode_ == MODE_STOP) {
command_updater_->ExecuteCommand(IDC_STOP);
@@ -33,7 +70,7 @@ void GoButton::NotifyClick(int mouse_event_flags) {
// 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 doubleclick timer, go.
+ // If the go button is visible and not within the double click timer, go.
command_updater_->ExecuteCommand(IDC_GO);
// Figure out the system double-click time.
@@ -54,53 +91,19 @@ void GoButton::NotifyClick(int mouse_event_flags) {
}
}
+////////////////////////////////////////////////////////////////////////////////
+// GoButton, View overrides:
+
void GoButton::OnMouseExited(const views::MouseEvent& e) {
using namespace views;
if (visible_mode_ != intended_mode_)
ChangeMode(intended_mode_);
- if (GetState() != BS_DISABLED)
+ if (state() != BS_DISABLED)
SetState(BS_NORMAL);
}
-void GoButton::ChangeMode(Mode mode) {
- stop_timer_.RevokeAll();
-
- SetToggled(mode == MODE_STOP);
- intended_mode_ = mode;
- visible_mode_ = mode;
-}
-
-void GoButton::ScheduleChangeMode(Mode mode) {
- if (mode == MODE_STOP) {
- // If we still have a timer running, we can't yet change to a stop sign,
- // so we'll queue up the change for when the timer expires or for when
- // the mouse exits the button.
- if (!stop_timer_.empty() && GetState() == BS_HOT) {
- intended_mode_ = MODE_STOP;
- } else {
- ChangeMode(MODE_STOP);
- }
- } else {
- // If we want to change the button to a go button, but the user's mouse
- // is hovering, don't change the mode just yet - this prevents the
- // stop button changing to a go under the user's mouse cursor.
- if (visible_mode_ == MODE_STOP && GetState() == BS_HOT) {
- intended_mode_ = MODE_GO;
- } else {
- ChangeMode(MODE_GO);
- }
- }
-}
-
-void GoButton::OnButtonTimer() {
- if (intended_mode_ != visible_mode_)
- ChangeMode(intended_mode_);
-
- stop_timer_.RevokeAll();
-}
-
bool GoButton::GetTooltipText(int x, int y, std::wstring* tooltip) {
if (visible_mode_ == MODE_STOP) {
tooltip->assign(l10n_util::GetString(IDS_TOOLTIP_STOP));
@@ -131,3 +134,13 @@ bool GoButton::GetTooltipText(int x, int y, std::wstring* tooltip) {
l10n_util::GetStringF(IDS_TOOLTIP_GO_SEARCH, L"Google", current_text));
return true;
}
+
+////////////////////////////////////////////////////////////////////////////////
+// GoButton, private:
+
+void GoButton::OnButtonTimer() {
+ if (intended_mode_ != visible_mode_)
+ ChangeMode(intended_mode_);
+
+ stop_timer_.RevokeAll();
+}
diff --git a/chrome/browser/views/go_button.h b/chrome/browser/views/go_button.h
index 372bff5..306ae59 100644
--- a/chrome/browser/views/go_button.h
+++ b/chrome/browser/views/go_button.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VIEWS_GO_BUTTON_H__
#define CHROME_BROWSER_VIEWS_GO_BUTTON_H__
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "base/task.h"
class CommandUpdater;
@@ -19,11 +19,12 @@ class LocationBarView;
// according to the content of the location bar and changes to a stop
// button when a page load is in progress. Trickiness comes from the
// desire to have the 'stop' button not change back to 'go' if the user's
-// mouse is hovering over it (to prevent misclicks).
+// mouse is hovering over it (to prevent mis-clicks).
//
////////////////////////////////////////////////////////////////////////////////
-class GoButton : public views::ToggleButton {
+class GoButton : public views::ToggleImageButton,
+ public views::ButtonListener {
public:
// TODO(beng): get rid of the command updater param and instead have a
// delegate.
@@ -32,9 +33,6 @@ class GoButton : public views::ToggleButton {
typedef enum Mode { MODE_GO = 0, MODE_STOP };
- virtual void NotifyClick(int mouse_event_flags);
- virtual void OnMouseExited(const views::MouseEvent& e);
-
// Force the button state
void ChangeMode(Mode mode);
@@ -42,6 +40,11 @@ class GoButton : public views::ToggleButton {
// when page load state changes.
void ScheduleChangeMode(Mode mode);
+ // 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);
private:
@@ -52,7 +55,6 @@ class GoButton : public views::ToggleButton {
LocationBarView* location_bar_;
CommandUpdater* command_updater_;
- ButtonListener* listener_;
// The mode we should be in
Mode intended_mode_;
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index de1401f..4c4e621 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -12,7 +12,7 @@
#include "chrome/common/resource_bundle.h"
#include "chrome/common/slide_animation.h"
#include "chrome/views/background.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/external_focus_tracker.h"
#include "chrome/views/image_view.h"
#include "chrome/views/label.h"
@@ -71,7 +71,7 @@ class InfoBarBackground : public views::Background {
InfoBar::InfoBar(InfoBarDelegate* delegate)
: delegate_(delegate),
- close_button_(new views::Button),
+ close_button_(new views::ImageButton(this)),
delete_factory_(this) {
// We delete ourselves when we're removed from the view hierarchy.
SetParentOwned(false);
@@ -79,13 +79,12 @@ InfoBar::InfoBar(InfoBarDelegate* delegate)
set_background(new InfoBarBackground);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- close_button_->SetImage(views::Button::BS_NORMAL,
+ close_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_CLOSE_BAR));
- close_button_->SetImage(views::Button::BS_HOT,
+ close_button_->SetImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
- close_button_->SetImage(views::Button::BS_PUSHED,
+ close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
- close_button_->SetListener(this, 0);
close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
AddChildView(close_button_);
@@ -157,9 +156,9 @@ void InfoBar::RemoveInfoBar() const {
container_->RemoveDelegate(delegate());
}
-// InfoBar, views::BaseButton::ButtonListener implementation: ------------------
+// InfoBar, views::ButtonListener implementation: ------------------
-void InfoBar::ButtonPressed(views::BaseButton* sender) {
+void InfoBar::ButtonPressed(views::Button* sender) {
if (sender == close_button_)
RemoveInfoBar();
}
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h
index 15885ce..c7a0d38 100644
--- a/chrome/browser/views/infobars/infobars.h
+++ b/chrome/browser/views/infobars/infobars.h
@@ -6,14 +6,15 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_
#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "chrome/views/base_button.h"
+#include "chrome/common/animation.h"
+#include "chrome/views/button.h"
#include "chrome/views/link.h"
#include "chrome/views/native_button.h"
class InfoBarContainer;
class SlideAnimation;
namespace views {
-class Button;
+class ImageButton;
class ExternalFocusTracker;
class ImageView;
class Label;
@@ -24,7 +25,7 @@ class Label;
// that you must implement to use these.
class InfoBar : public views::View,
- public views::BaseButton::ButtonListener,
+ public views::ButtonListener,
public AnimationDelegate {
public:
explicit InfoBar(InfoBarDelegate* delegate);
@@ -70,8 +71,8 @@ class InfoBar : public views::View,
void RemoveInfoBar() const;
private:
- // Overridden from views::Button::ButtonListener:
- virtual void ButtonPressed(views::BaseButton* sender);
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender);
// Overridden from AnimationDelegate:
virtual void AnimationProgressed(const Animation* animation);
@@ -98,7 +99,7 @@ class InfoBar : public views::View,
InfoBarDelegate* delegate_;
// The Close Button at the right edge of the InfoBar.
- views::Button* close_button_;
+ views::ImageButton* close_button_;
// The animation that runs when the InfoBar is opened or closed.
scoped_ptr<SlideAnimation> animation_;
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 5f1a911..3de8cb9 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -123,7 +123,6 @@ Tab::Tab(TabDelegate* delegate)
delegate_(delegate),
closing_(false),
menu_controller_(NULL) {
- close_button()->SetListener(this, 0);
close_button()->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
close_button()->SetAnimationDuration(0);
SetContextMenuController(this);
@@ -237,9 +236,9 @@ void Tab::ShowContextMenu(views::View* source, int x, int y,
}
///////////////////////////////////////////////////////////////////////////////
-// views::BaseButton::ButtonListener implementation:
+// views::ButtonListener implementation:
-void Tab::ButtonPressed(views::BaseButton* sender) {
+void Tab::ButtonPressed(views::Button* sender) {
if (sender == close_button())
delegate_->CloseTab(this);
}
diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h
index 9c136ae..9230dd0 100644
--- a/chrome/browser/views/tabs/tab.h
+++ b/chrome/browser/views/tabs/tab.h
@@ -7,7 +7,6 @@
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/views/tabs/tab_renderer.h"
-#include "chrome/views/base_button.h"
namespace gfx {
class Path;
@@ -24,8 +23,7 @@ class Profile;
//
///////////////////////////////////////////////////////////////////////////////
class Tab : public TabRenderer,
- public views::ContextMenuController,
- public views::BaseButton::ButtonListener {
+ public views::ContextMenuController {
public:
static const std::string kTabClassName;
@@ -114,8 +112,8 @@ class Tab : public TabRenderer,
int y,
bool is_mouse_gesture);
- // views::BaseButton::ButtonListener overrides:
- virtual void ButtonPressed(views::BaseButton* sender);
+ // views::ButtonListener overrides:
+ virtual void ButtonPressed(views::Button* sender);
// Creates a path that contains the clickable region of the tab's visual
// representation. Used by GetViewForPoint for hit-testing.
diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc
index 654acea..125bce4 100644
--- a/chrome/browser/views/tabs/tab_renderer.cc
+++ b/chrome/browser/views/tabs/tab_renderer.cc
@@ -132,13 +132,15 @@ int GetContentHeight() {
//
// This is a Button subclass that causes middle clicks to be forwarded to the
// parent View by explicitly not handling them in OnMousePressed.
-class TabCloseButton : public views::Button {
+class TabCloseButton : public views::ImageButton {
public:
- TabCloseButton() : Button() {}
+ explicit TabCloseButton(views::ButtonListener* listener)
+ : views::ImageButton(listener) {
+ }
virtual ~TabCloseButton() {}
virtual bool OnMousePressed(const views::MouseEvent& event) {
- bool handled = BaseButton::OnMousePressed(event);
+ bool handled = ImageButton::OnMousePressed(event);
// Explicitly mark midle-mouse clicks as non-handled to ensure the tab
// sees them.
return event.IsOnlyMiddleMouseButton() ? false : handled;
@@ -148,12 +150,12 @@ class TabCloseButton : public views::Button {
// can highlight itself appropriately. Note that Exit events
// fire before Enter events, so this works.
virtual void OnMouseEntered(const views::MouseEvent& event) {
- BaseButton::OnMouseEntered(event);
+ CustomButton::OnMouseEntered(event);
GetParent()->OnMouseEntered(event);
}
virtual void OnMouseExited(const views::MouseEvent& event) {
- BaseButton::OnMouseExited(event);
+ CustomButton::OnMouseExited(event);
GetParent()->OnMouseExited(event);
}
@@ -217,10 +219,10 @@ TabRenderer::TabRenderer()
InitResources();
// Add the Close Button.
- close_button_ = new TabCloseButton;
- close_button_->SetImage(views::Button::BS_NORMAL, close_button_n);
- close_button_->SetImage(views::Button::BS_HOT, close_button_h);
- close_button_->SetImage(views::Button::BS_PUSHED, close_button_p);
+ close_button_ = new TabCloseButton(this);
+ close_button_->SetImage(views::CustomButton::BS_NORMAL, close_button_n);
+ close_button_->SetImage(views::CustomButton::BS_HOT, close_button_h);
+ close_button_->SetImage(views::CustomButton::BS_PUSHED, close_button_p);
AddChildView(close_button_);
hover_animation_.reset(new SlideAnimation(this));
diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h
index 5e2416f..df4cd6c 100644
--- a/chrome/browser/views/tabs/tab_renderer.h
+++ b/chrome/browser/views/tabs/tab_renderer.h
@@ -9,7 +9,7 @@
#include "chrome/common/animation.h"
#include "chrome/common/slide_animation.h"
#include "chrome/common/throb_animation.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/menu.h"
#include "chrome/views/view.h"
@@ -23,6 +23,7 @@ class TabContents;
//
///////////////////////////////////////////////////////////////////////////////
class TabRenderer : public views::View,
+ public views::ButtonListener,
public AnimationDelegate {
public:
// Possible animation states.
@@ -68,12 +69,15 @@ class TabRenderer : public views::View,
static void LoadTabImages(bool use_vista_images);
protected:
- views::Button* close_button() const { return close_button_; }
+ views::ImageButton* close_button() const { return close_button_; }
const gfx::Rect& title_bounds() const { return title_bounds_; }
// Returns the title of the Tab.
std::wstring GetTitle() const;
+ // views::ButtonListener overrides:
+ virtual void ButtonPressed(views::Button* sender) {}
+
private:
// Overridden from views::View:
virtual void Paint(ChromeCanvas* canvas);
@@ -129,7 +133,7 @@ class TabRenderer : public views::View,
int animation_frame_;
// Close Button.
- views::Button* close_button_;
+ views::ImageButton* close_button_;
// Hover animation.
scoped_ptr<SlideAnimation> hover_animation_;
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index d2d4beb..2829289 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -60,9 +60,11 @@ static inline int Round(double x) {
//
// A subclass of button that hit-tests to the shape of the new tab button.
-class NewTabButton : public views::Button {
+class NewTabButton : public views::ImageButton {
public:
- NewTabButton() {}
+ explicit NewTabButton(views::ButtonListener* listener)
+ : views::ImageButton(listener) {
+ }
virtual ~NewTabButton() {}
protected:
@@ -1005,7 +1007,7 @@ bool TabStrip::HasAvailableDragActions() const {
///////////////////////////////////////////////////////////////////////////////
// TabStrip, views::BaseButton::ButtonListener implementation:
-void TabStrip::ButtonPressed(views::BaseButton* sender) {
+void TabStrip::ButtonPressed(views::Button* sender) {
if (sender == newtab_button_)
model_->AddBlankTab(true);
}
@@ -1069,16 +1071,15 @@ void TabStrip::DidProcessMessage(const MSG& msg) {
void TabStrip::Init() {
model_->AddObserver(this);
- newtab_button_ = new NewTabButton;
- newtab_button_->SetListener(this, TabStripModel::kNoTab);
+ newtab_button_ = new NewTabButton(this);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SkBitmap* bitmap;
bitmap = rb.GetBitmapNamed(IDR_NEWTAB_BUTTON);
- newtab_button_->SetImage(views::Button::BS_NORMAL, bitmap);
- newtab_button_->SetImage(views::Button::BS_PUSHED,
+ newtab_button_->SetImage(views::CustomButton::BS_NORMAL, bitmap);
+ newtab_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_NEWTAB_BUTTON_P));
- newtab_button_->SetImage(views::Button::BS_HOT,
+ newtab_button_->SetImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_NEWTAB_BUTTON_H));
newtab_button_size_.SetSize(bitmap->width(), bitmap->height());
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index e673507..7ee81149 100644
--- a/chrome/browser/views/tabs/tab_strip.h
+++ b/chrome/browser/views/tabs/tab_strip.h
@@ -8,7 +8,7 @@
#include "base/gfx/point.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/views/tabs/tab.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
#include "chrome/views/menu.h"
#include "chrome/views/view.h"
#include "chrome/views/widget_win.h"
@@ -37,7 +37,7 @@ class ImageView;
class TabStrip : public views::View,
public TabStripModelObserver,
public Tab::TabDelegate,
- public views::Button::ButtonListener,
+ public views::ButtonListener,
public MessageLoopForUI::Observer {
public:
TabStrip(TabStripModel* model);
@@ -138,8 +138,8 @@ class TabStrip : public views::View,
virtual bool EndDrag(bool canceled);
virtual bool HasAvailableDragActions() const;
- // views::Button::ButtonListener implementation:
- virtual void ButtonPressed(views::BaseButton* sender);
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender);
// MessageLoop::Observer implementation:
virtual void WillProcessMessage(const MSG& msg);
@@ -289,7 +289,7 @@ class TabStrip : public views::View,
bool resize_layout_scheduled_;
// The "New Tab" button.
- views::Button* newtab_button_;
+ views::ImageButton* newtab_button_;
gfx::Size newtab_button_size_;
gfx::Size actual_newtab_button_size_;
diff --git a/chrome/browser/views/toolbar_star_toggle.cc b/chrome/browser/views/toolbar_star_toggle.cc
index acc5a9e..b76f442 100644
--- a/chrome/browser/views/toolbar_star_toggle.cc
+++ b/chrome/browser/views/toolbar_star_toggle.cc
@@ -27,8 +27,10 @@ using base::TimeTicks;
// with the bubble because it has other native windows.
static const int64 kDisallowClickMS = 40;
-ToolbarStarToggle::ToolbarStarToggle(BrowserToolbarView* host)
- : host_(host),
+ToolbarStarToggle::ToolbarStarToggle(views::ButtonListener* listener,
+ BrowserToolbarView* host)
+ : ToggleImageButton(listener),
+ host_(host),
ignore_click_(false) {
}
@@ -49,23 +51,23 @@ void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
bool ToolbarStarToggle::OnMousePressed(const views::MouseEvent& e) {
ignore_click_ = ((TimeTicks::Now() - bubble_closed_time_).InMilliseconds() <
kDisallowClickMS);
- return ToggleButton::OnMousePressed(e);
+ return ToggleImageButton::OnMousePressed(e);
}
void ToolbarStarToggle::OnMouseReleased(const views::MouseEvent& e,
bool canceled) {
- ToggleButton::OnMouseReleased(e, canceled);
+ ToggleImageButton::OnMouseReleased(e, canceled);
ignore_click_ = false;
}
void ToolbarStarToggle::OnDragDone() {
- ToggleButton::OnDragDone();
+ ToggleImageButton::OnDragDone();
ignore_click_ = false;
}
void ToolbarStarToggle::NotifyClick(int mouse_event_flags) {
if (!ignore_click_ && !BookmarkBubbleView::IsShowing())
- ToggleButton::NotifyClick(mouse_event_flags);
+ ToggleImageButton::NotifyClick(mouse_event_flags);
}
SkBitmap ToolbarStarToggle::GetImageToPaint() {
@@ -73,7 +75,7 @@ SkBitmap ToolbarStarToggle::GetImageToPaint() {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
return *rb.GetBitmapNamed(IDR_STARRED_P);
}
- return Button::GetImageToPaint();
+ return ImageButton::GetImageToPaint();
}
void ToolbarStarToggle::InfoBubbleClosing(InfoBubble* info_bubble,
diff --git a/chrome/browser/views/toolbar_star_toggle.h b/chrome/browser/views/toolbar_star_toggle.h
index a794bb9..8b8d766 100644
--- a/chrome/browser/views/toolbar_star_toggle.h
+++ b/chrome/browser/views/toolbar_star_toggle.h
@@ -7,7 +7,7 @@
#include "base/time.h"
#include "chrome/browser/views/info_bubble.h"
-#include "chrome/views/button.h"
+#include "chrome/views/image_button.h"
class BrowserToolbarView;
class GURL;
@@ -16,10 +16,10 @@ class GURL;
// user to star the current page. ToolbarStarToggle manages showing the
// InfoBubble and rendering the appropriate state while the bubble is visible.
-class ToolbarStarToggle : public views::ToggleButton,
+class ToolbarStarToggle : public views::ToggleImageButton,
public InfoBubbleDelegate {
public:
- explicit ToolbarStarToggle(BrowserToolbarView* host);
+ ToolbarStarToggle(views::ButtonListener* listener, BrowserToolbarView* host);
// If the bubble isn't showing, shows it.
void ShowStarBubble(const GURL& url, bool newly_bookmarked);
@@ -32,10 +32,10 @@ class ToolbarStarToggle : public views::ToggleButton,
virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled);
virtual void OnDragDone();
+ protected:
// Only invokes super if ignore_click_ is true and the bubble isn't showing.
virtual void NotifyClick(int mouse_event_flags);
- protected:
// Overridden to so that we appear pressed while the bubble is showing.
virtual SkBitmap GetImageToPaint();
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 02495fc..e0165c6 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -132,47 +132,55 @@ void BrowserToolbarView::SetProfile(Profile* profile) {
void BrowserToolbarView::CreateLeftSideControls() {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
- back_ = new views::ButtonDropDown(back_menu_model_.get());
- back_->SetListener(this, IDC_BACK);
- back_->SetImageAlignment(views::Button::ALIGN_RIGHT,
- views::Button::ALIGN_TOP);
- back_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_BACK));
- back_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_BACK_H));
- back_->SetImage(views::Button::BS_PUSHED, rb.GetBitmapNamed(IDR_BACK_P));
- back_->SetImage(views::Button::BS_DISABLED, rb.GetBitmapNamed(IDR_BACK_D));
+ back_ = new views::ButtonDropDown(this, back_menu_model_.get());
+ back_->set_tag(IDC_BACK);
+ back_->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
+ views::ImageButton::ALIGN_TOP);
+ back_->SetImage(views::CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_BACK));
+ back_->SetImage(views::CustomButton::BS_HOT, rb.GetBitmapNamed(IDR_BACK_H));
+ back_->SetImage(views::CustomButton::BS_PUSHED,
+ rb.GetBitmapNamed(IDR_BACK_P));
+ back_->SetImage(views::CustomButton::BS_DISABLED,
+ rb.GetBitmapNamed(IDR_BACK_D));
back_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_BACK));
back_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BACK));
back_->SetID(VIEW_ID_BACK_BUTTON);
AddChildView(back_);
- forward_ = new views::ButtonDropDown(forward_menu_model_.get());
- forward_->SetListener(this, IDC_FORWARD);
- forward_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_FORWARD));
- forward_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_FORWARD_H));
- forward_->SetImage(views::Button::BS_PUSHED,
+ forward_ = new views::ButtonDropDown(this, forward_menu_model_.get());
+ forward_->set_tag(IDC_FORWARD);
+ forward_->SetImage(views::CustomButton::BS_NORMAL,
+ rb.GetBitmapNamed(IDR_FORWARD));
+ forward_->SetImage(views::CustomButton::BS_HOT,
+ rb.GetBitmapNamed(IDR_FORWARD_H));
+ forward_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_FORWARD_P));
- forward_->SetImage(views::Button::BS_DISABLED,
+ forward_->SetImage(views::CustomButton::BS_DISABLED,
rb.GetBitmapNamed(IDR_FORWARD_D));
forward_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_FORWARD));
forward_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_FORWARD));
forward_->SetID(VIEW_ID_FORWARD_BUTTON);
AddChildView(forward_);
- reload_ = new views::Button();
- reload_->SetListener(this, IDC_RELOAD);
- reload_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_RELOAD));
- reload_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_RELOAD_H));
- reload_->SetImage(views::Button::BS_PUSHED, rb.GetBitmapNamed(IDR_RELOAD_P));
+ reload_ = new views::ImageButton(this);
+ reload_->set_tag(IDC_RELOAD);
+ reload_->SetImage(views::CustomButton::BS_NORMAL,
+ rb.GetBitmapNamed(IDR_RELOAD));
+ reload_->SetImage(views::CustomButton::BS_HOT,
+ rb.GetBitmapNamed(IDR_RELOAD_H));
+ reload_->SetImage(views::CustomButton::BS_PUSHED,
+ rb.GetBitmapNamed(IDR_RELOAD_P));
reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD));
reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD));
reload_->SetID(VIEW_ID_RELOAD_BUTTON);
AddChildView(reload_);
- home_ = new views::Button();
- home_->SetListener(this, IDC_HOME);
- home_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_HOME));
- home_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_HOME_H));
- home_->SetImage(views::Button::BS_PUSHED, rb.GetBitmapNamed(IDR_HOME_P));
+ home_ = new views::ImageButton(this);
+ 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));
+ home_->SetImage(views::CustomButton::BS_PUSHED,
+ rb.GetBitmapNamed(IDR_HOME_P));
home_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_HOME));
home_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_HOME));
home_->SetID(VIEW_ID_HOME_BUTTON);
@@ -182,17 +190,19 @@ void BrowserToolbarView::CreateLeftSideControls() {
void BrowserToolbarView::CreateCenterStack(Profile *profile) {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
- star_ = new ToolbarStarToggle(this);
- star_->SetListener(this, IDC_STAR);
- star_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_STAR));
- star_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_STAR_H));
- star_->SetImage(views::Button::BS_PUSHED, rb.GetBitmapNamed(IDR_STAR_P));
- star_->SetImage(views::Button::BS_DISABLED, rb.GetBitmapNamed(IDR_STAR_D));
- star_->SetToggledImage(views::Button::BS_NORMAL,
+ star_ = new ToolbarStarToggle(this, this);
+ star_->set_tag(IDC_STAR);
+ star_->SetImage(views::CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_STAR));
+ star_->SetImage(views::CustomButton::BS_HOT, rb.GetBitmapNamed(IDR_STAR_H));
+ star_->SetImage(views::CustomButton::BS_PUSHED,
+ rb.GetBitmapNamed(IDR_STAR_P));
+ star_->SetImage(views::CustomButton::BS_DISABLED,
+ rb.GetBitmapNamed(IDR_STAR_D));
+ star_->SetToggledImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_STARRED));
- star_->SetToggledImage(views::Button::BS_HOT,
+ star_->SetToggledImage(views::CustomButton::BS_HOT,
rb.GetBitmapNamed(IDR_STARRED_H));
- star_->SetToggledImage(views::Button::BS_PUSHED,
+ star_->SetToggledImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_STARRED_P));
star_->SetDragController(this);
star_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_STAR));
@@ -209,12 +219,14 @@ void BrowserToolbarView::CreateCenterStack(Profile *profile) {
// The Go button.
go_ = new GoButton(location_bar_, browser_->command_updater());
- go_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_GO));
- go_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_GO_H));
- go_->SetImage(views::Button::BS_PUSHED, rb.GetBitmapNamed(IDR_GO_P));
- go_->SetToggledImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_STOP));
- go_->SetToggledImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_STOP_H));
- go_->SetToggledImage(views::Button::BS_PUSHED,
+ 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));
+ go_->SetToggledImage(views::CustomButton::BS_NORMAL,
+ rb.GetBitmapNamed(IDR_STOP));
+ go_->SetToggledImage(views::CustomButton::BS_HOT,
+ rb.GetBitmapNamed(IDR_STOP_H));
+ go_->SetToggledImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_STOP_P));
go_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_GO));
go_->SetID(VIEW_ID_GO_BUTTON);
@@ -241,7 +253,7 @@ void BrowserToolbarView::OnInputInProgress(bool in_progress) {
void BrowserToolbarView::CreateRightSideControls(Profile* profile) {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
- page_menu_ = new views::MenuButton(std::wstring(), this, false);
+ page_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
// We use different menu button images if the locale is right-to-left.
if (UILayoutIsRightToLeft())
@@ -254,7 +266,7 @@ void BrowserToolbarView::CreateRightSideControls(Profile* profile) {
page_menu_->SetID(VIEW_ID_PAGE_MENU);
AddChildView(page_menu_);
- app_menu_ = new views::MenuButton(std::wstring(), this, false);
+ app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
if (UILayoutIsRightToLeft())
app_menu_->SetIcon(*rb.GetBitmapNamed(IDR_MENU_CHROME_RTL));
else
@@ -804,8 +816,8 @@ void BrowserToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
button->SetEnabled(enabled);
}
-void BrowserToolbarView::ButtonPressed(views::BaseButton* sender) {
- browser_->ExecuteCommand(sender->GetTag());
+void BrowserToolbarView::ButtonPressed(views::Button* sender) {
+ browser_->ExecuteCommand(sender->tag());
}
// static
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index 970b378..b1eb0da 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -42,7 +42,7 @@ class BrowserToolbarView : public views::View,
public NotificationObserver,
public GetProfilesHelper::Delegate,
public CommandUpdater::CommandObserver,
- public views::BaseButton::ButtonListener {
+ public views::ButtonListener {
public:
explicit BrowserToolbarView(Browser* browser);
virtual ~BrowserToolbarView();
@@ -121,7 +121,7 @@ class BrowserToolbarView : public views::View,
virtual void EnabledStateChangedForCommand(int id, bool enabled);
// Overridden from views::BaseButton::ButtonListener:
- virtual void ButtonPressed(views::BaseButton* sender);
+ virtual void ButtonPressed(views::Button* sender);
private:
// Types of display mode this toolbar can have.
@@ -183,10 +183,10 @@ class BrowserToolbarView : public views::View,
views::View* acc_focused_view_;
// Controls
- views::Button* back_;
- views::Button* forward_;
- views::Button* reload_;
- views::Button* home_;
+ views::ImageButton* back_;
+ views::ImageButton* forward_;
+ views::ImageButton* reload_;
+ views::ImageButton* home_;
ToolbarStarToggle* star_;
LocationBarView* location_bar_;
GoButton* go_;