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/color_palette.h" |
18 #include "ui/gfx/paint_vector_icon.h" | |
18 #include "ui/message_center/message_center.h" | 19 #include "ui/message_center/message_center.h" |
20 #include "ui/message_center/message_center_style.h" | |
19 #include "ui/message_center/notification.h" | 21 #include "ui/message_center/notification.h" |
20 #include "ui/message_center/notification_delegate.h" | 22 #include "ui/message_center/notification_delegate.h" |
21 | 23 |
22 namespace arc { | 24 namespace arc { |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 constexpr char kNotifierId[] = "arc_fs_migration"; | 28 constexpr char kNotifierId[] = "arc_fs_migration"; |
27 constexpr char kNotificationId[] = "arc_fs_migration/migrate"; | 29 constexpr char kNotificationId[] = "arc_fs_migration/migrate"; |
28 | 30 |
(...skipping 21 matching lines...) Expand all Loading... | |
50 false /* by_user */); | 52 false /* by_user */); |
51 | 53 |
52 message_center::NotifierId notifier_id( | 54 message_center::NotifierId notifier_id( |
53 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); | 55 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); |
54 notifier_id.profile_id = | 56 notifier_id.profile_id = |
55 multi_user_util::GetAccountIdFromProfile(profile).GetUserEmail(); | 57 multi_user_util::GetAccountIdFromProfile(profile).GetUserEmail(); |
56 | 58 |
57 message_center::RichNotificationData data; | 59 message_center::RichNotificationData data; |
58 data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( | 60 data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( |
59 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_RESTART_BUTTON))); | 61 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_RESTART_BUTTON))); |
60 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); | |
61 message_center::MessageCenter::Get()->AddNotification( | 62 message_center::MessageCenter::Get()->AddNotification( |
62 base::MakeUnique<message_center::Notification>( | 63 base::MakeUnique<message_center::Notification>( |
63 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, | 64 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, |
64 l10n_util::GetStringUTF16( | 65 l10n_util::GetStringUTF16( |
65 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), | 66 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), |
66 // TODO(kinaba): crbug/710289 Change message for low-battery case. | 67 // TODO(kinaba): crbug/710289 Change message for low-battery case. |
67 l10n_util::GetStringUTF16( | 68 l10n_util::GetStringUTF16( |
68 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_MESSAGE), | 69 IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_MESSAGE), |
69 // TODO(kinaba): crbug/710285 Replace the icon with the final design. | 70 gfx::Image(gfx::CreateVectorIcon( |
70 resource_bundle.GetImageNamed(IDR_ARC_PLAY_STORE_NOTIFICATION), | 71 kArcMigrateEncryptionNotificationIcon, |
72 message_center::kNotificationIconSize, gfx::kPlaceholderColor)), | |
Evan Stade
2017/04/20 14:26:38
nit: you don't need to specify the size
kinaba
2017/04/21 02:05:51
Done.
| |
71 base::string16(), GURL(), notifier_id, data, | 73 base::string16(), GURL(), notifier_id, data, |
72 new ArcMigrationGuideNotificationDelegate())); | 74 new ArcMigrationGuideNotificationDelegate())); |
73 } | 75 } |
74 | 76 |
75 } // namespace arc | 77 } // namespace arc |
OLD | NEW |