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/power/power_status_view.h" | 5 #include "ash/system/power/power_status_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/system/power/tray_power.h" | 9 #include "ash/system/power/tray_power.h" |
10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); | 85 new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); |
86 AddChildView(icon_); | 86 AddChildView(icon_); |
87 | 87 |
88 AddChildView(time_status_label_); | 88 AddChildView(time_status_label_); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void PowerStatusView::LayoutNotificationView() { | 92 void PowerStatusView::LayoutNotificationView() { |
93 SetLayoutManager( | 93 SetLayoutManager( |
94 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); | 94 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); |
95 status_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 95 status_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
96 AddChildView(status_label_); | 96 AddChildView(status_label_); |
97 | 97 |
98 time_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 98 time_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
99 AddChildView(time_label_); | 99 AddChildView(time_label_); |
100 } | 100 } |
101 | 101 |
102 void PowerStatusView::UpdateText() { | 102 void PowerStatusView::UpdateText() { |
103 view_type_ == VIEW_DEFAULT ? | 103 view_type_ == VIEW_DEFAULT ? |
104 UpdateTextForDefaultView() : UpdateTextForNotificationView(); | 104 UpdateTextForDefaultView() : UpdateTextForNotificationView(); |
105 } | 105 } |
106 | 106 |
107 void PowerStatusView::UpdateTextForDefaultView() { | 107 void PowerStatusView::UpdateTextForDefaultView() { |
108 if (supply_status_.line_power_on && supply_status_.battery_is_full) { | 108 if (supply_status_.line_power_on && supply_status_.battery_is_full) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 PreferredSizeChanged(); | 235 PreferredSizeChanged(); |
236 } | 236 } |
237 | 237 |
238 gfx::Size PowerStatusView::GetPreferredSize() { | 238 gfx::Size PowerStatusView::GetPreferredSize() { |
239 gfx::Size size = views::View::GetPreferredSize(); | 239 gfx::Size size = views::View::GetPreferredSize(); |
240 return gfx::Size(size.width(), kTrayPopupItemHeight); | 240 return gfx::Size(size.width(), kTrayPopupItemHeight); |
241 } | 241 } |
242 | 242 |
243 } // namespace internal | 243 } // namespace internal |
244 } // namespace ash | 244 } // namespace ash |
OLD | NEW |