| 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/tray_power.h" | 5 #include "ash/system/power/tray_power.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/date/date_view.h" | 8 #include "ash/system/date/date_view.h" |
| 9 #include "ash/system/power/power_supply_status.h" | 9 #include "ash/system/power/power_supply_status.h" |
| 10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 views::View* container = new views::View; | 189 views::View* container = new views::View; |
| 190 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kHorizontal, | 190 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 191 0, 0, 0); | 191 0, 0, 0); |
| 192 | 192 |
| 193 layout->set_spread_blank_space(true); | 193 layout->set_spread_blank_space(true); |
| 194 container->SetLayoutManager(layout); | 194 container->SetLayoutManager(layout); |
| 195 container->set_background(views::Background::CreateSolidBackground( | 195 container->set_background(views::Background::CreateSolidBackground( |
| 196 kHeaderBackgroundColor)); | 196 kHeaderBackgroundColor)); |
| 197 HoverHighlightView* view = new HoverHighlightView(NULL); | 197 HoverHighlightView* view = new HoverHighlightView(NULL); |
| 198 view->SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 198 view->SetLayoutManager(new views::FillLayout); |
| 199 kTrayPopupPaddingHorizontal, kPaddingVertical, 0)); | |
| 200 view->AddChildView(date_.get()); | 199 view->AddChildView(date_.get()); |
| 200 date_->set_border(views::Border::CreateEmptyBorder(kPaddingVertical, |
| 201 kTrayPopupPaddingHorizontal, |
| 202 kPaddingVertical, |
| 203 kTrayPopupPaddingHorizontal)); |
| 201 container->AddChildView(view); | 204 container->AddChildView(view); |
| 205 view->set_focusable(false); |
| 202 | 206 |
| 203 if (status != user::LOGGED_IN_NONE && status != user::LOGGED_IN_LOCKED) { | 207 if (status != user::LOGGED_IN_NONE && status != user::LOGGED_IN_LOCKED) { |
| 204 date_->SetActionable(true); | 208 date_->SetActionable(true); |
| 205 view->set_highlight_color(kHeaderHoverBackgroundColor); | 209 view->set_highlight_color(kHeaderHoverBackgroundColor); |
| 206 } else { | 210 } else { |
| 207 view->set_highlight_color(SkColorSetARGB(0, 0, 0, 0)); | 211 view->set_highlight_color(SkColorSetARGB(0, 0, 0, 0)); |
| 208 } | 212 } |
| 209 | 213 |
| 210 PowerSupplyStatus power_status = | 214 PowerSupplyStatus power_status = |
| 211 ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus(); | 215 ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 239 | 243 |
| 240 void TrayPower::OnPowerStatusChanged(const PowerSupplyStatus& status) { | 244 void TrayPower::OnPowerStatusChanged(const PowerSupplyStatus& status) { |
| 241 if (power_tray_.get()) | 245 if (power_tray_.get()) |
| 242 power_tray_->UpdatePowerStatus(status); | 246 power_tray_->UpdatePowerStatus(status); |
| 243 if (power_.get()) | 247 if (power_.get()) |
| 244 power_->UpdatePowerStatus(status); | 248 power_->UpdatePowerStatus(status); |
| 245 } | 249 } |
| 246 | 250 |
| 247 } // namespace internal | 251 } // namespace internal |
| 248 } // namespace ash | 252 } // namespace ash |
| OLD | NEW |