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

Side by Side Diff: ui/views/style/platform_style.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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/style/platform_style.h" 5 #include "ui/views/style/platform_style.h"
6 6
7 #include "ui/base/resource/material_design/material_design_controller.h"
7 #include "ui/views/controls/button/label_button.h" 8 #include "ui/views/controls/button/label_button.h"
8 #include "ui/views/controls/button/label_button_border.h" 9 #include "ui/views/controls/button/label_button_border.h"
9 10
10 namespace views { 11 namespace views {
11 12
12 #if !defined(OS_MACOSX) 13 #if defined(OS_CHROMEOS)
13 // static 14 // static
14 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 15 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
15 Button::ButtonStyle style) { 16 Button::ButtonStyle style) {
16 return make_scoped_ptr(new LabelButtonAssetBorder(style)); 17 if (!ui::MaterialDesignController::IsModeMaterial() ||
18 style != Button::STYLE_TEXTBUTTON) {
19 return make_scoped_ptr(new LabelButtonAssetBorder(style));
20 }
21
22 // The material design spec for Chrome OS includes no visual effects for
23 // button states, so a non-asset border with insets is used.
24 scoped_ptr<LabelButtonBorder> border(new views::LabelButtonBorder());
25 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
26 Button::STYLE_TEXTBUTTON));
27 return border.Pass();
28 }
29 #elif !defined(OS_MACOSX)
30 // static
31 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
32 Button::ButtonStyle style) {
33 scoped_ptr<LabelButtonAssetBorder> border(new LabelButtonAssetBorder(style));
34 // The material design spec does not include a visual effect for the
35 // STATE_HOVERED button state so we have to remove the default one added by
36 // LabelButtonAssetBorder.
37 if (ui::MaterialDesignController::IsModeMaterial())
38 border->SetPainter(false, Button::STATE_HOVERED, nullptr);
39 return border.Pass();
17 } 40 }
18 #endif 41 #endif
19 42
20 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) 43 #if !defined(OS_LINUX) || defined(OS_CHROMEOS)
21 // static 44 // static
22 scoped_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder( 45 scoped_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder(
23 LabelButton* button) { 46 LabelButton* button) {
24 return button->CreateDefaultBorder(); 47 return button->CreateDefaultBorder();
25 } 48 }
26 #endif 49 #endif
27 50
28 } // namespace views 51 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698