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