Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6406)

Unified Diff: chrome/browser/ui/views/toolbar/browser_actions_container.cc

Issue 298813002: views: Move MenuButton from TextButton to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove stray LOG Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar/browser_actions_container.cc
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
index 51b73105131cc652a7ae090a051b251fd62f99aa..59be61273fd87cd07c939b40a0f88aa81fcfe27b 100644
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
@@ -40,6 +40,7 @@
#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"
@@ -56,6 +57,35 @@ 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
msw 2014/06/09 17:18:40 q: does this look okay when the border is drawn (g
Elliot Glaysher 2014/06/11 00:27:28 Yes. (It doesn't draw correctly without clearing t
+// 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
@@ -97,8 +127,7 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser,
resize_area_ = new views::ResizeArea(this);
AddChildView(resize_area_);
- chevron_ = new views::MenuButton(NULL, base::string16(), this, false);
- chevron_->SetBorder(views::Border::NullBorder());
+ chevron_ = new ChevronMenuButton(NULL, base::string16(), this, false);
chevron_->EnableCanvasFlippingForRTLUI(true);
chevron_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON));
@@ -795,11 +824,8 @@ void BrowserActionsContainer::HighlightModeChanged(bool is_highlighting) {
void BrowserActionsContainer::LoadImages() {
ui::ThemeProvider* tp = GetThemeProvider();
- chevron_->SetIcon(*tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW));
- chevron_->SetHoverIcon(*tp->GetImageSkiaNamed(
msw 2014/06/09 17:18:40 nit: why are the hover and pressed state images no
Elliot Glaysher 2014/06/11 00:27:28 Because I deleted the "chevron_->SetBorder(views::
- IDR_BROWSER_ACTIONS_OVERFLOW_H));
- chevron_->SetPushedIcon(*tp->GetImageSkiaNamed(
- IDR_BROWSER_ACTIONS_OVERFLOW_P));
+ chevron_->SetImage(views::Button::STATE_NORMAL,
+ *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW));
const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT);
highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages));

Powered by Google App Engine
This is Rietveld 408576698