| Index: chrome/browser/ui/views/toolbar/browser_action_view.cc
|
| diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.cc b/chrome/browser/ui/views/toolbar/browser_action_view.cc
|
| index 6c131166f3e5ef79508575492b039740fbe22465..e277c3cd82b50b2bc4c6a84069a3181e0448c063 100644
|
| --- a/chrome/browser/ui/views/toolbar/browser_action_view.cc
|
| +++ b/chrome/browser/ui/views/toolbar/browser_action_view.cc
|
| @@ -37,14 +37,6 @@ using extensions::Extension;
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // BrowserActionView
|
|
|
| -bool BrowserActionView::Delegate::NeedToShowMultipleIconStates() const {
|
| - return true;
|
| -}
|
| -
|
| -bool BrowserActionView::Delegate::NeedToShowTooltip() const {
|
| - return true;
|
| -}
|
| -
|
| BrowserActionView::BrowserActionView(const Extension* extension,
|
| Browser* browser,
|
| BrowserActionView::Delegate* delegate)
|
| @@ -110,7 +102,7 @@ BrowserActionButton::BrowserActionButton(const Extension* extension,
|
| called_registered_extension_command_(false),
|
| icon_observer_(NULL) {
|
| SetBorder(views::Border::NullBorder());
|
| - set_alignment(TextButton::ALIGN_CENTER);
|
| + SetHorizontalAlignment(gfx::ALIGN_CENTER);
|
| set_context_menu_controller(this);
|
|
|
| // No UpdateState() here because View hierarchy not setup yet. Our parent
|
| @@ -211,8 +203,6 @@ void BrowserActionButton::UpdateState() {
|
| if (tab_id < 0)
|
| return;
|
|
|
| - SetShowMultipleIconStates(delegate_->NeedToShowMultipleIconStates());
|
| -
|
| if (!IsEnabled(tab_id)) {
|
| SetState(views::CustomButton::STATE_DISABLED);
|
| } else {
|
| @@ -231,21 +221,23 @@ void BrowserActionButton::UpdateState() {
|
| ThemeServiceFactory::GetForProfile(browser_->profile());
|
|
|
| gfx::ImageSkia bg = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION);
|
| - SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
|
| + SetImage(views::Button::STATE_NORMAL,
|
| + gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
|
|
|
| gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H);
|
| - SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon));
|
| + SetImage(views::Button::STATE_HOVERED,
|
| + gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon));
|
|
|
| gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P);
|
| - SetPushedIcon(
|
| - gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon));
|
| + SetImage(views::Button::STATE_PRESSED,
|
| + gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon));
|
| }
|
|
|
| // If the browser action name is empty, show the extension name instead.
|
| std::string title = browser_action()->GetTitle(tab_id);
|
| base::string16 name =
|
| base::UTF8ToUTF16(title.empty() ? extension()->name() : title);
|
| - SetTooltipText(delegate_->NeedToShowTooltip() ? name : base::string16());
|
| + SetTooltipText(name);
|
| SetAccessibleName(name);
|
|
|
| parent()->SchedulePaint();
|
| @@ -320,7 +312,7 @@ bool BrowserActionButton::Activate() {
|
| bool BrowserActionButton::OnMousePressed(const ui::MouseEvent& event) {
|
| if (!event.IsRightMouseButton()) {
|
| return IsPopup() ? MenuButton::OnMousePressed(event) :
|
| - TextButton::OnMousePressed(event);
|
| + LabelButton::OnMousePressed(event);
|
| }
|
|
|
| if (!views::View::ShouldShowContextMenuOnMousePress()) {
|
| @@ -338,7 +330,7 @@ void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) {
|
| // loss of focus).
|
| MenuButton::OnMouseReleased(event);
|
| } else {
|
| - TextButton::OnMouseReleased(event);
|
| + LabelButton::OnMouseReleased(event);
|
| }
|
| }
|
|
|
| @@ -346,19 +338,19 @@ void BrowserActionButton::OnMouseExited(const ui::MouseEvent& event) {
|
| if (IsPopup() || context_menu_)
|
| MenuButton::OnMouseExited(event);
|
| else
|
| - TextButton::OnMouseExited(event);
|
| + LabelButton::OnMouseExited(event);
|
| }
|
|
|
| bool BrowserActionButton::OnKeyReleased(const ui::KeyEvent& event) {
|
| return IsPopup() ? MenuButton::OnKeyReleased(event) :
|
| - TextButton::OnKeyReleased(event);
|
| + LabelButton::OnKeyReleased(event);
|
| }
|
|
|
| void BrowserActionButton::OnGestureEvent(ui::GestureEvent* event) {
|
| if (IsPopup())
|
| MenuButton::OnGestureEvent(event);
|
| else
|
| - TextButton::OnGestureEvent(event);
|
| + LabelButton::OnGestureEvent(event);
|
| }
|
|
|
| bool BrowserActionButton::AcceleratorPressed(
|
| @@ -391,7 +383,7 @@ gfx::ImageSkia BrowserActionButton::GetIconWithBadge() {
|
| }
|
|
|
| gfx::ImageSkia BrowserActionButton::GetIconForTest() {
|
| - return icon();
|
| + return GetImage(views::Button::STATE_NORMAL);
|
| }
|
|
|
| BrowserActionButton::~BrowserActionButton() {
|
|
|