| OLD | NEW |
| 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/chromeos/power/tray_power.h" | 5 #include "ash/common/system/chromeos/power/tray_power.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/system/chromeos/devicetype_utils.h" | 11 #include "ash/common/system/chromeos/devicetype_utils.h" |
| 12 #include "ash/common/system/chromeos/power/battery_notification.h" | 12 #include "ash/common/system/chromeos/power/battery_notification.h" |
| 13 #include "ash/common/system/chromeos/power/dual_role_notification.h" | 13 #include "ash/common/system/chromeos/power/dual_role_notification.h" |
| 14 #include "ash/common/system/date/date_view.h" | 14 #include "ash/common/system/date/date_view.h" |
| 15 #include "ash/common/system/system_notifier.h" | 15 #include "ash/common/system/system_notifier.h" |
| 16 #include "ash/common/system/tray/system_tray_delegate.h" | 16 #include "ash/common/system/tray/system_tray_delegate.h" |
| 17 #include "ash/common/system/tray/tray_constants.h" | 17 #include "ash/common/system/tray/tray_constants.h" |
| 18 #include "ash/common/system/tray/tray_item_view.h" | 18 #include "ash/common/system/tray/tray_item_view.h" |
| 19 #include "ash/common/system/tray/tray_utils.h" | 19 #include "ash/common/system/tray/tray_utils.h" |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "grit/ash_resources.h" | 24 #include "grit/ash_resources.h" |
| 25 #include "grit/ash_strings.h" | 25 #include "grit/ash_strings.h" |
| 26 #include "ui/accessibility/ax_view_state.h" | 26 #include "ui/accessibility/ax_node_data.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/message_center/message_center.h" | 28 #include "ui/message_center/message_center.h" |
| 29 #include "ui/message_center/notification.h" | 29 #include "ui/message_center/notification.h" |
| 30 #include "ui/message_center/notification_delegate.h" | 30 #include "ui/message_center/notification_delegate.h" |
| 31 #include "ui/views/controls/image_view.h" | 31 #include "ui/views/controls/image_view.h" |
| 32 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
| 33 | 33 |
| 34 using message_center::MessageCenter; | 34 using message_center::MessageCenter; |
| 35 using message_center::Notification; | 35 using message_center::Notification; |
| 36 | 36 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 class PowerTrayView : public TrayItemView { | 94 class PowerTrayView : public TrayItemView { |
| 95 public: | 95 public: |
| 96 explicit PowerTrayView(SystemTrayItem* owner) : TrayItemView(owner) { | 96 explicit PowerTrayView(SystemTrayItem* owner) : TrayItemView(owner) { |
| 97 CreateImageView(); | 97 CreateImageView(); |
| 98 UpdateImage(); | 98 UpdateImage(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 ~PowerTrayView() override {} | 101 ~PowerTrayView() override {} |
| 102 | 102 |
| 103 // Overriden from views::View. | 103 // Overriden from views::View. |
| 104 void GetAccessibleState(ui::AXViewState* state) override { | 104 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { |
| 105 state->name = accessible_name_; | 105 node_data->SetName(accessible_name_); |
| 106 state->role = ui::AX_ROLE_BUTTON; | 106 node_data->role = ui::AX_ROLE_BUTTON; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void UpdateStatus(bool battery_alert) { | 109 void UpdateStatus(bool battery_alert) { |
| 110 UpdateImage(); | 110 UpdateImage(); |
| 111 SetVisible(PowerStatus::Get()->IsBatteryPresent()); | 111 SetVisible(PowerStatus::Get()->IsBatteryPresent()); |
| 112 | 112 |
| 113 if (battery_alert) { | 113 if (battery_alert) { |
| 114 accessible_name_ = PowerStatus::Get()->GetAccessibleNameString(true); | 114 accessible_name_ = PowerStatus::Get()->GetAccessibleNameString(true); |
| 115 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 115 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 116 } | 116 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 NOTREACHED(); | 355 NOTREACHED(); |
| 356 return false; | 356 return false; |
| 357 } | 357 } |
| 358 | 358 |
| 359 void TrayPower::NotifyUsbNotificationClosedByUser() { | 359 void TrayPower::NotifyUsbNotificationClosedByUser() { |
| 360 usb_notification_dismissed_ = true; | 360 usb_notification_dismissed_ = true; |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace ash | 363 } // namespace ash |
| OLD | NEW |