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/date_view.h" | 5 #include "ash/system/date/date_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 day_of_week_label_->SetEnabledColor(kHeaderTextColorNormal); | 157 day_of_week_label_->SetEnabledColor(kHeaderTextColorNormal); |
158 SchedulePaint(); | 158 SchedulePaint(); |
159 } | 159 } |
160 | 160 |
161 TimeView::TimeView(TrayDate::ClockLayout clock_layout) | 161 TimeView::TimeView(TrayDate::ClockLayout clock_layout) |
162 : hour_type_( | 162 : hour_type_( |
163 ash::Shell::GetInstance()->tray_delegate()->GetHourClockType()) { | 163 ash::Shell::GetInstance()->tray_delegate()->GetHourClockType()) { |
164 SetupLabels(); | 164 SetupLabels(); |
165 UpdateTextInternal(base::Time::Now()); | 165 UpdateTextInternal(base::Time::Now()); |
166 UpdateClockLayout(clock_layout); | 166 UpdateClockLayout(clock_layout); |
| 167 set_focusable(false); |
167 } | 168 } |
168 | 169 |
169 TimeView::~TimeView() { | 170 TimeView::~TimeView() { |
170 } | 171 } |
171 | 172 |
172 void TimeView::UpdateTimeFormat() { | 173 void TimeView::UpdateTimeFormat() { |
173 hour_type_ = ash::Shell::GetInstance()->tray_delegate()->GetHourClockType(); | 174 hour_type_ = ash::Shell::GetInstance()->tray_delegate()->GetHourClockType(); |
174 UpdateText(); | 175 UpdateText(); |
175 } | 176 } |
176 | 177 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment); | 226 layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment); |
226 layout->StartRow(0, 0); | 227 layout->StartRow(0, 0); |
227 layout->AddView(label_hour_left_.get()); | 228 layout->AddView(label_hour_left_.get()); |
228 layout->AddView(label_hour_right_.get()); | 229 layout->AddView(label_hour_right_.get()); |
229 layout->StartRow(0, 0); | 230 layout->StartRow(0, 0); |
230 layout->AddView(label_minute_left_.get()); | 231 layout->AddView(label_minute_left_.get()); |
231 layout->AddView(label_minute_right_.get()); | 232 layout->AddView(label_minute_right_.get()); |
232 layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment); | 233 layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment); |
233 } | 234 } |
234 Layout(); | 235 Layout(); |
235 set_focusable(true); | |
236 } | 236 } |
237 | 237 |
238 void TimeView::SetBorder(TrayDate::ClockLayout clock_layout) { | 238 void TimeView::SetBorder(TrayDate::ClockLayout clock_layout) { |
239 if (clock_layout == TrayDate::HORIZONTAL_CLOCK) | 239 if (clock_layout == TrayDate::HORIZONTAL_CLOCK) |
240 set_border(views::Border::CreateEmptyBorder( | 240 set_border(views::Border::CreateEmptyBorder( |
241 0, kTrayLabelItemHorizontalPaddingBottomAlignment, | 241 0, kTrayLabelItemHorizontalPaddingBottomAlignment, |
242 0, kTrayLabelItemHorizontalPaddingBottomAlignment)); | 242 0, kTrayLabelItemHorizontalPaddingBottomAlignment)); |
243 else | 243 else |
244 set_border(NULL); | 244 set_border(NULL); |
245 } | 245 } |
(...skipping 16 matching lines...) Expand all Loading... |
262 void TimeView::SetupLabel(views::Label* label) { | 262 void TimeView::SetupLabel(views::Label* label) { |
263 label->set_owned_by_client(); | 263 label->set_owned_by_client(); |
264 SetupLabelForTray(label); | 264 SetupLabelForTray(label); |
265 gfx::Font font = label->font(); | 265 gfx::Font font = label->font(); |
266 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); | 266 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); |
267 } | 267 } |
268 | 268 |
269 } // namespace tray | 269 } // namespace tray |
270 } // namespace internal | 270 } // namespace internal |
271 } // namespace ash | 271 } // namespace ash |
OLD | NEW |