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_default_view.h" | 8 #include "ash/system/date/date_default_view.h" |
9 #include "ash/system/date/date_view.h" | 9 #include "ash/system/date/date_view.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return default_view_; | 46 return default_view_; |
47 } | 47 } |
48 | 48 |
49 views::View* TrayDate::CreateDefaultViewForTesting(user::LoginStatus status) { | 49 views::View* TrayDate::CreateDefaultViewForTesting(user::LoginStatus status) { |
50 return CreateDefaultView(status); | 50 return CreateDefaultView(status); |
51 } | 51 } |
52 | 52 |
53 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { | 53 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { |
54 CHECK(time_tray_ == NULL); | 54 CHECK(time_tray_ == NULL); |
55 ClockLayout clock_layout = | 55 ClockLayout clock_layout = |
56 (system_tray()->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM || | 56 system_tray()->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM |
57 system_tray()->shelf_alignment() == SHELF_ALIGNMENT_TOP) ? | 57 ? HORIZONTAL_CLOCK |
58 HORIZONTAL_CLOCK : VERTICAL_CLOCK; | 58 : VERTICAL_CLOCK; |
59 time_tray_ = new tray::TimeView(clock_layout); | 59 time_tray_ = new tray::TimeView(clock_layout); |
60 views::View* view = new TrayItemView(this); | 60 views::View* view = new TrayItemView(this); |
61 view->AddChildView(time_tray_); | 61 view->AddChildView(time_tray_); |
62 return view; | 62 return view; |
63 } | 63 } |
64 | 64 |
65 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { | 65 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { |
66 default_view_ = new DateDefaultView(status); | 66 default_view_ = new DateDefaultView(status); |
67 | 67 |
68 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
(...skipping 18 matching lines...) Expand all Loading... |
87 } | 87 } |
88 | 88 |
89 void TrayDate::DestroyDetailedView() { | 89 void TrayDate::DestroyDetailedView() { |
90 } | 90 } |
91 | 91 |
92 void TrayDate::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 92 void TrayDate::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
93 } | 93 } |
94 | 94 |
95 void TrayDate::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 95 void TrayDate::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
96 if (time_tray_) { | 96 if (time_tray_) { |
97 ClockLayout clock_layout = (alignment == SHELF_ALIGNMENT_BOTTOM || | 97 ClockLayout clock_layout = |
98 alignment == SHELF_ALIGNMENT_TOP) ? | 98 alignment == SHELF_ALIGNMENT_BOTTOM ? HORIZONTAL_CLOCK : VERTICAL_CLOCK; |
99 HORIZONTAL_CLOCK : VERTICAL_CLOCK; | |
100 time_tray_->UpdateClockLayout(clock_layout); | 99 time_tray_->UpdateClockLayout(clock_layout); |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 void TrayDate::OnDateFormatChanged() { | 103 void TrayDate::OnDateFormatChanged() { |
105 if (time_tray_) | 104 if (time_tray_) |
106 time_tray_->UpdateTimeFormat(); | 105 time_tray_->UpdateTimeFormat(); |
107 if (default_view_) | 106 if (default_view_) |
108 default_view_->GetDateView()->UpdateTimeFormat(); | 107 default_view_->GetDateView()->UpdateTimeFormat(); |
109 } | 108 } |
(...skipping 13 matching lines...) Expand all Loading... |
123 can_set_time ? TrayDate::SET_SYSTEM_TIME : TrayDate::NONE); | 122 can_set_time ? TrayDate::SET_SYSTEM_TIME : TrayDate::NONE); |
124 } | 123 } |
125 } | 124 } |
126 | 125 |
127 void TrayDate::Refresh() { | 126 void TrayDate::Refresh() { |
128 if (time_tray_) | 127 if (time_tray_) |
129 time_tray_->UpdateText(); | 128 time_tray_->UpdateText(); |
130 } | 129 } |
131 | 130 |
132 } // namespace ash | 131 } // namespace ash |
OLD | NEW |