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/date/tray_date.h" | 5 #include "ash/system/date/tray_date.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/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" |
| 11 #include "ash/system/tray/tray_item_view.h" |
11 #include "ash/system/tray/tray_views.h" | 12 #include "ash/system/tray/tray_views.h" |
12 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
13 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
14 #include "base/time.h" | 15 #include "base/time.h" |
15 #include "base/timer.h" | 16 #include "base/timer.h" |
16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
17 #include "grit/ui_resources.h" | 18 #include "grit/ui_resources.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "third_party/skia/include/core/SkRect.h" | 20 #include "third_party/skia/include/core/SkRect.h" |
20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
22 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
23 #include "ui/views/controls/button/button.h" | 24 #include "ui/views/controls/button/button.h" |
24 #include "ui/views/controls/button/text_button.h" | 25 #include "ui/views/controls/button/text_button.h" |
25 #include "ui/views/controls/image_view.h" | 26 #include "ui/views/controls/image_view.h" |
26 #include "ui/views/controls/label.h" | 27 #include "ui/views/controls/label.h" |
27 #include "ui/views/layout/fill_layout.h" | |
28 #include "ui/views/layout/box_layout.h" | 28 #include "ui/views/layout/box_layout.h" |
29 #include "ui/views/view.h" | 29 #include "ui/views/view.h" |
30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
31 #include "unicode/datefmt.h" | 31 #include "unicode/datefmt.h" |
32 #include "unicode/fieldpos.h" | 32 #include "unicode/fieldpos.h" |
33 #include "unicode/fmtable.h" | 33 #include "unicode/fmtable.h" |
34 | 34 |
35 namespace ash { | 35 namespace ash { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 TrayDate::TrayDate() { | 38 TrayDate::TrayDate() { |
39 } | 39 } |
40 | 40 |
41 TrayDate::~TrayDate() { | 41 TrayDate::~TrayDate() { |
42 } | 42 } |
43 | 43 |
44 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { | 44 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { |
45 date_tray_.reset(new tray::DateView(tray::DateView::TIME)); | 45 date_tray_.reset(new tray::DateView(tray::DateView::TIME)); |
46 date_tray_->set_border( | 46 date_tray_->set_border( |
47 views::Border::CreateEmptyBorder(0, 10, 0, 7)); | 47 views::Border::CreateEmptyBorder(0, 10, 0, 7)); |
48 SetupLabelForTray(date_tray_->label()); | 48 SetupLabelForTray(date_tray_->label()); |
49 gfx::Font font = date_tray_->label()->font(); | 49 gfx::Font font = date_tray_->label()->font(); |
50 date_tray_->label()->SetFont( | 50 date_tray_->label()->SetFont( |
51 font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); | 51 font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); |
52 return date_tray_.get(); | 52 |
| 53 views::View* view = new TrayItemView; |
| 54 view->AddChildView(date_tray_.get()); |
| 55 return view; |
53 } | 56 } |
54 | 57 |
55 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { | 58 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { |
56 return NULL; | 59 return NULL; |
57 } | 60 } |
58 | 61 |
59 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { | 62 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { |
60 return NULL; | 63 return NULL; |
61 } | 64 } |
62 | 65 |
(...skipping 10 matching lines...) Expand all Loading... |
73 void TrayDate::OnDateFormatChanged() { | 76 void TrayDate::OnDateFormatChanged() { |
74 date_tray_->UpdateTimeFormat(); | 77 date_tray_->UpdateTimeFormat(); |
75 } | 78 } |
76 | 79 |
77 void TrayDate::Refresh() { | 80 void TrayDate::Refresh() { |
78 date_tray_->UpdateText(); | 81 date_tray_->UpdateText(); |
79 } | 82 } |
80 | 83 |
81 } // namespace internal | 84 } // namespace internal |
82 } // namespace ash | 85 } // namespace ash |
OLD | NEW |