OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/arc/arc_migration_guide_notification.h" | 5 #include "chrome/browser/chromeos/arc/arc_migration_guide_notification.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "chrome/app/vector_icons/vector_icons.h" | |
9 #include "chrome/browser/chromeos/arc/arc_util.h" | 10 #include "chrome/browser/chromeos/arc/arc_util.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 13 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
14 #include "chrome/grit/theme_resources.h" | |
15 #include "components/signin/core/account_id/account_id.h" | 15 #include "components/signin/core/account_id/account_id.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
18 #include "ui/message_center/message_center.h" | 18 #include "ui/message_center/message_center.h" |
19 #include "ui/message_center/notification.h" | 19 #include "ui/message_center/notification.h" |
20 #include "ui/message_center/notification_delegate.h" | 20 #include "ui/message_center/notification_delegate.h" |
21 | 21 |
22 namespace arc { | 22 namespace arc { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 constexpr char kNotifierId[] = "arc_fs_migration"; | 26 constexpr char kNotifierId[] = "arc_fs_migration"; |
27 constexpr char kNotificationId[] = "arc_fs_migration/migrate"; | 27 constexpr char kNotificationId[] = "arc_fs_migration/migrate"; |
(...skipping 22 matching lines...) Expand all Loading... | |
50 false /* by_user */); | 50 false /* by_user */); |
51 | 51 |
52 message_center::NotifierId notifier_id( | 52 message_center::NotifierId notifier_id( |
53 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); | 53 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); |
54 notifier_id.profile_id = | 54 notifier_id.profile_id = |
55 multi_user_util::GetAccountIdFromProfile(profile).GetUserEmail(); | 55 multi_user_util::GetAccountIdFromProfile(profile).GetUserEmail(); |
56 | 56 |
57 message_center::RichNotificationData data; | 57 message_center::RichNotificationData data; |
58 data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( | 58 data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( |
59 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_RESTART_BUTTON))); | 59 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_RESTART_BUTTON))); |
60 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); | |
61 message_center::MessageCenter::Get()->AddNotification( | 60 message_center::MessageCenter::Get()->AddNotification( |
62 base::MakeUnique<message_center::Notification>( | 61 base::MakeUnique<message_center::Notification>( |
63 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, | 62 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, |
64 l10n_util::GetStringUTF16( | 63 l10n_util::GetStringUTF16( |
65 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), | 64 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), |
66 // TODO(kinaba): crbug/710289 Change message for low-battery case. | 65 // TODO(kinaba): crbug/710289 Change message for low-battery case. |
67 l10n_util::GetStringUTF16( | 66 l10n_util::GetStringUTF16( |
68 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_MESSAGE), | 67 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_MESSAGE), |
69 // TODO(kinaba): crbug/710285 Replace the icon with the final design. | 68 gfx::Image(gfx::CreateVectorIcon( |
Evan Stade
2017/04/14 14:46:41
I believe you need to specify a size or this icon
kinaba
2017/04/17 08:08:55
elizabethchiu@
Here's the screenshot:
https://dri
| |
70 resource_bundle.GetImageNamed(IDR_ARC_PLAY_STORE_NOTIFICATION), | 69 kArcMigrateEncryptionNotificationIcon, SK_ColorTRANSPARENT)), |
Evan Stade
2017/04/14 14:46:41
if you don't need to pass a color (because all the
kinaba
2017/04/17 08:08:55
Done.
| |
71 base::string16(), GURL(), notifier_id, data, | 70 base::string16(), GURL(), notifier_id, data, |
72 new ArcMigrationGuideNotificationDelegate())); | 71 new ArcMigrationGuideNotificationDelegate())); |
73 } | 72 } |
74 | 73 |
75 } // namespace arc | 74 } // namespace arc |
OLD | NEW |