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" |
11 #include "ash/system/tray/tray_constants.h" | 11 #include "ash/system/tray/tray_constants.h" |
12 #include "ash/system/tray/tray_item_view.h" | 12 #include "ash/system/tray/tray_item_view.h" |
13 #include "ash/system/tray/tray_views.h" | 13 #include "ash/system/tray/tray_views.h" |
14 #include "base/i18n/time_formatting.h" | 14 #include "base/i18n/time_formatting.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "grit/ash_strings.h" |
19 #include "grit/ui_resources.h" | 20 #include "grit/ui_resources.h" |
20 #include "third_party/skia/include/core/SkRect.h" | 21 #include "third_party/skia/include/core/SkRect.h" |
21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
23 #include "ui/gfx/image/image_skia.h" | 24 #include "ui/gfx/image/image_skia.h" |
24 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
25 #include "ui/views/controls/button/button.h" | 26 #include "ui/views/controls/button/button.h" |
26 #include "ui/views/controls/button/text_button.h" | 27 #include "ui/views/controls/button/text_button.h" |
27 #include "ui/views/controls/image_view.h" | 28 #include "ui/views/controls/image_view.h" |
28 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 if (login == ash::user::LOGGED_IN_LOCKED || | 63 if (login == ash::user::LOGGED_IN_LOCKED || |
63 login == ash::user::LOGGED_IN_NONE) | 64 login == ash::user::LOGGED_IN_NONE) |
64 return; | 65 return; |
65 | 66 |
66 date_view->SetActionable(true); | 67 date_view->SetActionable(true); |
67 | 68 |
68 help_ = new ash::internal::TrayPopupHeaderButton(this, | 69 help_ = new ash::internal::TrayPopupHeaderButton(this, |
69 IDR_AURA_UBER_TRAY_HELP, | 70 IDR_AURA_UBER_TRAY_HELP, |
70 IDR_AURA_UBER_TRAY_HELP, | 71 IDR_AURA_UBER_TRAY_HELP, |
71 IDR_AURA_UBER_TRAY_HELP_HOVER, | 72 IDR_AURA_UBER_TRAY_HELP_HOVER, |
72 IDR_AURA_UBER_TRAY_HELP_HOVER); | 73 IDR_AURA_UBER_TRAY_HELP_HOVER, |
| 74 IDS_ASH_STATUS_TRAY_HELP); |
73 view->AddButton(help_); | 75 view->AddButton(help_); |
74 | 76 |
75 if (login != ash::user::LOGGED_IN_LOCKED && | 77 if (login != ash::user::LOGGED_IN_LOCKED && |
76 login != ash::user::LOGGED_IN_KIOSK) { | 78 login != ash::user::LOGGED_IN_KIOSK) { |
77 shutdown_ = new ash::internal::TrayPopupHeaderButton(this, | 79 shutdown_ = new ash::internal::TrayPopupHeaderButton(this, |
78 IDR_AURA_UBER_TRAY_SHUTDOWN, | 80 IDR_AURA_UBER_TRAY_SHUTDOWN, |
79 IDR_AURA_UBER_TRAY_SHUTDOWN, | 81 IDR_AURA_UBER_TRAY_SHUTDOWN, |
80 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, | 82 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, |
81 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER); | 83 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, |
| 84 IDS_ASH_STATUS_TRAY_SHUTDOWN); |
82 view->AddButton(shutdown_); | 85 view->AddButton(shutdown_); |
83 | 86 |
84 if (login != ash::user::LOGGED_IN_GUEST) { | 87 if (login != ash::user::LOGGED_IN_GUEST) { |
85 lock_ = new ash::internal::TrayPopupHeaderButton(this, | 88 lock_ = new ash::internal::TrayPopupHeaderButton(this, |
86 IDR_AURA_UBER_TRAY_LOCKSCREEN, | 89 IDR_AURA_UBER_TRAY_LOCKSCREEN, |
87 IDR_AURA_UBER_TRAY_LOCKSCREEN, | 90 IDR_AURA_UBER_TRAY_LOCKSCREEN, |
88 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, | 91 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, |
89 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER); | 92 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, |
| 93 IDS_ASH_STATUS_TRAY_LOCK); |
90 view->AddButton(lock_); | 94 view->AddButton(lock_); |
91 } | 95 } |
92 } | 96 } |
93 } | 97 } |
94 | 98 |
95 virtual ~DateDefaultView() {} | 99 virtual ~DateDefaultView() {} |
96 | 100 |
97 private: | 101 private: |
98 // Overridden from views::ButtonListener. | 102 // Overridden from views::ButtonListener. |
99 virtual void ButtonPressed(views::Button* sender, | 103 virtual void ButtonPressed(views::Button* sender, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 time_tray_->UpdateTimeFormat(); | 178 time_tray_->UpdateTimeFormat(); |
175 } | 179 } |
176 | 180 |
177 void TrayDate::Refresh() { | 181 void TrayDate::Refresh() { |
178 if (time_tray_) | 182 if (time_tray_) |
179 time_tray_->UpdateText(); | 183 time_tray_->UpdateText(); |
180 } | 184 } |
181 | 185 |
182 } // namespace internal | 186 } // namespace internal |
183 } // namespace ash | 187 } // namespace ash |
OLD | NEW |