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

Side by Side Diff: ash/common/system/chromeos/audio/audio_detailed_view.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/audio/audio_detailed_view.h" 5 #include "ash/common/system/chromeos/audio/audio_detailed_view.h"
6 6
7 #include "ash/common/system/tray/hover_highlight_view.h" 7 #include "ash/common/system/tray/hover_highlight_view.h"
8 #include "ash/common/system/tray/tray_popup_utils.h" 8 #include "ash/common/system/tray/tray_popup_utils.h"
9 #include "ash/common/system/tray/tray_utils.h"
9 #include "ash/common/system/tray/tri_view.h" 10 #include "ash/common/system/tray/tri_view.h"
10 #include "ash/resources/vector_icons/vector_icons.h" 11 #include "ash/resources/vector_icons/vector_icons.h"
11 #include "ash/strings/grit/ash_strings.h" 12 #include "ash/strings/grit/ash_strings.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "chromeos/audio/cras_audio_handler.h" 14 #include "chromeos/audio/cras_audio_handler.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/gfx/color_palette.h" 16 #include "ui/gfx/color_palette.h"
16 #include "ui/gfx/paint_vector_icon.h" 17 #include "ui/gfx/paint_vector_icon.h"
17 #include "ui/native_theme/native_theme.h" 18 #include "ui/native_theme/native_theme.h"
18 #include "ui/views/controls/image_view.h" 19 #include "ui/views/controls/image_view.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 scroll_content()->AddChildView(header); 104 scroll_content()->AddChildView(header);
104 } 105 }
105 106
106 HoverHighlightView* AudioDetailedView::AddScrollListItem( 107 HoverHighlightView* AudioDetailedView::AddScrollListItem(
107 const base::string16& text, 108 const base::string16& text,
108 bool highlight, 109 bool highlight,
109 bool checked) { 110 bool checked) {
110 HoverHighlightView* container = new HoverHighlightView(this); 111 HoverHighlightView* container = new HoverHighlightView(this);
111 112
112 container->AddLabelRow(text); 113 container->AddLabelRow(text);
113 if (checked) { 114 if (checked) {
tdanderson 2017/04/06 17:52:09 nit: In general in the code base we avoid braces f
114 gfx::ImageSkia check_mark = 115 SetCheckMarkVisible(container);
115 gfx::CreateVectorIcon(kCheckCircleIcon, gfx::kGoogleGreen700);
116 container->AddRightIcon(check_mark, check_mark.width());
117 container->SetRightViewVisible(true);
118 container->SetAccessiblityState(
119 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX);
120 } else { 116 } else {
121 container->SetAccessiblityState( 117 SetCheckMarkInvisible(container);
122 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX);
123 } 118 }
124 119
125 scroll_content()->AddChildView(container); 120 scroll_content()->AddChildView(container);
126 return container; 121 return container;
127 } 122 }
128 123
129 void AudioDetailedView::CreateItems() { 124 void AudioDetailedView::CreateItems() {
130 CreateScrollableList(); 125 CreateScrollableList();
131 CreateTitleRow(IDS_ASH_STATUS_TRAY_AUDIO); 126 CreateTitleRow(IDS_ASH_STATUS_TRAY_AUDIO);
132 } 127 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 audio_handler->HasDualInternalMic()) { 214 audio_handler->HasDualInternalMic()) {
220 audio_handler->SwitchToFrontOrRearMic(); 215 audio_handler->SwitchToFrontOrRearMic();
221 } else { 216 } else {
222 audio_handler->SwitchToDevice(device, true, 217 audio_handler->SwitchToDevice(device, true,
223 CrasAudioHandler::ACTIVATE_BY_USER); 218 CrasAudioHandler::ACTIVATE_BY_USER);
224 } 219 }
225 } 220 }
226 221
227 } // namespace tray 222 } // namespace tray
228 } // namespace ash 223 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698