Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: ash/system/settings/tray_settings.cc

Issue 11421180: Fix uber tray crash on stumpy which has no battery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_)
73 power_status_view_->UpdatePowerStatus(status); 73 return;
74 power_status_view_->UpdatePowerStatus(status);
74 string16 accessible_name = label_ ? 75 string16 accessible_name = label_ ?
75 label_->text() + ASCIIToUTF16(", ") + 76 label_->text() + ASCIIToUTF16(", ") +
76 power_status_view_->accessible_name() : 77 power_status_view_->accessible_name() :
77 power_status_view_->accessible_name(); 78 power_status_view_->accessible_name();
78 SetAccessibleName(accessible_name); 79 SetAccessibleName(accessible_name);
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 ||
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698