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/chromeos/power/power_status_view.h" | 5 #include "ash/system/chromeos/power/power_status_view.h" |
6 | 6 |
7 #include "ash/common/system/tray/fixed_sized_image_view.h" | 7 #include "ash/common/system/tray/fixed_sized_image_view.h" |
8 #include "ash/common/system/tray/tray_constants.h" | 8 #include "ash/common/system/tray/tray_constants.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 PowerStatusView::~PowerStatusView() { | 42 PowerStatusView::~PowerStatusView() { |
43 PowerStatus::Get()->RemoveObserver(this); | 43 PowerStatus::Get()->RemoveObserver(this); |
44 } | 44 } |
45 | 45 |
46 void PowerStatusView::OnPowerStatusChanged() { | 46 void PowerStatusView::OnPowerStatusChanged() { |
47 UpdateText(); | 47 UpdateText(); |
48 const PowerStatus::BatteryImageInfo info = | 48 const PowerStatus::BatteryImageInfo info = |
49 PowerStatus::Get()->GetBatteryImageInfo(PowerStatus::ICON_DARK); | 49 PowerStatus::Get()->GetBatteryImageInfo(PowerStatus::ICON_DARK); |
50 if (info != previous_battery_image_info_) { | 50 if (info != previous_battery_image_info_) { |
51 icon_->SetImage( | 51 icon_->SetImage( |
52 PowerStatus::Get()->GetBatteryImage(PowerStatus::ICON_DARK)); | 52 PowerStatus::Get()->GetBatteryImage(info)); |
53 icon_->SetVisible(true); | 53 icon_->SetVisible(true); |
54 previous_battery_image_info_ = info; | 54 previous_battery_image_info_ = info; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 void PowerStatusView::LayoutView() { | 58 void PowerStatusView::LayoutView() { |
59 if (default_view_right_align_) { | 59 if (default_view_right_align_) { |
60 views::BoxLayout* layout = | 60 views::BoxLayout* layout = |
61 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, | 61 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, |
62 kPaddingBetweenBatteryStatusAndIcon); | 62 kPaddingBetweenBatteryStatusAndIcon); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Move the time_status_label_, separator_label_, and percentage_label_ | 142 // Move the time_status_label_, separator_label_, and percentage_label_ |
143 // closer to each other. | 143 // closer to each other. |
144 if (percentage_label_ && separator_label_ && time_status_label_ && | 144 if (percentage_label_ && separator_label_ && time_status_label_ && |
145 percentage_label_->visible() && time_status_label_->visible()) { | 145 percentage_label_->visible() && time_status_label_->visible()) { |
146 separator_label_->SetX(percentage_label_->bounds().right() + 1); | 146 separator_label_->SetX(percentage_label_->bounds().right() + 1); |
147 time_status_label_->SetX(separator_label_->bounds().right() + 1); | 147 time_status_label_->SetX(separator_label_->bounds().right() + 1); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 } // namespace ash | 151 } // namespace ash |
OLD | NEW |