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

Side by Side Diff: ash/common/system/tray/tray_utils.cc

Issue 2254933002: Reuse NativeThemeAuraDark for cros tray. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inject NativeTheme at widget Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/system/tray/tray_utils.h" 5 #include "ash/common/system/tray/tray_utils.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h"
7 #include "ash/common/shelf/wm_shelf_util.h" 8 #include "ash/common/shelf/wm_shelf_util.h"
8 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
9 #include "ash/common/system/tray/tray_item_view.h" 10 #include "ash/common/system/tray/tray_item_view.h"
10 #include "ui/accessibility/ax_view_state.h" 11 #include "ui/accessibility/ax_view_state.h"
11 #include "ui/gfx/font_list.h" 12 #include "ui/gfx/font_list.h"
12 #include "ui/gfx/geometry/vector2d.h" 13 #include "ui/gfx/geometry/vector2d.h"
13 #include "ui/views/border.h" 14 #include "ui/views/border.h"
14 #include "ui/views/controls/label.h" 15 #include "ui/views/controls/label.h"
15 16
16 namespace ash { 17 namespace ash {
17 18
18 void SetupLabelForTray(views::Label* label) { 19 void SetupLabelForTray(views::Label* label) {
19 label->SetFontList( 20 if (MaterialDesignController::IsShelfMaterial()) {
Evan Stade 2016/08/18 00:38:02 I went ahead and made changes here to match Sebast
20 gfx::FontList().Derive(1, gfx::Font::NORMAL, gfx::Font::Weight::BOLD)); 21 // The text is drawn on an transparent bg, so we must disable subpixel
21 label->SetAutoColorReadabilityEnabled(false); 22 // rendering.
22 label->SetEnabledColor(SK_ColorWHITE); 23 label->SetSubpixelRenderingEnabled(false);
23 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); 24 label->SetFontList(
24 label->SetShadows(gfx::ShadowValues( 25 gfx::FontList().Derive(2, gfx::Font::NORMAL, gfx::Font::Weight::BOLD));
25 1, 26 } else {
26 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0)))); 27 label->SetFontList(
28 gfx::FontList().Derive(1, gfx::Font::NORMAL, gfx::Font::Weight::BOLD));
29 label->SetShadows(gfx::ShadowValues(
30 1,
31 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0))));
32 label->SetAutoColorReadabilityEnabled(false);
33 label->SetEnabledColor(SK_ColorWHITE);
34 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255));
35 }
27 } 36 }
28 37
29 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment) { 38 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment) {
30 if (IsHorizontalAlignment(alignment)) { 39 if (IsHorizontalAlignment(alignment)) {
31 tray_view->SetBorder(views::Border::CreateEmptyBorder( 40 tray_view->SetBorder(views::Border::CreateEmptyBorder(
32 0, kTrayImageItemHorizontalPaddingBottomAlignment, 0, 41 0, kTrayImageItemHorizontalPaddingBottomAlignment, 0,
33 kTrayImageItemHorizontalPaddingBottomAlignment)); 42 kTrayImageItemHorizontalPaddingBottomAlignment));
34 } else { 43 } else {
35 tray_view->SetBorder(views::Border::CreateEmptyBorder( 44 tray_view->SetBorder(views::Border::CreateEmptyBorder(
36 kTrayImageItemVerticalPaddingVerticalAlignment, 45 kTrayImageItemVerticalPaddingVerticalAlignment,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Do not descend into static text labels which may compute their own labels 77 // Do not descend into static text labels which may compute their own labels
69 // recursively. 78 // recursively.
70 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT) 79 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT)
71 return; 80 return;
72 81
73 for (int i = 0; i < view->child_count(); ++i) 82 for (int i = 0; i < view->child_count(); ++i)
74 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels); 83 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels);
75 } 84 }
76 85
77 } // namespace ash 86 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698