summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/libgtk2ui/gtk2_border.cc19
-rw-r--r--chrome/browser/ui/libgtk2ui/gtk2_border.h8
-rw-r--r--chrome/browser/ui/libgtk2ui/gtk2_ui.cc5
-rw-r--r--chrome/browser/ui/libgtk2ui/gtk2_ui.h2
-rw-r--r--chrome/browser/ui/views/autofill/autofill_dialog_views.cc3
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc111
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.h10
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc70
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc2
-rw-r--r--chrome/browser/ui/views/content_setting_bubble_contents.cc10
-rw-r--r--chrome/browser/ui/views/find_bar_view.cc1
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc2
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.cc5
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc1
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views.cc2
-rw-r--r--chrome/browser/ui/views/profiles/avatar_label.cc1
-rw-r--r--chrome/browser/ui/views/profiles/new_avatar_button.cc47
-rw-r--r--chrome/browser/ui/views/profiles/new_avatar_button.h3
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc2
-rw-r--r--chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc4
-rw-r--r--chrome/browser/ui/views/toolbar/browser_action_view.cc36
-rw-r--r--chrome/browser/ui/views/toolbar/browser_action_view.h3
-rw-r--r--chrome/browser/ui/views/toolbar/browser_actions_container.cc40
-rw-r--r--chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc10
-rw-r--r--chrome/browser/ui/views/toolbar/wrench_toolbar_button.h3
-rw-r--r--chrome/browser/ui/views/website_settings/permission_selector_view.cc28
-rw-r--r--chrome/browser/ui/views/website_settings/permissions_bubble_view.cc2
-rw-r--r--ui/app_list/views/search_box_view.cc11
-rw-r--r--ui/message_center/views/notifier_settings_view.cc1
-rw-r--r--ui/views/button_drag_utils.cc24
-rw-r--r--ui/views/button_drag_utils.h13
-rw-r--r--ui/views/controls/button/custom_button.h4
-rw-r--r--ui/views/controls/button/label_button.cc12
-rw-r--r--ui/views/controls/button/label_button.h10
-rw-r--r--ui/views/controls/button/menu_button.cc26
-rw-r--r--ui/views/controls/button/menu_button.h11
-rw-r--r--ui/views/controls/button/radio_button.h2
-rw-r--r--ui/views/linux_ui/linux_ui.h3
38 files changed, 241 insertions, 306 deletions
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_border.cc b/chrome/browser/ui/libgtk2ui/gtk2_border.cc
index 0859637f..0863bcf 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_border.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_border.cc
@@ -17,7 +17,6 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/native_theme_delegate.h"
using views::Button;
@@ -64,7 +63,7 @@ class ButtonImageSkiaSource : public gfx::ImageSkiaSource {
Gtk2Border::Gtk2Border(Gtk2UI* gtk2_ui,
views::LabelButton* owning_button,
- scoped_ptr<views::LabelButtonBorder> border)
+ scoped_ptr<views::Border> border)
: gtk2_ui_(gtk2_ui),
owning_button_(owning_button),
border_(border.Pass()),
@@ -133,8 +132,7 @@ void Gtk2Border::PaintState(const ui::NativeTheme::State state,
bool focused = extra.button.is_focused;
Button::ButtonState views_state = Button::GetButtonStateFrom(state);
- if (border_->GetPainter(focused, views_state) ||
- (focused && border_->GetPainter(false, views_state))) {
+ if (ShouldDrawBorder(focused, views_state)) {
gfx::ImageSkia* image = &button_images_[focused][views_state];
if (image->isNull() || image->size() != rect.size()) {
@@ -147,4 +145,17 @@ void Gtk2Border::PaintState(const ui::NativeTheme::State state,
}
}
+bool Gtk2Border::ShouldDrawBorder(bool focused,
+ views::Button::ButtonState state) {
+ // This logic should be kept in sync with the LabelButtonBorder constructor.
+ if (owning_button_->style() == Button::STYLE_BUTTON) {
+ return true;
+ } else if (owning_button_->style() == Button::STYLE_TEXTBUTTON) {
+ return focused == false && (state == Button::STATE_HOVERED ||
+ state == Button::STATE_PRESSED);
+ }
+
+ return false;
+}
+
} // namespace libgtk2ui
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_border.h b/chrome/browser/ui/libgtk2ui/gtk2_border.h
index ebd41bf..ca1fcd4 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_border.h
+++ b/chrome/browser/ui/libgtk2ui/gtk2_border.h
@@ -18,7 +18,7 @@ class Canvas;
namespace views {
class LabelButton;
-class LabelButtonBorder;
+class Border;
}
namespace libgtk2ui {
@@ -29,7 +29,7 @@ class Gtk2Border : public views::Border, public ui::NativeThemeObserver {
public:
Gtk2Border(Gtk2UI* gtk2_ui,
views::LabelButton* owning_button,
- scoped_ptr<views::LabelButtonBorder> border);
+ scoped_ptr<views::Border> border);
virtual ~Gtk2Border();
// Overridden from views::Border:
@@ -46,6 +46,8 @@ class Gtk2Border : public views::Border, public ui::NativeThemeObserver {
const gfx::Rect& rect,
gfx::Canvas* canvas);
+ bool ShouldDrawBorder(bool focused, views::Button::ButtonState state);
+
Gtk2UI* gtk2_ui_;
gfx::ImageSkia button_images_[2][views::Button::STATE_COUNT];
@@ -56,7 +58,7 @@ class Gtk2Border : public views::Border, public ui::NativeThemeObserver {
// The views::Border that we are replacing in native mode. We keep track of
// this for inset information.
- scoped_ptr<views::LabelButtonBorder> border_;
+ scoped_ptr<views::Border> border_;
ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_;
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 293feeb..da56985 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -45,7 +45,6 @@
#include "ui/gfx/skbitmap_operations.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/linux_ui/window_button_order_observer.h"
#if defined(USE_GCONF)
@@ -558,9 +557,9 @@ gfx::Image Gtk2UI::GetIconForContentType(
scoped_ptr<views::Border> Gtk2UI::CreateNativeBorder(
views::LabelButton* owning_button,
- scoped_ptr<views::LabelButtonBorder> border) {
+ scoped_ptr<views::Border> border) {
if (owning_button->GetNativeTheme() != NativeThemeGtk2::instance())
- return border.PassAs<views::Border>();
+ return border.Pass();
return scoped_ptr<views::Border>(
new Gtk2Border(this, owning_button, border.Pass()));
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.h b/chrome/browser/ui/libgtk2ui/gtk2_ui.h
index 2ef92556..734f77d 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.h
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.h
@@ -103,7 +103,7 @@ class Gtk2UI : public views::LinuxUI {
const std::string& content_type, int size) const OVERRIDE;
virtual scoped_ptr<views::Border> CreateNativeBorder(
views::LabelButton* owning_button,
- scoped_ptr<views::LabelButtonBorder> border) OVERRIDE;
+ scoped_ptr<views::Border> border) OVERRIDE;
virtual void AddWindowButtonOrderObserver(
views::WindowButtonOrderObserver* observer) OVERRIDE;
virtual void RemoveWindowButtonOrderObserver(
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index a033401..72d99f3 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -507,7 +507,8 @@ void AutofillDialogViews::AccountChooser::Update() {
gfx::Image icon = delegate_->AccountChooserImage();
image_->SetImage(icon.AsImageSkia());
menu_button_->SetText(delegate_->AccountChooserText());
- menu_button_->set_min_size(gfx::Size());
+ // This allows the button to shrink if the new text is smaller.
+ menu_button_->ClearMaxTextSize();
bool show_link = !delegate_->MenuModelForAccountChooser();
menu_button_->SetVisible(!show_link);
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index f9d0012..3a4d1f8 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -73,11 +73,8 @@
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
-#include "ui/gfx/text_constants.h"
#include "ui/gfx/text_elider.h"
#include "ui/views/button_drag_utils.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/drag_utils.h"
@@ -93,7 +90,6 @@ using content::PageNavigator;
using content::Referrer;
using ui::DropTargetEvent;
using views::CustomButton;
-using views::LabelButtonBorder;
using views::MenuButton;
using views::View;
@@ -141,13 +137,6 @@ static const int kOtherFolderButtonTag = 1;
// Tag for the 'Apps Shortcut' button.
static const int kAppsShortcutButtonTag = 2;
-// Preferred padding between text and edge.
-//
-// Note that the vertical padding is one pixel less than it was in TextButton;
-// we clip the bottom of letters like 'g' or 'p' if we don't.
-static const int kButtonPaddingHorizontal = 6;
-static const int kButtonPaddingVertical = 4;
-
// Tag for the 'Managed bookmarks' button.
static const int kManagedFolderButtonTag = 3;
@@ -161,12 +150,11 @@ bool animations_enabled = true;
// Base class for text buttons used on the bookmark bar.
-class BookmarkButtonBase : public views::LabelButton {
+class BookmarkButtonBase : public views::TextButton {
public:
BookmarkButtonBase(views::ButtonListener* listener,
const base::string16& title)
- : LabelButton(listener, title) {
- SetElideBehavior(gfx::FADE_TAIL);
+ : TextButton(listener, title) {
show_animation_.reset(new gfx::SlideAnimation(this));
if (!animations_enabled) {
// For some reason during testing the events generated by animating
@@ -183,16 +171,6 @@ class BookmarkButtonBase : public views::LabelButton {
event_utils::IsPossibleDispositionEvent(e);
}
- virtual scoped_ptr<LabelButtonBorder> CreateDefaultBorder() const OVERRIDE {
- // We change the insets on the border to match the previous TextButton.
- scoped_ptr<LabelButtonBorder> border = LabelButton::CreateDefaultBorder();
- border->set_insets(gfx::Insets(kButtonPaddingVertical,
- kButtonPaddingHorizontal,
- kButtonPaddingVertical,
- kButtonPaddingHorizontal));
- return border.Pass();
- }
-
private:
scoped_ptr<gfx::SlideAnimation> show_animation_;
@@ -222,7 +200,7 @@ class BookmarkButton : public BookmarkButtonBase {
gfx::Point location(p);
ConvertPointToScreen(this, &location);
*tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(
- GetWidget(), location, url_, GetText(), profile_);
+ GetWidget(), location, url_, text(), profile_);
return !tooltip->empty();
}
@@ -289,8 +267,8 @@ class BookmarkFolderButton : public views::MenuButton {
virtual bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const OVERRIDE {
- if (label()->GetPreferredSize().width() > label()->size().width())
- *tooltip = GetText();
+ if (text_size_.width() > GetTextBounds().width())
+ *tooltip = text_;
return !tooltip->empty();
}
@@ -308,6 +286,10 @@ class BookmarkFolderButton : public views::MenuButton {
return false;
}
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
+ views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL);
+ }
+
private:
scoped_ptr<gfx::SlideAnimation> show_animation_;
@@ -440,7 +422,7 @@ const int BookmarkBarView::kMaxButtonWidth = 150;
const int BookmarkBarView::kNewtabHorizontalPadding = 2;
const int BookmarkBarView::kToolbarAttachedBookmarkBarOverlap = 3;
-const gfx::ImageSkia& GetDefaultFavicon() {
+static const gfx::ImageSkia& GetDefaultFavicon() {
if (!kDefaultFavicon) {
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
kDefaultFavicon = rb->GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
@@ -448,7 +430,7 @@ const gfx::ImageSkia& GetDefaultFavicon() {
return *kDefaultFavicon;
}
-const gfx::ImageSkia& GetFolderIcon() {
+static const gfx::ImageSkia& GetFolderIcon() {
if (!kFolderIcon) {
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
kFolderIcon = rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER);
@@ -1140,21 +1122,13 @@ void BookmarkBarView::WriteDragDataForView(View* sender,
for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
if (sender == GetBookmarkButton(i)) {
- views::LabelButton* button = GetBookmarkButton(i);
- const BookmarkNode* node = model_->bookmark_bar_node()->GetChild(i);
-
- const gfx::Image& image_from_model = model_->GetFavicon(node);
- const gfx::ImageSkia& icon = image_from_model.IsEmpty() ?
- (node->is_folder() ? GetFolderIcon() : GetDefaultFavicon()) :
- *image_from_model.ToImageSkia();
-
- button_drag_utils::SetDragImage(
- node->url(),
- node->GetTitle(),
- icon,
- &press_pt,
- data,
- button->GetWidget());
+ views::TextButton* button = GetBookmarkButton(i);
+ scoped_ptr<gfx::Canvas> canvas(
+ views::GetCanvasForDragImage(button->GetWidget(), button->size()));
+ button->PaintButton(canvas.get(), views::TextButton::PB_FOR_DRAG);
+ drag_utils::SetDragImageOnDataObject(*canvas,
+ press_pt.OffsetFromOrigin(),
+ data);
WriteBookmarkDragData(model_->bookmark_bar_node()->GetChild(i), data);
return;
}
@@ -1384,9 +1358,9 @@ int BookmarkBarView::GetBookmarkButtonCount() const {
return child_count() - 6;
}
-views::LabelButton* BookmarkBarView::GetBookmarkButton(int index) {
+views::TextButton* BookmarkBarView::GetBookmarkButton(int index) {
DCHECK(index >= 0 && index < GetBookmarkButtonCount());
- return static_cast<views::LabelButton*>(child_at(index));
+ return static_cast<views::TextButton*>(child_at(index));
}
BookmarkLaunchLocation BookmarkBarView::GetBookmarkLaunchLocation() const {
@@ -1408,7 +1382,7 @@ MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() {
MenuButton* button =
new BookmarkFolderButton(this, base::string16(), this, false);
button->set_id(VIEW_ID_OTHER_BOOKMARKS);
- button->SetImage(views::Button::STATE_NORMAL, GetFolderIcon());
+ button->SetIcon(GetFolderIcon());
button->set_context_menu_controller(this);
button->set_tag(kOtherFolderButtonTag);
return button;
@@ -1421,7 +1395,7 @@ MenuButton* BookmarkBarView::CreateManagedBookmarksButton() {
button->set_id(VIEW_ID_MANAGED_BOOKMARKS);
// TODO(joaodasilva): replace with a "managed folder" icon.
// http://crbug.com/49598
- button->SetImage(views::Button::STATE_NORMAL, GetFolderIcon());
+ button->SetIcon(GetFolderIcon());
button->set_context_menu_controller(this);
button->set_tag(kManagedFolderButtonTag);
return button;
@@ -1430,8 +1404,7 @@ MenuButton* BookmarkBarView::CreateManagedBookmarksButton() {
MenuButton* BookmarkBarView::CreateOverflowButton() {
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
MenuButton* button = new OverFlowButton(this);
- button->SetImage(views::Button::STATE_NORMAL,
- *rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_CHEVRONS));
+ button->SetIcon(*rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_CHEVRONS));
// The overflow button's image contains an arrow and therefore it is a
// direction sensitive image and we need to flip it if the UI layout is
@@ -1459,49 +1432,47 @@ views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) {
} else {
views::MenuButton* button = new BookmarkFolderButton(
this, node->GetTitle(), this, false);
- button->SetImage(views::Button::STATE_NORMAL, GetFolderIcon());
+ button->SetIcon(GetFolderIcon());
ConfigureButton(node, button);
return button;
}
}
-views::LabelButton* BookmarkBarView::CreateAppsPageShortcutButton() {
- views::LabelButton* button = new ShortcutButton(
+views::TextButton* BookmarkBarView::CreateAppsPageShortcutButton() {
+ views::TextButton* button = new ShortcutButton(
this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_APPS_SHORTCUT_NAME));
button->SetTooltipText(l10n_util::GetStringUTF16(
IDS_BOOKMARK_BAR_APPS_SHORTCUT_TOOLTIP));
button->set_id(VIEW_ID_BOOKMARK_BAR_ELEMENT);
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
- button->SetImage(views::Button::STATE_NORMAL,
- *rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT));
+ button->SetIcon(*rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT));
button->set_context_menu_controller(this);
button->set_tag(kAppsShortcutButtonTag);
return button;
}
void BookmarkBarView::ConfigureButton(const BookmarkNode* node,
- views::LabelButton* button) {
+ views::TextButton* button) {
button->SetText(node->GetTitle());
button->SetAccessibleName(node->GetTitle());
button->set_id(VIEW_ID_BOOKMARK_BAR_ELEMENT);
// We don't always have a theme provider (ui tests, for example).
if (GetThemeProvider()) {
- button->SetTextColor(
- views::Button::STATE_NORMAL,
- GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT));
+ button->SetEnabledColor(GetThemeProvider()->GetColor(
+ ThemeProperties::COLOR_BOOKMARK_TEXT));
}
- button->set_min_size(gfx::Size());
+ button->ClearMaxTextSize();
button->set_context_menu_controller(this);
button->set_drag_controller(this);
if (node->is_url()) {
const gfx::Image& favicon = model_->GetFavicon(node);
if (!favicon.IsEmpty())
- button->SetImage(views::Button::STATE_NORMAL, *favicon.ToImageSkia());
+ button->SetIcon(*favicon.ToImageSkia());
else
- button->SetImage(views::Button::STATE_NORMAL, GetDefaultFavicon());
+ button->SetIcon(GetDefaultFavicon());
}
- button->set_max_size(gfx::Size(kMaxButtonWidth, 0));
+ button->set_max_width(kMaxButtonWidth);
}
void BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model,
@@ -1561,7 +1532,7 @@ void BookmarkBarView::BookmarkNodeChangedImpl(BookmarkModel* model,
}
int index = model->bookmark_bar_node()->GetIndexOf(node);
DCHECK_NE(-1, index);
- views::LabelButton* button = GetBookmarkButton(index);
+ views::TextButton* button = GetBookmarkButton(index);
gfx::Size old_pref = button->GetPreferredSize();
ConfigureButton(node, button);
gfx::Size new_pref = button->GetPreferredSize();
@@ -1656,7 +1627,7 @@ void BookmarkBarView::CalculateDropLocation(const DropTargetEvent& event,
for (int i = 0; i < GetBookmarkButtonCount() &&
GetBookmarkButton(i)->visible() && !found; i++) {
- views::LabelButton* button = GetBookmarkButton(i);
+ views::TextButton* button = GetBookmarkButton(i);
int button_x = mirrored_x - button->x();
int button_w = button->width();
if (button_x < button_w) {
@@ -1795,14 +1766,14 @@ void BookmarkBarView::UpdateColors() {
const ui::ThemeProvider* theme_provider = GetThemeProvider();
if (!theme_provider)
return;
- SkColor color =
+ SkColor text_color =
theme_provider->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT);
for (int i = 0; i < GetBookmarkButtonCount(); ++i)
- GetBookmarkButton(i)->SetTextColor(views::Button::STATE_NORMAL, color);
- other_bookmarked_button_->SetTextColor(views::Button::STATE_NORMAL, color);
- managed_bookmarks_button_->SetTextColor(views::Button::STATE_NORMAL, color);
+ GetBookmarkButton(i)->SetEnabledColor(text_color);
+ other_bookmarked_button_->SetEnabledColor(text_color);
+ managed_bookmarks_button_->SetEnabledColor(text_color);
if (apps_page_shortcut_->visible())
- apps_page_shortcut_->SetTextColor(views::Button::STATE_NORMAL, color);
+ apps_page_shortcut_->SetEnabledColor(text_color);
}
void BookmarkBarView::UpdateButtonsVisibility() {
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h
index 5383d8980..65ae8e8 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h
@@ -46,7 +46,7 @@ namespace views {
class CustomButton;
class MenuButton;
class MenuItemView;
-class LabelButton;
+class TextButton;
}
// BookmarkBarView renders the BookmarkModel. Each starred entry on the
@@ -289,7 +289,7 @@ class BookmarkBarView : public DetachableToolbarView,
int GetBookmarkButtonCount() const;
// Returns the button at the specified index.
- views::LabelButton* GetBookmarkButton(int index);
+ views::TextButton* GetBookmarkButton(int index);
// Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or
// BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state.
@@ -312,11 +312,11 @@ class BookmarkBarView : public DetachableToolbarView,
views::View* CreateBookmarkButton(const BookmarkNode* node);
// Creates the button for rendering the apps page shortcut.
- views::LabelButton* CreateAppsPageShortcutButton();
+ views::TextButton* CreateAppsPageShortcutButton();
// Configures the button from the specified node. This sets the text,
// and icon.
- void ConfigureButton(const BookmarkNode* node, views::LabelButton* button);
+ void ConfigureButton(const BookmarkNode* node, views::TextButton* button);
// Implementation for BookmarkNodeAddedImpl.
void BookmarkNodeAddedImpl(BookmarkModel* model,
@@ -412,7 +412,7 @@ class BookmarkBarView : public DetachableToolbarView,
views::MenuButton* managed_bookmarks_button_;
// Shows the Apps page shortcut.
- views::LabelButton* apps_page_shortcut_;
+ views::TextButton* apps_page_shortcut_;
// Task used to delay showing of the drop menu.
base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index bc26a27..f52926e 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -300,7 +300,7 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
bb_view_pref_ = bb_view_->GetPreferredSize();
bb_view_pref_.set_width(1000);
- views::LabelButton* button = GetBookmarkButton(6);
+ views::TextButton* button = GetBookmarkButton(6);
while (button->visible()) {
bb_view_pref_.set_width(bb_view_pref_.width() - 25);
bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height());
@@ -342,7 +342,7 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
virtual gfx::Size GetPreferredSize() const OVERRIDE { return bb_view_pref_; }
- views::LabelButton* GetBookmarkButton(int view_index) {
+ views::TextButton* GetBookmarkButton(int view_index) {
return bb_view_->GetBookmarkButton(view_index);
}
@@ -401,7 +401,7 @@ class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest1::Step2));
@@ -415,7 +415,7 @@ class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
// Button should be depressed.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ASSERT_TRUE(button->state() == views::CustomButton::STATE_PRESSED);
// Click on the 2nd menu item (A URL).
@@ -434,7 +434,7 @@ class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url());
// Make sure button is no longer pushed.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL);
views::MenuItemView* menu = bb_view_->GetMenu();
@@ -452,7 +452,7 @@ class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest2::Step2));
@@ -490,7 +490,7 @@ class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing());
// Make sure button is no longer pushed.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL);
Done();
@@ -620,7 +620,7 @@ class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest4::Step2));
@@ -676,7 +676,7 @@ class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest5::Step2));
@@ -743,7 +743,7 @@ class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase {
protected:
virtual void DoTestOnMessageLoop() OVERRIDE {
// Press the mouse button on the overflow button. Don't release it though.
- views::LabelButton* button = bb_view_->overflow_button();
+ views::TextButton* button = bb_view_->overflow_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2));
}
@@ -784,7 +784,7 @@ class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest7::Step2));
@@ -809,7 +809,7 @@ class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase {
void Step3() {
// Drag over other button.
- views::LabelButton* other_button =
+ views::TextButton* other_button =
bb_view_->other_bookmarked_button();
gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
views::View::ConvertPointToScreen(other_button, &loc);
@@ -831,7 +831,7 @@ class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase {
void Step3A() {
// Drag over other button.
- views::LabelButton* other_button =
+ views::TextButton* other_button =
bb_view_->other_bookmarked_button();
gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
views::View::ConvertPointToScreen(other_button, &loc);
@@ -884,7 +884,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest8::Step2));
@@ -909,7 +909,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase {
void Step3() {
// Drag over other button.
- views::LabelButton* other_button =
+ views::TextButton* other_button =
bb_view_->other_bookmarked_button();
gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
views::View::ConvertPointToScreen(other_button, &loc);
@@ -930,7 +930,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase {
void Step3A() {
// Drag over other button.
- views::LabelButton* other_button =
+ views::TextButton* other_button =
bb_view_->other_bookmarked_button();
gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
views::View::ConvertPointToScreen(other_button, &loc);
@@ -945,7 +945,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(drop_menu->GetSubmenu()->IsShowing());
// Now drag back over first menu.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
gfx::Point loc(button->width() / 2, button->height() / 2);
views::View::ConvertPointToScreen(button, &loc);
ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(),
@@ -991,7 +991,7 @@ class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest9::Step2));
@@ -1060,7 +1060,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest10::Step2));
@@ -1174,7 +1174,7 @@ class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest11::Step2));
@@ -1249,7 +1249,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase {
protected:
virtual void DoTestOnMessageLoop() OVERRIDE {
// Open up the other folder.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest12::Step2));
@@ -1352,7 +1352,7 @@ class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest13::Step2));
@@ -1436,7 +1436,7 @@ class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// right mouse button.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
// Step2 will be invoked by BookmarkContextMenuNotificationObserver.
@@ -1475,7 +1475,7 @@ class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase {
protected:
virtual void DoTestOnMessageLoop() OVERRIDE {
// Show the other bookmarks.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest15::Step2));
@@ -1547,7 +1547,7 @@ class BookmarkBarViewTest16 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the first folder on the bookmark bar and press the
// mouse.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest16::Step2));
@@ -1561,7 +1561,7 @@ class BookmarkBarViewTest16 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
// Button should be depressed.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ASSERT_TRUE(button->state() == views::CustomButton::STATE_PRESSED);
// Close the window.
@@ -1594,7 +1594,7 @@ class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the other folder on the bookmark bar and press the
// left mouse button.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest17::Step2));
@@ -1678,7 +1678,7 @@ class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the other folder on the bookmark bar and press the
// left mouse button.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest18::Step2));
@@ -1692,7 +1692,7 @@ class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
// Move the mouse to the first folder on the bookmark bar
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
gfx::Point button_center(button->width() / 2, button->height() / 2);
views::View::ConvertPointToScreen(button, &button_center);
ui_controls::SendMouseMoveNotifyWhenDone(
@@ -1735,7 +1735,7 @@ class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase {
virtual void DoTestOnMessageLoop() OVERRIDE {
// Move the mouse to the other folder on the bookmark bar and press the
// left mouse button.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest19::Step2));
@@ -1764,7 +1764,7 @@ class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
// Move the mouse back to the other bookmark button.
- views::LabelButton* button = bb_view_->other_bookmarked_button();
+ views::TextButton* button = bb_view_->other_bookmarked_button();
gfx::Point button_center(button->width() / 2, button->height() / 2);
views::View::ConvertPointToScreen(button, &button_center);
ui_controls::SendMouseMoveNotifyWhenDone(
@@ -1834,7 +1834,7 @@ class BookmarkBarViewTest20 : public BookmarkBarViewEventTestBase {
// Move the mouse to the first folder on the bookmark bar and press the
// left mouse button.
- views::LabelButton* button = GetBookmarkButton(0);
+ views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(
button, ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest20::Step2));
@@ -1921,7 +1921,7 @@ class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase {
// Move the mouse to the empty folder on the bookmark bar and press the
// left mouse button.
virtual void DoTestOnMessageLoop() OVERRIDE {
- views::LabelButton* button = GetBookmarkButton(5);
+ views::TextButton* button = GetBookmarkButton(5);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
CreateEventTask(this, &BookmarkBarViewTest21::Step2));
@@ -1968,9 +1968,9 @@ class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase {
// Confirm that the empty folder gets removed and menu doesn't show.
void Step4() {
- views::LabelButton* button = GetBookmarkButton(5);
+ views::TextButton* button = GetBookmarkButton(5);
ASSERT_TRUE(button);
- EXPECT_EQ(ASCIIToUTF16("d"), button->GetText());
+ EXPECT_EQ(ASCIIToUTF16("d"), button->text());
EXPECT_TRUE(bb_view_->GetContextMenu() == NULL);
EXPECT_TRUE(bb_view_->GetMenu() == NULL);
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc
index 308a997..f17ba97 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc
@@ -18,7 +18,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_pref_service_syncable.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
-#include "ui/views/controls/button/label_button.h"
+#include "ui/views/controls/button/text_button.h"
class BookmarkBarViewInstantExtendedTest : public BrowserWithTestWindowTest {
public:
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc
index 59f12ac..5980bb6 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -293,7 +293,9 @@ void ContentSettingBubbleContents::Init() {
views::MenuButton* menu_button = new views::MenuButton(
NULL, base::UTF8ToUTF16((i->second.selected_device.name)),
this, true);
- menu_button->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ menu_button->set_alignment(views::TextButton::ALIGN_LEFT);
+ menu_button->SetBorder(scoped_ptr<views::Border>(
+ new views::TextButtonNativeThemeBorder(menu_button)));
menu_button->set_animate_on_state_change(false);
MediaMenuParts* menu_view = new MediaMenuParts(i->first);
@@ -335,8 +337,8 @@ void ContentSettingBubbleContents::Init() {
// Set all the menu buttons to the width we calculated above.
for (MediaMenuPartsMap::const_iterator i = media_menus_.begin();
i != media_menus_.end(); ++i) {
- i->first->set_min_size(gfx::Size(menu_width, 0));
- i->first->set_max_size(gfx::Size(menu_width, 0));
+ i->first->set_min_width(menu_width);
+ i->first->set_max_width(menu_width);
}
}
@@ -465,7 +467,7 @@ void ContentSettingBubbleContents::OnMenuButtonClicked(
int ContentSettingBubbleContents::GetPreferredMediaMenuWidth(
views::MenuButton* button,
ui::SimpleMenuModel* menu_model) {
- base::string16 title = button->GetText();
+ base::string16 title = button->text();
int width = button->GetPreferredSize().width();
for (int i = 0; i < menu_model->GetItemCount(); ++i) {
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index e0dd961..37bca60 100644
--- a/chrome/browser/ui/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -28,7 +28,6 @@
#include "ui/base/theme_provider.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
-#include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/painter.h"
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index a7ff5ba..d9ea3c2 100644
--- a/chrome/browser/ui/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
@@ -208,7 +208,7 @@ void ExtensionInfoBar::OnImageLoaded(const gfx::Image& image) {
gfx::CanvasImageSource* source = new MenuImageSource(*icon, *drop_image);
gfx::ImageSkia menu_image = gfx::ImageSkia(source, source->size());
- icon_as_menu_->SetImage(views::Button::STATE_NORMAL, menu_image);
+ icon_as_menu_->SetIcon(menu_image);
} else {
icon_as_image_->SetImage(*icon);
}
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index 3874c8a..cd5da729 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -23,7 +23,6 @@
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/button/text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
@@ -130,8 +129,8 @@ views::MenuButton* InfoBarView::CreateMenuButton(
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
menu_button->set_menu_marker(
rb.GetImageNamed(IDR_INFOBARBUTTON_MENU_DROPARROW).ToImageSkia());
- menu_button->SetTextColor(views::Button::STATE_NORMAL, SK_ColorBLACK);
- menu_button->SetTextColor(views::Button::STATE_HOVERED, SK_ColorBLACK);
+ menu_button->SetEnabledColor(SK_ColorBLACK);
+ menu_button->SetHoverColor(SK_ColorBLACK);
menu_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont));
menu_button->SizeToPreferredSize();
menu_button->SetFocusable(true);
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 26c959c..8221529 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -1641,7 +1641,6 @@ void LocationBarView::WriteDragDataForView(views::View* sender,
button_drag_utils::SetURLAndDragImage(web_contents->GetURL(),
web_contents->GetTitle(),
favicon,
- NULL,
data,
sender->GetWidget());
}
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 538d386..08f77a5 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -944,7 +944,7 @@ void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) {
if (is_all_selected)
model()->GetDataForURLExport(&url, &title, &favicon);
button_drag_utils::SetURLAndDragImage(url, title, favicon.AsImageSkia(),
- NULL, data, GetWidget());
+ data, GetWidget());
data->SetURL(url, title);
}
}
diff --git a/chrome/browser/ui/views/profiles/avatar_label.cc b/chrome/browser/ui/views/profiles/avatar_label.cc
index 7650091..7b7bad7 100644
--- a/chrome/browser/ui/views/profiles/avatar_label.cc
+++ b/chrome/browser/ui/views/profiles/avatar_label.cc
@@ -14,7 +14,6 @@
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
-#include "ui/views/border.h"
#include "ui/views/painter.h"
namespace {
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc
index 117f703..173eb14 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/profiles/new_avatar_button.h"
-#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -19,34 +18,29 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/font_list.h"
-#include "ui/gfx/text_constants.h"
#include "ui/gfx/text_elider.h"
#include "ui/views/border.h"
-#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/painter.h"
namespace {
// Text padding within the button border.
-const int kLeftRightInset = 7;
-const int kTopBottomInset = 2;
+const int kInset = 10;
scoped_ptr<views::Border> CreateBorder(const int normal_image_set[],
const int hot_image_set[],
const int pushed_image_set[]) {
- scoped_ptr<views::LabelButtonBorder> border(
- new views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON));
+ scoped_ptr<views::TextButtonDefaultBorder> border(
+ new views::TextButtonDefaultBorder());
- border->SetPainter(false, views::Button::STATE_NORMAL,
+ border->SetInsets(gfx::Insets(kInset, kInset, kInset, kInset));
+ border->set_normal_painter(
views::Painter::CreateImageGridPainter(normal_image_set));
- border->SetPainter(false, views::Button::STATE_HOVERED,
+ border->set_hot_painter(
views::Painter::CreateImageGridPainter(hot_image_set));
- border->SetPainter(false, views::Button::STATE_PRESSED,
+ border->set_pushed_painter(
views::Painter::CreateImageGridPainter(pushed_image_set));
- border->set_insets(gfx::Insets(kTopBottomInset, kLeftRightInset,
- kTopBottomInset, kLeftRightInset));
-
return border.PassAs<views::Border>();
}
@@ -77,11 +71,7 @@ NewAvatarButton::NewAvatarButton(
: MenuButton(listener, GetButtonText(browser->profile()), NULL, true),
browser_(browser) {
set_animate_on_state_change(false);
- SetTextColor(views::Button::STATE_NORMAL, SK_ColorWHITE);
- SetTextColor(views::Button::STATE_HOVERED, SK_ColorWHITE);
- SetTextColor(views::Button::STATE_PRESSED, SK_ColorWHITE);
- SetHaloColor(SK_ColorDKGRAY);
- SetHorizontalAlignment(gfx::ALIGN_RIGHT);
+ set_icon_placement(ICON_ON_RIGHT);
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
@@ -140,6 +130,22 @@ NewAvatarButton::~NewAvatarButton() {
error->RemoveObserver(this);
}
+void NewAvatarButton::OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode) {
+ // Get text bounds, and then adjust for the top and RTL languages.
+ gfx::Rect rect = GetTextBounds();
+ rect.Offset(0, -rect.y());
+ if (rect.width() > 0)
+ rect.set_x(GetMirroredXForRect(rect));
+
+ canvas->DrawStringRectWithHalo(
+ text(),
+ gfx::FontList(),
+ SK_ColorWHITE,
+ SK_ColorDKGRAY,
+ rect,
+ gfx::Canvas::NO_SUBPIXEL_RENDERING);
+}
+
void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) {
UpdateAvatarButtonAndRelayoutParent();
}
@@ -167,15 +173,14 @@ void NewAvatarButton::OnErrorChanged() {
icon = *rb->GetImageNamed(IDR_WARNING).ToImageSkia();
}
- SetImage(views::Button::STATE_NORMAL, icon);
+ SetIcon(icon);
UpdateAvatarButtonAndRelayoutParent();
}
void NewAvatarButton::UpdateAvatarButtonAndRelayoutParent() {
// We want the button to resize if the new text is shorter.
SetText(GetButtonText(browser_->profile()));
- set_min_size(gfx::Size());
- InvalidateLayout();
+ ClearMaxTextSize();
// Because the width of the button might have changed, the parent browser
// frame needs to recalculate the button bounds and redraw it.
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.h b/chrome/browser/ui/views/profiles/new_avatar_button.h
index 457bb54..805ba0c 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.h
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.h
@@ -28,6 +28,9 @@ class NewAvatarButton : public views::MenuButton,
Browser* browser);
virtual ~NewAvatarButton();
+ // views::TextButton:
+ virtual void OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
+
private:
friend class NewAvatarMenuButtonTest;
friend class ProfileChooserViewBrowserTest;
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 4d9a194..89583ad 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -1199,7 +1199,7 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
EXPECT_FALSE(browser2->window()->IsMaximized());
}
-#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragDirectlyToSecondWindow DISABLED_DragDirectlyToSecondWindow
diff --git a/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc b/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc
index 45e55d6..ed69780 100644
--- a/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc
+++ b/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc
@@ -44,8 +44,8 @@ void BrowserActionTestUtil::InspectPopup(int index) {
}
bool BrowserActionTestUtil::HasIcon(int index) {
- return !GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
- GetImage(views::Button::STATE_NORMAL).isNull();
+ return GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
+ HasIcon();
}
gfx::Image BrowserActionTestUtil::GetIcon(int index) {
diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.cc b/chrome/browser/ui/views/toolbar/browser_action_view.cc
index e277c3c..6c13116 100644
--- a/chrome/browser/ui/views/toolbar/browser_action_view.cc
+++ b/chrome/browser/ui/views/toolbar/browser_action_view.cc
@@ -37,6 +37,14 @@ 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)
@@ -102,7 +110,7 @@ BrowserActionButton::BrowserActionButton(const Extension* extension,
called_registered_extension_command_(false),
icon_observer_(NULL) {
SetBorder(views::Border::NullBorder());
- SetHorizontalAlignment(gfx::ALIGN_CENTER);
+ set_alignment(TextButton::ALIGN_CENTER);
set_context_menu_controller(this);
// No UpdateState() here because View hierarchy not setup yet. Our parent
@@ -203,6 +211,8 @@ void BrowserActionButton::UpdateState() {
if (tab_id < 0)
return;
+ SetShowMultipleIconStates(delegate_->NeedToShowMultipleIconStates());
+
if (!IsEnabled(tab_id)) {
SetState(views::CustomButton::STATE_DISABLED);
} else {
@@ -221,23 +231,21 @@ void BrowserActionButton::UpdateState() {
ThemeServiceFactory::GetForProfile(browser_->profile());
gfx::ImageSkia bg = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION);
- SetImage(views::Button::STATE_NORMAL,
- gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
+ SetIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
gfx::ImageSkia bg_h = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_H);
- SetImage(views::Button::STATE_HOVERED,
- gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon));
+ SetHoverIcon(gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_h, icon));
gfx::ImageSkia bg_p = *theme->GetImageSkiaNamed(IDR_BROWSER_ACTION_P);
- SetImage(views::Button::STATE_PRESSED,
- gfx::ImageSkiaOperations::CreateSuperimposedImage(bg_p, icon));
+ SetPushedIcon(
+ 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(name);
+ SetTooltipText(delegate_->NeedToShowTooltip() ? name : base::string16());
SetAccessibleName(name);
parent()->SchedulePaint();
@@ -312,7 +320,7 @@ bool BrowserActionButton::Activate() {
bool BrowserActionButton::OnMousePressed(const ui::MouseEvent& event) {
if (!event.IsRightMouseButton()) {
return IsPopup() ? MenuButton::OnMousePressed(event) :
- LabelButton::OnMousePressed(event);
+ TextButton::OnMousePressed(event);
}
if (!views::View::ShouldShowContextMenuOnMousePress()) {
@@ -330,7 +338,7 @@ void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) {
// loss of focus).
MenuButton::OnMouseReleased(event);
} else {
- LabelButton::OnMouseReleased(event);
+ TextButton::OnMouseReleased(event);
}
}
@@ -338,19 +346,19 @@ void BrowserActionButton::OnMouseExited(const ui::MouseEvent& event) {
if (IsPopup() || context_menu_)
MenuButton::OnMouseExited(event);
else
- LabelButton::OnMouseExited(event);
+ TextButton::OnMouseExited(event);
}
bool BrowserActionButton::OnKeyReleased(const ui::KeyEvent& event) {
return IsPopup() ? MenuButton::OnKeyReleased(event) :
- LabelButton::OnKeyReleased(event);
+ TextButton::OnKeyReleased(event);
}
void BrowserActionButton::OnGestureEvent(ui::GestureEvent* event) {
if (IsPopup())
MenuButton::OnGestureEvent(event);
else
- LabelButton::OnGestureEvent(event);
+ TextButton::OnGestureEvent(event);
}
bool BrowserActionButton::AcceleratorPressed(
@@ -383,7 +391,7 @@ gfx::ImageSkia BrowserActionButton::GetIconWithBadge() {
}
gfx::ImageSkia BrowserActionButton::GetIconForTest() {
- return GetImage(views::Button::STATE_NORMAL);
+ return icon();
}
BrowserActionButton::~BrowserActionButton() {
diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.h b/chrome/browser/ui/views/toolbar/browser_action_view.h
index 11fa162..983f791 100644
--- a/chrome/browser/ui/views/toolbar/browser_action_view.h
+++ b/chrome/browser/ui/views/toolbar/browser_action_view.h
@@ -54,6 +54,9 @@ class BrowserActionView : public views::View {
// Called when a browser action becomes visible/hidden.
virtual void OnBrowserActionVisibilityChanged() = 0;
+ virtual bool NeedToShowMultipleIconStates() const;
+ virtual bool NeedToShowTooltip() const;
+
protected:
virtual ~Delegate() {}
};
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
index 64a2be4..1f7b54a 100644
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
@@ -40,7 +40,6 @@
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
-#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/resize_area.h"
#include "ui/views/metrics.h"
#include "ui/views/painter.h"
@@ -57,35 +56,6 @@ const int kItemSpacing = ToolbarView::kStandardSpacing;
// Horizontal spacing before the chevron (if visible).
const int kChevronSpacing = kItemSpacing - 2;
-// A version of MenuButton with almost empty insets to fit properly on the
-// toolbar.
-class ChevronMenuButton : public views::MenuButton {
- public:
- ChevronMenuButton(views::ButtonListener* listener,
- const base::string16& text,
- views::MenuButtonListener* menu_button_listener,
- bool show_menu_marker)
- : views::MenuButton(listener,
- text,
- menu_button_listener,
- show_menu_marker) {
- }
-
- virtual ~ChevronMenuButton() {}
-
- virtual scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const
- OVERRIDE {
- // The chevron resource was designed to not have any insets.
- scoped_ptr<views::LabelButtonBorder> border =
- views::MenuButton::CreateDefaultBorder();
- border->set_insets(gfx::Insets());
- return border.Pass();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton);
-};
-
} // namespace
// static
@@ -127,7 +97,8 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser,
resize_area_ = new views::ResizeArea(this);
AddChildView(resize_area_);
- chevron_ = new ChevronMenuButton(NULL, base::string16(), this, false);
+ chevron_ = new views::MenuButton(NULL, base::string16(), this, false);
+ chevron_->SetBorder(views::Border::NullBorder());
chevron_->EnableCanvasFlippingForRTLUI(true);
chevron_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON));
@@ -811,8 +782,11 @@ void BrowserActionsContainer::HighlightModeChanged(bool is_highlighting) {
void BrowserActionsContainer::LoadImages() {
ui::ThemeProvider* tp = GetThemeProvider();
- chevron_->SetImage(views::Button::STATE_NORMAL,
- *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW));
+ chevron_->SetIcon(*tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW));
+ chevron_->SetHoverIcon(*tp->GetImageSkiaNamed(
+ IDR_BROWSER_ACTIONS_OVERFLOW_H));
+ chevron_->SetPushedIcon(*tp->GetImageSkiaNamed(
+ IDR_BROWSER_ACTIONS_OVERFLOW_P));
const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT);
highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages));
diff --git a/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc b/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
index c096597..c3c5d7d 100644
--- a/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
@@ -7,11 +7,14 @@
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
-#include "ui/views/painter.h"
WrenchToolbarButton::WrenchToolbarButton(views::MenuButtonListener* listener)
: views::MenuButton(NULL, base::string16(), listener, false) {
wrench_icon_painter_.reset(new WrenchIconPainter(this));
+
+ // Used for sizing only.
+ ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ SetIcon(*rb.GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER));
}
WrenchToolbarButton::~WrenchToolbarButton() {
@@ -22,11 +25,6 @@ void WrenchToolbarButton::SetSeverity(WrenchIconPainter::Severity severity,
wrench_icon_painter_->SetSeverity(severity, animate);
}
-gfx::Size WrenchToolbarButton::GetPreferredSize() const {
- return ResourceBundle::GetSharedInstance().
- GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size();
-}
-
void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
wrench_icon_painter_->Paint(
canvas, GetThemeProvider(), gfx::Rect(size()), GetCurrentBezelType());
diff --git a/chrome/browser/ui/views/toolbar/wrench_toolbar_button.h b/chrome/browser/ui/views/toolbar/wrench_toolbar_button.h
index a884d75..697164d 100644
--- a/chrome/browser/ui/views/toolbar/wrench_toolbar_button.h
+++ b/chrome/browser/ui/views/toolbar/wrench_toolbar_button.h
@@ -17,14 +17,13 @@ class WrenchToolbarButton : public views::MenuButton,
void SetSeverity(WrenchIconPainter::Severity severity, bool animate);
+ private:
// views::MenuButton:
- virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
// WrenchIconPainter::Delegate:
virtual void ScheduleWrenchIconPaint() OVERRIDE;
- private:
WrenchIconPainter::BezelType GetCurrentBezelType() const;
scoped_ptr<WrenchIconPainter> wrench_icon_painter_;
diff --git a/chrome/browser/ui/views/website_settings/permission_selector_view.cc b/chrome/browser/ui/views/website_settings/permission_selector_view.cc
index 6b44308..40fab86 100644
--- a/chrome/browser/ui/views/website_settings/permission_selector_view.cc
+++ b/chrome/browser/ui/views/website_settings/permission_selector_view.cc
@@ -45,6 +45,9 @@ class PermissionMenuButton : public views::MenuButton,
bool show_menu_marker);
virtual ~PermissionMenuButton();
+ // Overridden from views::MenuButton.
+ virtual gfx::Size GetPreferredSize() const OVERRIDE;
+
// Overridden from views::TextButton.
virtual void SetText(const base::string16& text) OVERRIDE;
@@ -72,11 +75,28 @@ PermissionMenuButton::PermissionMenuButton(const base::string16& text,
bool show_menu_marker)
: MenuButton(NULL, text, this, show_menu_marker),
menu_model_(model) {
+
}
PermissionMenuButton::~PermissionMenuButton() {
}
+gfx::Size PermissionMenuButton::GetPreferredSize() const {
+ gfx::Insets insets = GetInsets();
+ // Scale the button to the current text size.
+ gfx::Size prefsize(text_size_.width() + insets.width(),
+ text_size_.height() + insets.height());
+ if (max_width_ > 0)
+ prefsize.set_width(std::min(max_width_, prefsize.width()));
+ if (show_menu_marker()) {
+ prefsize.Enlarge(menu_marker()->width() +
+ views::MenuButton::kMenuMarkerPaddingLeft +
+ views::MenuButton::kMenuMarkerPaddingRight,
+ 0);
+ }
+ return prefsize;
+}
+
void PermissionMenuButton::SetText(const base::string16& text) {
MenuButton::SetText(text);
SizeToPreferredSize();
@@ -84,15 +104,15 @@ void PermissionMenuButton::SetText(const base::string16& text) {
void PermissionMenuButton::GetAccessibleState(ui::AXViewState* state) {
MenuButton::GetAccessibleState(state);
- state->value = GetText();
+ state->value = text();
}
void PermissionMenuButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
- SetTextColor(views::Button::STATE_NORMAL, GetNativeTheme()->GetSystemColor(
+ SetEnabledColor(theme->GetSystemColor(
ui::NativeTheme::kColorId_LabelEnabledColor));
- SetTextColor(views::Button::STATE_HOVERED, GetNativeTheme()->GetSystemColor(
+ SetHoverColor(theme->GetSystemColor(
ui::NativeTheme::kColorId_LabelEnabledColor));
- SetTextColor(views::Button::STATE_DISABLED, GetNativeTheme()->GetSystemColor(
+ SetDisabledColor(theme->GetSystemColor(
ui::NativeTheme::kColorId_LabelDisabledColor));
}
diff --git a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc
index 5f2d7f7..a9c064a 100644
--- a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc
+++ b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc
@@ -99,7 +99,7 @@ PermissionCombobox::~PermissionCombobox() {}
void PermissionCombobox::GetAccessibleState(ui::AXViewState* state) {
MenuButton::GetAccessibleState(state);
- state->value = GetText();
+ state->value = text();
}
void PermissionCombobox::OnMenuButtonClicked(View* source,
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
index 2569942..a9b65a1 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -16,7 +16,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/event.h"
-#include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/image_view.h"
@@ -58,12 +57,10 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
#if !defined(OS_CHROMEOS)
menu_button_ = new views::MenuButton(NULL, base::string16(), this, false);
menu_button_->SetBorder(views::Border::NullBorder());
- menu_button_->SetImage(views::Button::STATE_NORMAL,
- *rb.GetImageSkiaNamed(IDR_APP_LIST_TOOLS_NORMAL));
- menu_button_->SetImage(views::Button::STATE_HOVERED,
- *rb.GetImageSkiaNamed(IDR_APP_LIST_TOOLS_HOVER));
- menu_button_->SetImage(views::Button::STATE_PRESSED,
- *rb.GetImageSkiaNamed(IDR_APP_LIST_TOOLS_PRESSED));
+ menu_button_->SetIcon(*rb.GetImageSkiaNamed(IDR_APP_LIST_TOOLS_NORMAL));
+ menu_button_->SetHoverIcon(*rb.GetImageSkiaNamed(IDR_APP_LIST_TOOLS_HOVER));
+ menu_button_->SetPushedIcon(*rb.GetImageSkiaNamed(
+ IDR_APP_LIST_TOOLS_PRESSED));
AddChildView(menu_button_);
#endif
diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc
index a282ccb..5a46f48 100644
--- a/ui/message_center/views/notifier_settings_view.cc
+++ b/ui/message_center/views/notifier_settings_view.cc
@@ -28,7 +28,6 @@
#include "ui/views/controls/button/custom_button.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/button/text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
diff --git a/ui/views/button_drag_utils.cc b/ui/views/button_drag_utils.cc
index 2c4f25a..500c5e0 100644
--- a/ui/views/button_drag_utils.cc
+++ b/ui/views/button_drag_utils.cc
@@ -10,7 +10,6 @@
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
-#include "ui/gfx/geometry/point.h"
#include "ui/gfx/image/image.h"
#include "ui/views/controls/button/text_button.h"
#include "ui/views/drag_utils.h"
@@ -19,25 +18,17 @@
namespace button_drag_utils {
// Maximum width of the link drag image in pixels.
-static const int kLinkDragImageMaxWidth = 150;
+static const int kLinkDragImageMaxWidth = 200;
void SetURLAndDragImage(const GURL& url,
const base::string16& title,
const gfx::ImageSkia& icon,
- const gfx::Point* press_pt,
ui::OSExchangeData* data,
views::Widget* widget) {
DCHECK(url.is_valid() && data);
+
data->SetURL(url, title);
- SetDragImage(url, title, icon, press_pt, data, widget);
-}
-void SetDragImage(const GURL& url,
- const base::string16& title,
- const gfx::ImageSkia& icon,
- const gfx::Point* press_pt,
- ui::OSExchangeData* data,
- views::Widget* widget) {
// Create a button to render the drag image for us.
views::TextButton button(NULL,
title.empty() ? base::UTF8ToUTF16(url.spec())
@@ -52,17 +43,14 @@ void SetDragImage(const GURL& url,
gfx::Size prefsize = button.GetPreferredSize();
button.SetBounds(0, 0, prefsize.width(), prefsize.height());
- gfx::Vector2d press_point;
- if (press_pt)
- press_point = press_pt->OffsetFromOrigin();
- else
- press_point = gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2);
-
// Render the image.
scoped_ptr<gfx::Canvas> canvas(
views::GetCanvasForDragImage(widget, prefsize));
button.PaintButton(canvas.get(), views::TextButton::PB_FOR_DRAG);
- drag_utils::SetDragImageOnDataObject(*canvas, press_point, data);
+ drag_utils::SetDragImageOnDataObject(
+ *canvas,
+ gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2),
+ data);
}
} // namespace button_drag_utils
diff --git a/ui/views/button_drag_utils.h b/ui/views/button_drag_utils.h
index 8f1a7ee..0570ff2 100644
--- a/ui/views/button_drag_utils.h
+++ b/ui/views/button_drag_utils.h
@@ -12,7 +12,6 @@ class GURL;
namespace gfx {
class ImageSkia;
-class Point;
}
namespace ui {
@@ -26,23 +25,13 @@ class Widget;
namespace button_drag_utils {
// Sets url and title on data as well as setting a suitable image for dragging.
-// The image looks like that of the bookmark buttons. |press_pt| is optional
-// offset; otherwise, it centers the drag image.
+// The image looks like that of the bookmark buttons.
VIEWS_EXPORT void SetURLAndDragImage(const GURL& url,
const base::string16& title,
const gfx::ImageSkia& icon,
- const gfx::Point* press_pt,
ui::OSExchangeData* data,
views::Widget* widget);
-// As above, but only sets the image.
-VIEWS_EXPORT void SetDragImage(const GURL& url,
- const base::string16& title,
- const gfx::ImageSkia& icon,
- const gfx::Point* press_pt,
- ui::OSExchangeData* data,
- views::Widget* widget);
-
} // namespace drag_utils
#endif // UI_VIEWS_BUTTON_DRAG_UTILS_H_
diff --git a/ui/views/controls/button/custom_button.h b/ui/views/controls/button/custom_button.h
index 4614a5c..930cc92 100644
--- a/ui/views/controls/button/custom_button.h
+++ b/ui/views/controls/button/custom_button.h
@@ -18,8 +18,8 @@ namespace views {
class CustomButtonStateChangedDelegate;
-// A button with custom rendering. The common base class of ImageButton,
-// LabelButton and TextButton.
+// A button with custom rendering. The common base class of ImageButton and
+// TextButton.
// Note that this type of button is not focusable by default and will not be
// part of the focus chain. Call SetFocusable(true) to make it part of the
// focus chain.
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 860d1b1..d6647de 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -100,10 +100,6 @@ void LabelButton::SetTextColor(ButtonState for_state, SkColor color) {
explicitly_set_colors_[for_state] = true;
}
-void LabelButton::SetHaloColor(SkColor color) {
- label_->set_halo_color(color);
-}
-
bool LabelButton::GetTextMultiLine() const {
return label_->is_multi_line();
}
@@ -226,7 +222,7 @@ void LabelButton::Layout() {
adjusted_alignment = (adjusted_alignment == gfx::ALIGN_LEFT) ?
gfx::ALIGN_RIGHT : gfx::ALIGN_LEFT;
- gfx::Rect child_area(GetChildAreaBounds());
+ gfx::Rect child_area(GetLocalBounds());
child_area.Inset(GetInsets());
gfx::Size image_size(image_->GetPreferredSize());
@@ -279,10 +275,6 @@ void LabelButton::SetBorder(scoped_ptr<Border> border) {
View::SetBorder(border.Pass());
}
-gfx::Rect LabelButton::GetChildAreaBounds() {
- return GetLocalBounds();
-}
-
void LabelButton::OnPaint(gfx::Canvas* canvas) {
View::OnPaint(canvas);
Painter::PaintFocusPainter(this, canvas, focus_painter_.get());
@@ -374,7 +366,7 @@ void LabelButton::UpdateThemedBorder() {
views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui) {
SetBorder(linux_ui->CreateNativeBorder(
- this, label_button_border.Pass()));
+ this, label_button_border.PassAs<Border>()));
} else
#endif
{
diff --git a/ui/views/controls/button/label_button.h b/ui/views/controls/button/label_button.h
index 425f5c0..8e13ffc 100644
--- a/ui/views/controls/button/label_button.h
+++ b/ui/views/controls/button/label_button.h
@@ -38,14 +38,11 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
// Get or set the text shown on the button.
const base::string16& GetText() const;
- virtual void SetText(const base::string16& text);
+ void SetText(const base::string16& text);
// Set the text color shown for the specified button state.
void SetTextColor(ButtonState for_state, SkColor color);
- // Sets a halo color on the label.
- void SetHaloColor(SkColor color);
-
// Get or set the text's multi-line property to break on '\n', etc.
bool GetTextMultiLine() const;
void SetTextMultiLine(bool text_multi_line);
@@ -75,7 +72,6 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
void SetStyle(ButtonStyle style);
void SetFocusPainter(scoped_ptr<Painter> focus_painter);
- Painter* focus_painter() { return focus_painter_.get(); }
// View:
virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE;
@@ -87,10 +83,6 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
ImageView* image() const { return image_; }
Label* label() const { return label_; }
- // Returns the available area for the label and image. Subclasses can change
- // these bounds if they need room to do manual painting.
- virtual gfx::Rect GetChildAreaBounds();
-
// View:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnFocus() OVERRIDE;
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index 29271ce..dcfed7e 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -16,7 +16,6 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/screen.h"
-#include "ui/gfx/text_constants.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/menu_button_listener.h"
#include "ui/views/mouse_constants.h"
@@ -47,7 +46,7 @@ MenuButton::MenuButton(ButtonListener* listener,
const base::string16& text,
MenuButtonListener* menu_button_listener,
bool show_menu_marker)
- : LabelButton(listener, text),
+ : TextButton(listener, text),
menu_visible_(false),
menu_offset_(kDefaultMenuOffsetX, kDefaultMenuOffsetY),
listener_(menu_button_listener),
@@ -55,7 +54,7 @@ MenuButton::MenuButton(ButtonListener* listener,
menu_marker_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_MENU_DROPARROW).ToImageSkia()),
destroyed_flag_(NULL) {
- SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ set_alignment(TextButton::ALIGN_LEFT);
}
MenuButton::~MenuButton() {
@@ -134,8 +133,8 @@ bool MenuButton::Activate() {
return true;
}
-void MenuButton::OnPaint(gfx::Canvas* canvas) {
- LabelButton::OnPaint(canvas);
+void MenuButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
+ TextButton::PaintButton(canvas, mode);
if (show_menu_marker_)
PaintMenuMarker(canvas);
@@ -148,7 +147,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) {
////////////////////////////////////////////////////////////////////////////////
gfx::Size MenuButton::GetPreferredSize() const {
- gfx::Size prefsize = LabelButton::GetPreferredSize();
+ gfx::Size prefsize = TextButton::GetPreferredSize();
if (show_menu_marker_) {
prefsize.Enlarge(menu_marker_->width() + kMenuMarkerPaddingLeft +
kMenuMarkerPaddingRight,
@@ -187,7 +186,7 @@ void MenuButton::OnMouseReleased(const ui::MouseEvent& event) {
HitTestPoint(event.location())) {
Activate();
} else {
- LabelButton::OnMouseReleased(event);
+ TextButton::OnMouseReleased(event);
}
}
@@ -210,7 +209,7 @@ void MenuButton::OnGestureEvent(ui::GestureEvent* event) {
// the gesture event here.
return;
}
- LabelButton::OnGestureEvent(event);
+ TextButton::OnGestureEvent(event);
}
bool MenuButton::OnKeyPressed(const ui::KeyEvent& event) {
@@ -266,17 +265,6 @@ void MenuButton::PaintMenuMarker(gfx::Canvas* canvas) {
canvas->DrawImageInt(*menu_marker_, arrow_bounds.x(), arrow_bounds.y());
}
-gfx::Rect MenuButton::GetChildAreaBounds() {
- gfx::Size s = size();
-
- if (show_menu_marker_) {
- s.set_width(s.width() - menu_marker_->width() - kMenuMarkerPaddingLeft -
- kMenuMarkerPaddingRight);
- }
-
- return gfx::Rect(s);
-}
-
int MenuButton::GetMaximumScreenXCoordinate() {
if (!GetWidget()) {
NOTREACHED();
diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h
index 257d2f6..1ca6de0 100644
--- a/ui/views/controls/button/menu_button.h
+++ b/ui/views/controls/button/menu_button.h
@@ -10,7 +10,7 @@
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "ui/views/background.h"
-#include "ui/views/controls/button/label_button.h"
+#include "ui/views/controls/button/text_button.h"
namespace views {
@@ -23,7 +23,7 @@ class MenuButtonListener;
// A button that shows a menu when the left mouse button is pushed
//
////////////////////////////////////////////////////////////////////////////////
-class VIEWS_EXPORT MenuButton : public LabelButton {
+class VIEWS_EXPORT MenuButton : public TextButton {
public:
static const char kViewClassName[];
@@ -50,10 +50,12 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
// Activate the button (called when the button is pressed).
virtual bool Activate();
+ // Overridden from TextButton for the potential use of a drop marker.
+ virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
+
// Overridden from View:
virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
@@ -66,9 +68,6 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
// Paint the menu marker image.
void PaintMenuMarker(gfx::Canvas* canvas);
- // Overridden from LabelButton:
- virtual gfx::Rect GetChildAreaBounds() OVERRIDE;
-
// True if the menu is currently visible.
bool menu_visible_;
diff --git a/ui/views/controls/button/radio_button.h b/ui/views/controls/button/radio_button.h
index edbb2c6..abffd60 100644
--- a/ui/views/controls/button/radio_button.h
+++ b/ui/views/controls/button/radio_button.h
@@ -30,7 +30,7 @@ class VIEWS_EXPORT RadioButton : public Checkbox {
// Overridden from Button:
virtual void NotifyClick(const ui::Event& event) OVERRIDE;
- // Overridden from LabelButton:
+ // Overridden from TextButtonBase:
virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE;
// Overridden from Checkbox:
diff --git a/ui/views/linux_ui/linux_ui.h b/ui/views/linux_ui/linux_ui.h
index b5466f5..504de81 100644
--- a/ui/views/linux_ui/linux_ui.h
+++ b/ui/views/linux_ui/linux_ui.h
@@ -35,7 +35,6 @@ class NativeTheme;
namespace views {
class Border;
class LabelButton;
-class LabelButtonBorder;
class View;
class WindowButtonOrderObserver;
@@ -126,7 +125,7 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory,
// Builds a Border which paints the native button style.
virtual scoped_ptr<Border> CreateNativeBorder(
views::LabelButton* owning_button,
- scoped_ptr<views::LabelButtonBorder> border) = 0;
+ scoped_ptr<views::Border> border) = 0;
// Notifies the observer about changes about how window buttons should be
// laid out. If the order is anything other than the default min,max,close on