Chromium Code Reviews| 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/system/settings/tray_settings.h" | 5 #include "ash/system/settings/tray_settings.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/power/power_status_view.h" | 8 #include "ash/system/power/power_status_view.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 power_status_view_ = new ash::internal::PowerStatusView( | 62 power_status_view_ = new ash::internal::PowerStatusView( |
| 63 ash::internal::PowerStatusView::VIEW_DEFAULT, power_view_right_align); | 63 ash::internal::PowerStatusView::VIEW_DEFAULT, power_view_right_align); |
| 64 AddChildView(power_status_view_); | 64 AddChildView(power_status_view_); |
| 65 UpdatePowerStatus(power_status); | 65 UpdatePowerStatus(power_status); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual ~SettingsDefaultView() {} | 69 virtual ~SettingsDefaultView() {} |
| 70 | 70 |
| 71 void UpdatePowerStatus(const PowerSupplyStatus& status) { | 71 void UpdatePowerStatus(const PowerSupplyStatus& status) { |
| 72 if (power_status_view_) | 72 if (power_status_view_) { |
|
stevenjb
2012/11/30 20:36:44
nit: if (!power_status_view_) return;?
oshima
2012/11/30 21:23:22
agreed. done.
| |
| 73 power_status_view_->UpdatePowerStatus(status); | 73 power_status_view_->UpdatePowerStatus(status); |
| 74 string16 accessible_name = label_ ? | 74 string16 accessible_name = label_ ? |
| 75 label_->text() + ASCIIToUTF16(", ") + | 75 label_->text() + ASCIIToUTF16(", ") + |
| 76 power_status_view_->accessible_name() : | 76 power_status_view_->accessible_name() : |
| 77 power_status_view_->accessible_name(); | 77 power_status_view_->accessible_name(); |
| 78 SetAccessibleName(accessible_name); | 78 SetAccessibleName(accessible_name); |
| 79 } | |
| 79 } | 80 } |
| 80 | 81 |
| 81 // Overridden from ash::internal::ActionableView. | 82 // Overridden from ash::internal::ActionableView. |
| 82 virtual bool PerformAction(const ui::Event& event) OVERRIDE { | 83 virtual bool PerformAction(const ui::Event& event) OVERRIDE { |
| 83 if (login_status_ == user::LOGGED_IN_NONE || | 84 if (login_status_ == user::LOGGED_IN_NONE || |
| 84 login_status_ == user::LOGGED_IN_LOCKED) | 85 login_status_ == user::LOGGED_IN_LOCKED) |
| 85 return false; | 86 return false; |
| 86 | 87 |
| 87 ash::Shell::GetInstance()->tray_delegate()->ShowSettings(); | 88 ash::Shell::GetInstance()->tray_delegate()->ShowSettings(); |
| 88 return true; | 89 return true; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 } | 161 } |
| 161 | 162 |
| 162 // Overridden from PowerStatusObserver. | 163 // Overridden from PowerStatusObserver. |
| 163 void TraySettings::OnPowerStatusChanged(const PowerSupplyStatus& status) { | 164 void TraySettings::OnPowerStatusChanged(const PowerSupplyStatus& status) { |
| 164 if (default_view_) | 165 if (default_view_) |
| 165 default_view_->UpdatePowerStatus(status); | 166 default_view_->UpdatePowerStatus(status); |
| 166 } | 167 } |
| 167 | 168 |
| 168 } // namespace internal | 169 } // namespace internal |
| 169 } // namespace ash | 170 } // namespace ash |
| OLD | NEW |