OLD | NEW |
---|---|
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/update/tray_update.h" | 5 #include "ash/common/system/update/tray_update.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/metrics/user_metrics_action.h" | 8 #include "ash/common/metrics/user_metrics_action.h" |
9 #include "ash/common/system/tray/fixed_sized_image_view.h" | 9 #include "ash/common/system/tray/fixed_sized_image_view.h" |
10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
11 #include "ash/common/system/tray/system_tray_delegate.h" | 11 #include "ash/common/system/tray/system_tray_delegate.h" |
12 #include "ash/common/system/tray/system_tray_notifier.h" | 12 #include "ash/common/system/tray/system_tray_notifier.h" |
13 #include "ash/common/system/tray/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
15 #include "ash/resources/vector_icons/vector_icons.h" | 15 #include "ash/resources/vector_icons/vector_icons.h" |
16 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
18 #include "third_party/skia/include/core/SkColor.h" | |
tdanderson
2016/09/22 14:38:20
This can be removed once the other comment is addr
yiyix
2016/09/22 18:31:10
Done.
| |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/gfx/color_palette.h" | 20 #include "ui/gfx/color_palette.h" |
20 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
21 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
22 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
23 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
24 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
25 | 26 |
26 namespace ash { | 27 namespace ash { |
27 namespace { | 28 namespace { |
(...skipping 29 matching lines...) Expand all Loading... | |
57 // Returns the color to use for the material design update icon when the update | 58 // Returns the color to use for the material design update icon when the update |
58 // severity is |severity|. If |for_menu| is true, the icon color for the system | 59 // severity is |severity|. If |for_menu| is true, the icon color for the system |
59 // menu is given, otherwise the icon color for the system tray is given. | 60 // menu is given, otherwise the icon color for the system tray is given. |
60 SkColor IconColorForUpdateSeverity(UpdateInfo::UpdateSeverity severity, | 61 SkColor IconColorForUpdateSeverity(UpdateInfo::UpdateSeverity severity, |
61 bool for_menu) { | 62 bool for_menu) { |
62 const SkColor default_color = for_menu ? kMenuIconColor : kTrayIconColor; | 63 const SkColor default_color = for_menu ? kMenuIconColor : kTrayIconColor; |
63 switch (severity) { | 64 switch (severity) { |
64 case UpdateInfo::UPDATE_NONE: | 65 case UpdateInfo::UPDATE_NONE: |
65 return default_color; | 66 return default_color; |
66 case UpdateInfo::UPDATE_LOW: | 67 case UpdateInfo::UPDATE_LOW: |
67 return for_menu ? gfx::kGoogleGreen700 : gfx::kGoogleGreen300; | 68 return for_menu ? gfx::kGoogleGreen700 : SK_ColorWHITE; |
tdanderson
2016/09/22 14:38:20
nit: please use kTrayIconColor.
yiyix
2016/09/22 18:31:10
I was just checking the constant with color white.
| |
68 case UpdateInfo::UPDATE_ELEVATED: | 69 case UpdateInfo::UPDATE_ELEVATED: |
69 return for_menu ? gfx::kGoogleYellow700 : gfx::kGoogleYellow300; | 70 return for_menu ? gfx::kGoogleYellow700 : gfx::kGoogleYellow300; |
70 case UpdateInfo::UPDATE_HIGH: | 71 case UpdateInfo::UPDATE_HIGH: |
71 case UpdateInfo::UPDATE_SEVERE: | 72 case UpdateInfo::UPDATE_SEVERE: |
72 case UpdateInfo::UPDATE_CRITICAL: | 73 case UpdateInfo::UPDATE_CRITICAL: |
73 return for_menu ? gfx::kGoogleRed700 : gfx::kGoogleRed300; | 74 return for_menu ? gfx::kGoogleRed700 : gfx::kGoogleRed300; |
74 default: | 75 default: |
75 NOTREACHED(); | 76 NOTREACHED(); |
76 break; | 77 break; |
77 } | 78 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 | 147 |
147 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { | 148 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { |
148 if (MaterialDesignController::UseMaterialDesignSystemIcons()) | 149 if (MaterialDesignController::UseMaterialDesignSystemIcons()) |
149 SetIconColor(IconColorForUpdateSeverity(info.severity, false)); | 150 SetIconColor(IconColorForUpdateSeverity(info.severity, false)); |
150 else | 151 else |
151 SetImageFromResourceId(DecideResource(info.severity, false)); | 152 SetImageFromResourceId(DecideResource(info.severity, false)); |
152 tray_view()->SetVisible(true); | 153 tray_view()->SetVisible(true); |
153 } | 154 } |
154 | 155 |
155 } // namespace ash | 156 } // namespace ash |
OLD | NEW |