| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/chromeos/eol_notification.h" | 5 #include "chrome/browser/chromeos/eol_notification.h" |
| 6 | 6 |
| 7 #include "chrome/app/vector_icons/vector_icons.h" |
| 7 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
| 9 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 11 #include "chrome/browser/ui/browser_navigator.h" |
| 11 #include "chrome/browser/ui/browser_navigator_params.h" | 12 #include "chrome/browser/ui/browser_navigator_params.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/dbus/update_engine_client.h" | 17 #include "chromeos/dbus/update_engine_client.h" |
| 17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/gfx/color_palette.h" | 20 #include "ui/gfx/color_palette.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/vector_icons/vector_icons.h" |
| 22 | 23 |
| 23 using message_center::MessageCenter; | 24 using message_center::MessageCenter; |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 const char kEolNotificationId[] = "eol"; | 29 const char kEolNotificationId[] = "eol"; |
| 29 const char kDelegateId[] = "eol_delegate"; | 30 const char kDelegateId[] = "eol_delegate"; |
| 30 const SkColor kButtonIconColor = SkColorSetRGB(150, 150, 152); | 31 const SkColor kButtonIconColor = SkColorSetRGB(150, 150, 152); |
| 31 const SkColor kNotificationIconColor = SkColorSetRGB(219, 68, 55); | 32 const SkColor kNotificationIconColor = SkColorSetRGB(219, 68, 55); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 profile_->GetPrefs()->GetBoolean(prefs::kEolNotificationDismissed); | 133 profile_->GetPrefs()->GetBoolean(prefs::kEolNotificationDismissed); |
| 133 if (user_dismissed_eol_notification) | 134 if (user_dismissed_eol_notification) |
| 134 return; | 135 return; |
| 135 | 136 |
| 136 Update(); | 137 Update(); |
| 137 } | 138 } |
| 138 | 139 |
| 139 void EolNotification::Update() { | 140 void EolNotification::Update() { |
| 140 message_center::ButtonInfo learn_more( | 141 message_center::ButtonInfo learn_more( |
| 141 l10n_util::GetStringUTF16(IDS_EOL_MORE_INFO_BUTTON)); | 142 l10n_util::GetStringUTF16(IDS_EOL_MORE_INFO_BUTTON)); |
| 142 learn_more.icon = gfx::Image( | 143 learn_more.icon = |
| 143 CreateVectorIcon(gfx::VectorIconId::INFO_OUTLINE, kButtonIconColor)); | 144 gfx::Image(CreateVectorIcon(ui::kInfoOutlineIcon, kButtonIconColor)); |
| 144 message_center::ButtonInfo dismiss( | 145 message_center::ButtonInfo dismiss( |
| 145 l10n_util::GetStringUTF16(IDS_EOL_DISMISS_BUTTON)); | 146 l10n_util::GetStringUTF16(IDS_EOL_DISMISS_BUTTON)); |
| 146 dismiss.icon = gfx::Image( | 147 dismiss.icon = |
| 147 CreateVectorIcon(gfx::VectorIconId::NOTIFICATIONS_OFF, kButtonIconColor)); | 148 gfx::Image(CreateVectorIcon(ui::kNotificationsOffIcon, kButtonIconColor)); |
| 148 | 149 |
| 149 message_center::RichNotificationData data; | 150 message_center::RichNotificationData data; |
| 150 data.buttons.push_back(learn_more); | 151 data.buttons.push_back(learn_more); |
| 151 data.buttons.push_back(dismiss); | 152 data.buttons.push_back(dismiss); |
| 152 | 153 |
| 153 Notification notification( | 154 Notification notification( |
| 154 message_center::NOTIFICATION_TYPE_SIMPLE, | 155 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 155 l10n_util::GetStringUTF16(IDS_EOL_NOTIFICATION_TITLE), | 156 l10n_util::GetStringUTF16(IDS_EOL_NOTIFICATION_TITLE), |
| 156 l10n_util::GetStringUTF16(IDS_EOL_NOTIFICATION_EOL), | 157 l10n_util::GetStringUTF16(IDS_EOL_NOTIFICATION_EOL), |
| 157 gfx::Image( | 158 gfx::Image(CreateVectorIcon(kEolIcon, kNotificationIconColor)), |
| 158 CreateVectorIcon(gfx::VectorIconId::EOL, kNotificationIconColor)), | |
| 159 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 159 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 160 kEolNotificationId), | 160 kEolNotificationId), |
| 161 base::string16(), // display_source | 161 base::string16(), // display_source |
| 162 GURL(), kEolNotificationId, data, new EolNotificationDelegate(profile_)); | 162 GURL(), kEolNotificationId, data, new EolNotificationDelegate(profile_)); |
| 163 g_browser_process->notification_ui_manager()->Add(notification, profile_); | 163 g_browser_process->notification_ui_manager()->Add(notification, profile_); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace chromeos | 166 } // namespace chromeos |
| OLD | NEW |