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

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

Issue 2576133002: chromeos: Remove OS ifdefs from ash/common/system/tray (Closed)
Patch Set: review comments Created 4 years 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 | « no previous file | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/label_tray_view.h" 5 #include "ash/common/system/tray/label_tray_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/hover_highlight_view.h" 8 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/view_click_listener.h" 10 #include "ash/common/system/tray/view_click_listener.h"
11 #include "ash/resources/vector_icons/vector_icons.h" 11 #include "ash/resources/vector_icons/vector_icons.h"
12 #include "grit/ash_resources.h" 12 #include "grit/ash_resources.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/font.h" 14 #include "ui/gfx/font.h"
15 #include "ui/gfx/paint_vector_icon.h" 15 #include "ui/gfx/paint_vector_icon.h"
16 #include "ui/views/border.h" 16 #include "ui/views/border.h"
17 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
18 #include "ui/views/layout/fill_layout.h" 18 #include "ui/views/layout/fill_layout.h"
19 19
20 namespace ash { 20 namespace ash {
21 21
22 namespace { 22 namespace {
23 23
24 // Maps a non-MD PNG resource id to its corresponding MD vector icon. 24 // Maps a non-MD PNG resource id to its corresponding MD vector icon.
25 // TODO(tdanderson): Remove this once material design is enabled by 25 // TODO(tdanderson): Remove this once material design is enabled by
26 // default. See crbug.com/614453. 26 // default. See crbug.com/614453.
27 const gfx::VectorIcon& ResourceIdToVectorIcon(int resource_id) { 27 const gfx::VectorIcon& ResourceIdToVectorIcon(int resource_id) {
28 #if defined(OS_CHROMEOS)
29 switch (resource_id) { 28 switch (resource_id) {
30 case IDR_AURA_UBER_TRAY_ENTERPRISE: 29 case IDR_AURA_UBER_TRAY_ENTERPRISE:
31 return kSystemMenuBusinessIcon; 30 return kSystemMenuBusinessIcon;
32 case IDR_AURA_UBER_TRAY_BUBBLE_SESSION_LENGTH_LIMIT: 31 case IDR_AURA_UBER_TRAY_BUBBLE_SESSION_LENGTH_LIMIT:
33 return kSystemMenuTimerIcon; 32 return kSystemMenuTimerIcon;
34 case IDR_AURA_UBER_TRAY_CHILD_USER: 33 case IDR_AURA_UBER_TRAY_CHILD_USER:
35 return kSystemMenuChildUserIcon; 34 return kSystemMenuChildUserIcon;
36 case IDR_AURA_UBER_TRAY_SUPERVISED_USER: 35 case IDR_AURA_UBER_TRAY_SUPERVISED_USER:
37 return kSystemMenuSupervisedUserIcon; 36 return kSystemMenuSupervisedUserIcon;
38 default: 37 default:
39 NOTREACHED(); 38 NOTREACHED();
40 break; 39 break;
41 } 40 }
42 #endif // defined(OS_CHROMEOS)
43
44 return gfx::kNoneIcon; 41 return gfx::kNoneIcon;
45 } 42 }
46 43
47 } // namespace 44 } // namespace
48 45
49 LabelTrayView::LabelTrayView(ViewClickListener* click_listener, 46 LabelTrayView::LabelTrayView(ViewClickListener* click_listener,
50 int icon_resource_id) 47 int icon_resource_id)
51 : click_listener_(click_listener), icon_resource_id_(icon_resource_id) { 48 : click_listener_(click_listener), icon_resource_id_(icon_resource_id) {
52 SetLayoutManager(new views::FillLayout()); 49 SetLayoutManager(new views::FillLayout());
53 SetVisible(false); 50 SetVisible(false);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 child->text_label()->SizeToFit(kTrayNotificationContentsWidth + 90 child->text_label()->SizeToFit(kTrayNotificationContentsWidth +
94 kNotificationIconWidth); 91 kNotificationIconWidth);
95 } 92 }
96 child->text_label()->SetAllowCharacterBreak(true); 93 child->text_label()->SetAllowCharacterBreak(true);
97 child->SetExpandable(true); 94 child->SetExpandable(true);
98 child->SetVisible(true); 95 child->SetVisible(true);
99 return child; 96 return child;
100 } 97 }
101 98
102 } // namespace ash 99 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698