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" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Returns the color to use for the material design update icon when the update | 57 // 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 | 58 // 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. | 59 // menu is given, otherwise the icon color for the system tray is given. |
60 SkColor IconColorForUpdateSeverity(UpdateInfo::UpdateSeverity severity, | 60 SkColor IconColorForUpdateSeverity(UpdateInfo::UpdateSeverity severity, |
61 bool for_menu) { | 61 bool for_menu) { |
62 const SkColor default_color = for_menu ? kMenuIconColor : kTrayIconColor; | 62 const SkColor default_color = for_menu ? kMenuIconColor : kTrayIconColor; |
63 switch (severity) { | 63 switch (severity) { |
64 case UpdateInfo::UPDATE_NONE: | 64 case UpdateInfo::UPDATE_NONE: |
65 return default_color; | 65 return default_color; |
66 case UpdateInfo::UPDATE_LOW: | 66 case UpdateInfo::UPDATE_LOW: |
67 return for_menu ? gfx::kGoogleGreen700 : gfx::kGoogleGreen300; | 67 return for_menu ? gfx::kGoogleGreen700 : kTrayIconColor; |
68 case UpdateInfo::UPDATE_ELEVATED: | 68 case UpdateInfo::UPDATE_ELEVATED: |
69 return for_menu ? gfx::kGoogleYellow700 : gfx::kGoogleYellow300; | 69 return for_menu ? gfx::kGoogleYellow700 : gfx::kGoogleYellow300; |
70 case UpdateInfo::UPDATE_HIGH: | 70 case UpdateInfo::UPDATE_HIGH: |
71 case UpdateInfo::UPDATE_SEVERE: | 71 case UpdateInfo::UPDATE_SEVERE: |
72 case UpdateInfo::UPDATE_CRITICAL: | 72 case UpdateInfo::UPDATE_CRITICAL: |
73 return for_menu ? gfx::kGoogleRed700 : gfx::kGoogleRed300; | 73 return for_menu ? gfx::kGoogleRed700 : gfx::kGoogleRed300; |
74 default: | 74 default: |
75 NOTREACHED(); | 75 NOTREACHED(); |
76 break; | 76 break; |
77 } | 77 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { | 147 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { |
148 if (MaterialDesignController::UseMaterialDesignSystemIcons()) | 148 if (MaterialDesignController::UseMaterialDesignSystemIcons()) |
149 SetIconColor(IconColorForUpdateSeverity(info.severity, false)); | 149 SetIconColor(IconColorForUpdateSeverity(info.severity, false)); |
150 else | 150 else |
151 SetImageFromResourceId(DecideResource(info.severity, false)); | 151 SetImageFromResourceId(DecideResource(info.severity, false)); |
152 tray_view()->SetVisible(true); | 152 tray_view()->SetVisible(true); |
153 } | 153 } |
154 | 154 |
155 } // namespace ash | 155 } // namespace ash |
OLD | NEW |