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

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

Issue 2803893002: Reuse the code within UpdateCheckMark() (Closed)
Patch Set: Rename CheckMark -> SetCheckMarkVisible, UncheckMark -> SetCheckMarkInvisible. Update the comment. Created 3 years, 8 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/system/tray/hover_highlight_view.h"
8 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ui/gfx/color_palette.h"
7 #include "ui/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
11 #include "ui/gfx/paint_vector_icon.h"
8 #include "ui/views/controls/label.h" 12 #include "ui/views/controls/label.h"
9 13
10 namespace ash { 14 namespace ash {
11 15
12 void SetupLabelForTray(views::Label* label) { 16 void SetupLabelForTray(views::Label* label) {
13 // The text is drawn on an transparent bg, so we must disable subpixel 17 // The text is drawn on an transparent bg, so we must disable subpixel
14 // rendering. 18 // rendering.
15 label->SetSubpixelRenderingEnabled(false); 19 label->SetSubpixelRenderingEnabled(false);
16 label->SetFontList( 20 label->SetFontList(
17 gfx::FontList().Derive(2, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); 21 gfx::FontList().Derive(2, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
18 } 22 }
19 23
24 void SetCheckMarkVisible(HoverHighlightView* container) {
25 gfx::ImageSkia check_mark =
26 CreateVectorIcon(kCheckCircleIcon, gfx::kGoogleGreen700);
27 container->AddRightIcon(check_mark, check_mark.width());
28 container->SetRightViewVisible(true);
29 container->SetAccessiblityState(
30 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX);
31 }
32
33 void SetCheckMarkInvisible(HoverHighlightView* container) {
34 container->SetRightViewVisible(false);
35 container->SetAccessiblityState(
36 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX);
tdanderson 2017/04/06 17:52:09 The two new functions you have introduced here are
minch1 2017/04/06 18:05:47 The logic of enable and disable check mark in Comm
minch1 2017/04/06 18:09:41 Maybe I can add one more function here to combine
37 }
38
20 } // namespace ash 39 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698