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

Side by Side Diff: ash/common/system/update/tray_update.cc

Issue 2316183003: Move a bunch of ash-only vector icons to ash/. (Closed)
Patch Set: drop the "id". Just "icon". It's cleaner. Created 4 years, 3 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
« no previous file with comments | « ash/common/system/tray_accessibility.cc ('k') | ash/resources/vector_icons/BUILD.gn » ('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/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 "grit/ash_resources.h" 16 #include "grit/ash_resources.h"
16 #include "grit/ash_strings.h" 17 #include "grit/ash_strings.h"
17 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/color_palette.h" 19 #include "ui/gfx/color_palette.h"
19 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
20 #include "ui/gfx/paint_vector_icon.h" 21 #include "ui/gfx/paint_vector_icon.h"
21 #include "ui/gfx/vector_icons_public.h"
22 #include "ui/views/controls/image_view.h" 22 #include "ui/views/controls/image_view.h"
23 #include "ui/views/controls/label.h" 23 #include "ui/views/controls/label.h"
24 #include "ui/views/layout/box_layout.h" 24 #include "ui/views/layout/box_layout.h"
25 25
26 namespace ash { 26 namespace ash {
27 namespace { 27 namespace {
28 28
29 // Decides the non-material design image resource to use for a given update 29 // Decides the non-material design image resource to use for a given update
30 // severity. 30 // severity.
31 // TODO(tdanderson): This is only used for non-material design, so remove it 31 // TODO(tdanderson): This is only used for non-material design, so remove it
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 explicit UpdateView(const UpdateInfo& info) { 83 explicit UpdateView(const UpdateInfo& info) {
84 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 84 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
85 kTrayPopupPaddingHorizontal, 0, 85 kTrayPopupPaddingHorizontal, 0,
86 kTrayPopupPaddingBetweenItems)); 86 kTrayPopupPaddingBetweenItems));
87 87
88 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 88 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
89 views::ImageView* image = 89 views::ImageView* image =
90 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); 90 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT));
91 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 91 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
92 image->SetImage(gfx::CreateVectorIcon( 92 image->SetImage(gfx::CreateVectorIcon(
93 gfx::VectorIconId::SYSTEM_MENU_UPDATE, 93 kSystemMenuUpdateIcon,
94 IconColorForUpdateSeverity(info.severity, true))); 94 IconColorForUpdateSeverity(info.severity, true)));
95 } else { 95 } else {
96 image->SetImage(bundle.GetImageNamed(DecideResource(info.severity, true)) 96 image->SetImage(bundle.GetImageNamed(DecideResource(info.severity, true))
97 .ToImageSkia()); 97 .ToImageSkia());
98 } 98 }
99 AddChildView(image); 99 AddChildView(image);
100 100
101 base::string16 label = 101 base::string16 label =
102 info.factory_reset_required 102 info.factory_reset_required
103 ? bundle.GetLocalizedString( 103 ? bundle.GetLocalizedString(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « ash/common/system/tray_accessibility.cc ('k') | ash/resources/vector_icons/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698