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_date.h" | 5 #include "ash/system/power/tray_power_date.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/power/power_supply_status.h" | 8 #include "ash/system/power/power_supply_status.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 "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
11 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
12 #include "base/time.h" | 13 #include "base/time.h" |
13 #include "base/timer.h" | 14 #include "base/timer.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "grit/ui_resources.h" | 16 #include "grit/ui_resources.h" |
16 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
17 #include "third_party/skia/include/core/SkRect.h" | 18 #include "third_party/skia/include/core/SkRect.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 : power_(NULL), | 275 : power_(NULL), |
275 power_tray_(NULL) { | 276 power_tray_(NULL) { |
276 } | 277 } |
277 | 278 |
278 TrayPowerDate::~TrayPowerDate() { | 279 TrayPowerDate::~TrayPowerDate() { |
279 } | 280 } |
280 | 281 |
281 views::View* TrayPowerDate::CreateTrayView(user::LoginStatus status) { | 282 views::View* TrayPowerDate::CreateTrayView(user::LoginStatus status) { |
282 date_tray_.reset(new tray::DateView(tray::DateView::TIME)); | 283 date_tray_.reset(new tray::DateView(tray::DateView::TIME)); |
283 date_tray_->label()->SetFont( | 284 date_tray_->label()->SetFont( |
284 date_tray_->label()->font().DeriveFont(-1, gfx::Font::BOLD)); | 285 date_tray_->label()->font().DeriveFont(2, gfx::Font::BOLD)); |
285 date_tray_->label()->SetAutoColorReadabilityEnabled(false); | 286 date_tray_->label()->SetAutoColorReadabilityEnabled(false); |
286 date_tray_->label()->SetEnabledColor(SK_ColorWHITE); | 287 date_tray_->label()->SetEnabledColor(SK_ColorWHITE); |
287 | 288 |
288 power_tray_.reset(new tray::PowerTrayView()); | 289 power_tray_.reset(new tray::PowerTrayView()); |
289 | 290 |
290 views::View* container = new views::View; | 291 views::View* container = new views::View; |
291 container->SetLayoutManager(new views::BoxLayout( | 292 container->SetLayoutManager(new views::BoxLayout( |
292 views::BoxLayout::kHorizontal, 0, 0, 0)); | 293 views::BoxLayout::kHorizontal, 0, 0, kTrayPaddingBetweenItems)); |
293 container->AddChildView(power_tray_.get()); | 294 container->AddChildView(power_tray_.get()); |
294 container->AddChildView(date_tray_.get()); | 295 container->AddChildView(date_tray_.get()); |
295 | 296 |
296 return container; | 297 return container; |
297 } | 298 } |
298 | 299 |
299 views::View* TrayPowerDate::CreateDefaultView(user::LoginStatus status) { | 300 views::View* TrayPowerDate::CreateDefaultView(user::LoginStatus status) { |
300 date_.reset(new tray::DateView(tray::DateView::DATE)); | 301 date_.reset(new tray::DateView(tray::DateView::DATE)); |
301 if (status != user::LOGGED_IN_NONE) | 302 if (status != user::LOGGED_IN_NONE) |
302 date_->set_actionable(true); | 303 date_->set_actionable(true); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 if (power_.get()) | 338 if (power_.get()) |
338 power_->UpdatePowerStatus(status); | 339 power_->UpdatePowerStatus(status); |
339 } | 340 } |
340 | 341 |
341 void TrayPowerDate::OnDateFormatChanged() { | 342 void TrayPowerDate::OnDateFormatChanged() { |
342 date_tray_->UpdateTimeFormat(); | 343 date_tray_->UpdateTimeFormat(); |
343 } | 344 } |
344 | 345 |
345 } // namespace internal | 346 } // namespace internal |
346 } // namespace ash | 347 } // namespace ash |
OLD | NEW |