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

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) {
17 // The material design spec for Chrome OS includes no visual effects for
18 // button states, so a non-asset border with insets is used.
19 if (ui::MaterialDesignController::IsModeMaterial() &&
20 style == Button::STYLE_TEXTBUTTON) {
Peter Kasting 2015/08/07 15:36:16 Nit: Reverse this condition so you can do the simp
jonross 2015/08/07 15:57:15 Done.
21 scoped_ptr<LabelButtonBorder> border(new views::LabelButtonBorder());
22 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
23 Button::STYLE_TEXTBUTTON));
24 return border.Pass();
25 }
16 return make_scoped_ptr(new LabelButtonAssetBorder(style)); 26 return make_scoped_ptr(new LabelButtonAssetBorder(style));
17 } 27 }
28 #elif !defined(OS_MACOSX)
29 // static
30 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
31 Button::ButtonStyle style) {
32 scoped_ptr<LabelButtonAssetBorder> border(new LabelButtonAssetBorder(style));
33 // The material design spec does not include a visual effect for the
34 // STATE_HOVERED button state so we have to remove the default one added by
35 // LabelButtonAssetBorder.
36 if (ui::MaterialDesignController::IsModeMaterial()) {
Peter Kasting 2015/08/07 15:36:16 No {}
jonross 2015/08/07 15:57:15 Done.
37 border->SetPainter(false, Button::STATE_HOVERED, nullptr);
38 }
39 return border.Pass();
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