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

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

Issue 1270343004: Update LabelButtons in the Toolbar for Material Design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.cc ('k') | ui/views/style/platform_style.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
diff --git a/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc b/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
index 1aeca46e55880e38d6731f9fdf889c2996c21430..056015f6a5c7b458192b6ec287be3b0971e4d2f6 100644
--- a/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc
@@ -8,11 +8,13 @@
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
+#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "extensions/common/feature_switch.h"
#include "grit/theme_resources.h"
+#include "ui/base/resource/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
#include "ui/views/controls/button/label_button_border.h"
@@ -24,11 +26,14 @@ bool WrenchToolbarButton::g_open_wrench_immediately_for_testing = false;
WrenchToolbarButton::WrenchToolbarButton(ToolbarView* toolbar_view)
: views::MenuButton(NULL, base::string16(), toolbar_view, false),
- wrench_icon_painter_(new WrenchIconPainter(this)),
+ wrench_icon_painter_(nullptr),
toolbar_view_(toolbar_view),
allow_extension_dragging_(
- extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()),
+ extensions::FeatureSwitch::extension_action_redesign()
+ ->IsEnabled()),
weak_factory_(this) {
+ if (!ui::MaterialDesignController::IsModeMaterial())
+ wrench_icon_painter_.reset(new WrenchIconPainter(this));
}
WrenchToolbarButton::~WrenchToolbarButton() {
@@ -36,11 +41,25 @@ WrenchToolbarButton::~WrenchToolbarButton() {
void WrenchToolbarButton::SetSeverity(WrenchIconPainter::Severity severity,
bool animate) {
+ if (ui::MaterialDesignController::IsModeMaterial())
+ return;
+
wrench_icon_painter_->SetSeverity(severity, animate);
SchedulePaint();
}
gfx::Size WrenchToolbarButton::GetPreferredSize() const {
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ gfx::Size size(image()->GetPreferredSize());
+ ui::ThemeProvider* provider = GetThemeProvider();
+ if (provider && provider->UsingSystemTheme()) {
+ int inset = provider->GetDisplayProperty(
+ ThemeProperties::PROPERTY_TOOLBAR_BUTTON_BORDER_INSET);
+ size.Enlarge(2 * inset, 2 * inset);
+ }
+ return size;
+ }
+
return ResourceBundle::GetSharedInstance().
GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size();
}
@@ -101,6 +120,8 @@ int WrenchToolbarButton::OnPerformDrop(const ui::DropTargetEvent& event) {
void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
views::MenuButton::OnPaint(canvas);
+ if (ui::MaterialDesignController::IsModeMaterial())
+ return;
wrench_icon_painter_->Paint(canvas,
GetThemeProvider(),
gfx::Rect(size()),
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.cc ('k') | ui/views/style/platform_style.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698