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.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 TrayDate::TrayDate() | 124 TrayDate::TrayDate() |
125 : time_tray_(NULL) { | 125 : time_tray_(NULL) { |
126 } | 126 } |
127 | 127 |
128 TrayDate::~TrayDate() { | 128 TrayDate::~TrayDate() { |
129 } | 129 } |
130 | 130 |
131 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { | 131 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { |
132 CHECK(time_tray_ == NULL); | 132 CHECK(time_tray_ == NULL); |
133 time_tray_ = new tray::TimeView(); | |
134 ClockLayout clock_layout = | 133 ClockLayout clock_layout = |
135 ash::Shell::GetInstance()->system_tray()->shelf_alignment() == | 134 ash::Shell::GetInstance()->system_tray()->shelf_alignment() == |
136 SHELF_ALIGNMENT_BOTTOM ? | 135 SHELF_ALIGNMENT_BOTTOM ? |
137 HORIZONTAL_CLOCK : VERTICAL_CLOCK; | 136 HORIZONTAL_CLOCK : VERTICAL_CLOCK; |
138 time_tray_->UpdateClockLayout(clock_layout); | 137 time_tray_ = new tray::TimeView(clock_layout); |
139 SetupLabelForTimeTray(time_tray_->label()); | |
140 SetupLabelForTimeTray(time_tray_->label_hour()); | |
141 SetupLabelForTimeTray(time_tray_->label_minute()); | |
142 | |
143 views::View* view = new TrayItemView; | 138 views::View* view = new TrayItemView; |
144 view->AddChildView(time_tray_); | 139 view->AddChildView(time_tray_); |
145 return view; | 140 return view; |
146 } | 141 } |
147 | 142 |
148 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { | 143 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { |
149 return new DateDefaultView(status); | 144 return new DateDefaultView(status); |
150 } | 145 } |
151 | 146 |
152 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { | 147 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { |
(...skipping 24 matching lines...) Expand all Loading... |
177 void TrayDate::OnDateFormatChanged() { | 172 void TrayDate::OnDateFormatChanged() { |
178 if (time_tray_) | 173 if (time_tray_) |
179 time_tray_->UpdateTimeFormat(); | 174 time_tray_->UpdateTimeFormat(); |
180 } | 175 } |
181 | 176 |
182 void TrayDate::Refresh() { | 177 void TrayDate::Refresh() { |
183 if (time_tray_) | 178 if (time_tray_) |
184 time_tray_->UpdateText(); | 179 time_tray_->UpdateText(); |
185 } | 180 } |
186 | 181 |
187 void TrayDate::SetupLabelForTimeTray(views::Label* label) { | |
188 SetupLabelForTray(label); | |
189 gfx::Font font = label->font(); | |
190 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); | |
191 } | |
192 | |
193 } // namespace internal | 182 } // namespace internal |
194 } // namespace ash | 183 } // namespace ash |
OLD | NEW |