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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 ash::internal::TrayPopupHeaderButton* lock_; | 117 ash::internal::TrayPopupHeaderButton* lock_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(DateDefaultView); | 119 DISALLOW_COPY_AND_ASSIGN(DateDefaultView); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 namespace ash { | 124 namespace ash { |
125 namespace internal { | 125 namespace internal { |
126 | 126 |
127 TrayDate::TrayDate() | 127 TrayDate::TrayDate(SystemTray* system_tray) |
128 : time_tray_(NULL) { | 128 : SystemTrayItem(system_tray), |
| 129 time_tray_(NULL) { |
129 } | 130 } |
130 | 131 |
131 TrayDate::~TrayDate() { | 132 TrayDate::~TrayDate() { |
132 } | 133 } |
133 | 134 |
134 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { | 135 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { |
135 CHECK(time_tray_ == NULL); | 136 CHECK(time_tray_ == NULL); |
136 ClockLayout clock_layout = | 137 ClockLayout clock_layout = |
137 ash::Shell::GetInstance()->system_tray()->shelf_alignment() == | 138 system_tray()->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM ? |
138 SHELF_ALIGNMENT_BOTTOM ? | 139 HORIZONTAL_CLOCK : VERTICAL_CLOCK; |
139 HORIZONTAL_CLOCK : VERTICAL_CLOCK; | |
140 time_tray_ = new tray::TimeView(clock_layout); | 140 time_tray_ = new tray::TimeView(clock_layout); |
141 views::View* view = new TrayItemView; | 141 views::View* view = new TrayItemView(this); |
142 view->AddChildView(time_tray_); | 142 view->AddChildView(time_tray_); |
143 return view; | 143 return view; |
144 } | 144 } |
145 | 145 |
146 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { | 146 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { |
147 return new DateDefaultView(status); | 147 return new DateDefaultView(status); |
148 } | 148 } |
149 | 149 |
150 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { | 150 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { |
151 return NULL; | 151 return NULL; |
(...skipping 25 matching lines...) Expand all Loading... |
177 time_tray_->UpdateTimeFormat(); | 177 time_tray_->UpdateTimeFormat(); |
178 } | 178 } |
179 | 179 |
180 void TrayDate::Refresh() { | 180 void TrayDate::Refresh() { |
181 if (time_tray_) | 181 if (time_tray_) |
182 time_tray_->UpdateText(); | 182 time_tray_->UpdateText(); |
183 } | 183 } |
184 | 184 |
185 } // namespace internal | 185 } // namespace internal |
186 } // namespace ash | 186 } // namespace ash |
OLD | NEW |