| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/power/dual_role_notification.h" | 5 #include "ash/common/system/chromeos/power/dual_role_notification.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "ash/common/system/chromeos/power/power_status.h" | 9 #include "ash/common/system/chromeos/power/power_status.h" |
| 10 #include "ash/common/system/system_notifier.h" | 10 #include "ash/common/system/system_notifier.h" |
| 11 #include "ash/common/system/tray/system_tray_controller.h" | 11 #include "ash/common/system/tray/system_tray_controller.h" |
| 12 #include "ash/common/wm_shell.h" | |
| 13 #include "ash/resources/grit/ash_resources.h" | 12 #include "ash/resources/grit/ash_resources.h" |
| 13 #include "ash/shell.h" |
| 14 #include "ash/strings/grit/ash_strings.h" | 14 #include "ash/strings/grit/ash_strings.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/l10n/time_format.h" | 17 #include "ui/base/l10n/time_format.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 20 #include "ui/message_center/message_center.h" | 20 #include "ui/message_center/message_center.h" |
| 21 #include "ui/message_center/notification.h" | 21 #include "ui/message_center/notification.h" |
| 22 #include "ui/message_center/notification_delegate.h" | 22 #include "ui/message_center/notification_delegate.h" |
| 23 | 23 |
| 24 using message_center::MessageCenter; | 24 using message_center::MessageCenter; |
| 25 using message_center::Notification; | 25 using message_center::Notification; |
| 26 | 26 |
| 27 namespace ash { | 27 namespace ash { |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 const char kDualRoleNotificationId[] = "dual-role"; | 30 const char kDualRoleNotificationId[] = "dual-role"; |
| 31 | 31 |
| 32 // Opens power settings on click. | 32 // Opens power settings on click. |
| 33 class DualRoleNotificationDelegate | 33 class DualRoleNotificationDelegate |
| 34 : public message_center::NotificationDelegate { | 34 : public message_center::NotificationDelegate { |
| 35 public: | 35 public: |
| 36 DualRoleNotificationDelegate() {} | 36 DualRoleNotificationDelegate() {} |
| 37 | 37 |
| 38 // Overridden from message_center::NotificationDelegate. | 38 // Overridden from message_center::NotificationDelegate. |
| 39 void Click() override { | 39 void Click() override { |
| 40 WmShell::Get()->system_tray_controller()->ShowPowerSettings(); | 40 Shell::Get()->system_tray_controller()->ShowPowerSettings(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 ~DualRoleNotificationDelegate() override {} | 44 ~DualRoleNotificationDelegate() override {} |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(DualRoleNotificationDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(DualRoleNotificationDelegate); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 base::string16(), GURL(), | 148 base::string16(), GURL(), |
| 149 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 149 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 150 system_notifier::kNotifierDualRole), | 150 system_notifier::kNotifierDualRole), |
| 151 message_center::RichNotificationData(), | 151 message_center::RichNotificationData(), |
| 152 new DualRoleNotificationDelegate)); | 152 new DualRoleNotificationDelegate)); |
| 153 notification->set_priority(message_center::MIN_PRIORITY); | 153 notification->set_priority(message_center::MIN_PRIORITY); |
| 154 return notification; | 154 return notification; |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace ash | 157 } // namespace ash |
| OLD | NEW |