| 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 "ash/system/tray/tray_utils.h" | 10 #include "ash/system/tray/tray_utils.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()-> | 131 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()-> |
| 132 GetHourClockType()), | 132 GetHourClockType()), |
| 133 actionable_(false) { | 133 actionable_(false) { |
| 134 SetLayoutManager( | 134 SetLayoutManager( |
| 135 new views::BoxLayout( | 135 new views::BoxLayout( |
| 136 views::BoxLayout::kVertical, 0, 0, 0)); | 136 views::BoxLayout::kVertical, 0, 0, 0)); |
| 137 date_label_ = CreateLabel(); | 137 date_label_ = CreateLabel(); |
| 138 date_label_->SetEnabledColor(kHeaderTextColorNormal); | 138 date_label_->SetEnabledColor(kHeaderTextColorNormal); |
| 139 UpdateTextInternal(base::Time::Now()); | 139 UpdateTextInternal(base::Time::Now()); |
| 140 AddChildView(date_label_); | 140 AddChildView(date_label_); |
| 141 set_focusable(actionable_); | 141 SetFocusable(actionable_); |
| 142 } | 142 } |
| 143 | 143 |
| 144 DateView::~DateView() { | 144 DateView::~DateView() { |
| 145 } | 145 } |
| 146 | 146 |
| 147 void DateView::SetActionable(bool actionable) { | 147 void DateView::SetActionable(bool actionable) { |
| 148 actionable_ = actionable; | 148 actionable_ = actionable; |
| 149 set_focusable(actionable_); | 149 SetFocusable(actionable_); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void DateView::UpdateTimeFormat() { | 152 void DateView::UpdateTimeFormat() { |
| 153 hour_type_ = | 153 hour_type_ = |
| 154 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); | 154 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); |
| 155 UpdateText(); | 155 UpdateText(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void DateView::UpdateTextInternal(const base::Time& now) { | 158 void DateView::UpdateTextInternal(const base::Time& now) { |
| 159 SetAccessibleName( | 159 SetAccessibleName( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 /////////////////////////////////////////////////////////////////////////////// | 191 /////////////////////////////////////////////////////////////////////////////// |
| 192 | 192 |
| 193 TimeView::TimeView(TrayDate::ClockLayout clock_layout) | 193 TimeView::TimeView(TrayDate::ClockLayout clock_layout) |
| 194 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()-> | 194 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()-> |
| 195 GetHourClockType()) { | 195 GetHourClockType()) { |
| 196 SetupLabels(); | 196 SetupLabels(); |
| 197 UpdateTextInternal(base::Time::Now()); | 197 UpdateTextInternal(base::Time::Now()); |
| 198 UpdateClockLayout(clock_layout); | 198 UpdateClockLayout(clock_layout); |
| 199 set_focusable(false); | 199 SetFocusable(false); |
| 200 } | 200 } |
| 201 | 201 |
| 202 TimeView::~TimeView() { | 202 TimeView::~TimeView() { |
| 203 } | 203 } |
| 204 | 204 |
| 205 void TimeView::UpdateTimeFormat() { | 205 void TimeView::UpdateTimeFormat() { |
| 206 hour_type_ = | 206 hour_type_ = |
| 207 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); | 207 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); |
| 208 UpdateText(); | 208 UpdateText(); |
| 209 } | 209 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 void TimeView::SetupLabel(views::Label* label) { | 300 void TimeView::SetupLabel(views::Label* label) { |
| 301 label->set_owned_by_client(); | 301 label->set_owned_by_client(); |
| 302 SetupLabelForTray(label); | 302 SetupLabelForTray(label); |
| 303 gfx::Font font = label->font(); | 303 gfx::Font font = label->font(); |
| 304 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); | 304 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace tray | 307 } // namespace tray |
| 308 } // namespace internal | 308 } // namespace internal |
| 309 } // namespace ash | 309 } // namespace ash |
| OLD | NEW |