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_resources.h" | 19 #include "grit/ash_resources.h" |
20 #include "grit/ash_strings.h" | 20 #include "grit/ash_strings.h" |
21 #include "third_party/skia/include/core/SkRect.h" | 21 #include "third_party/skia/include/core/SkRect.h" |
| 22 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
23 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
24 #include "ui/gfx/image/image_skia.h" | 25 #include "ui/gfx/image/image_skia.h" |
25 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
26 #include "ui/views/controls/button/button.h" | 27 #include "ui/views/controls/button/button.h" |
27 #include "ui/views/controls/button/text_button.h" | 28 #include "ui/views/controls/button/text_button.h" |
28 #include "ui/views/controls/image_view.h" | 29 #include "ui/views/controls/image_view.h" |
29 #include "ui/views/controls/label.h" | 30 #include "ui/views/controls/label.h" |
30 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
31 #include "ui/views/layout/fill_layout.h" | 32 #include "ui/views/layout/fill_layout.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, |
73 IDS_ASH_STATUS_TRAY_HELP); | 74 IDS_ASH_STATUS_TRAY_HELP); |
| 75 help_->SetTooltipText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); |
74 view->AddButton(help_); | 76 view->AddButton(help_); |
75 | 77 |
76 if (login != ash::user::LOGGED_IN_LOCKED && | 78 if (login != ash::user::LOGGED_IN_LOCKED && |
77 login != ash::user::LOGGED_IN_KIOSK) { | 79 login != ash::user::LOGGED_IN_KIOSK) { |
78 shutdown_ = new ash::internal::TrayPopupHeaderButton(this, | 80 shutdown_ = new ash::internal::TrayPopupHeaderButton(this, |
79 IDR_AURA_UBER_TRAY_SHUTDOWN, | 81 IDR_AURA_UBER_TRAY_SHUTDOWN, |
80 IDR_AURA_UBER_TRAY_SHUTDOWN, | 82 IDR_AURA_UBER_TRAY_SHUTDOWN, |
81 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, | 83 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, |
82 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, | 84 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, |
83 IDS_ASH_STATUS_TRAY_SHUTDOWN); | 85 IDS_ASH_STATUS_TRAY_SHUTDOWN); |
| 86 shutdown_->SetTooltipText( |
| 87 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
84 view->AddButton(shutdown_); | 88 view->AddButton(shutdown_); |
85 } | 89 } |
86 | 90 |
87 if (ash::Shell::GetInstance()->CanLockScreen()) { | 91 if (ash::Shell::GetInstance()->CanLockScreen()) { |
88 lock_ = new ash::internal::TrayPopupHeaderButton(this, | 92 lock_ = new ash::internal::TrayPopupHeaderButton(this, |
89 IDR_AURA_UBER_TRAY_LOCKSCREEN, | 93 IDR_AURA_UBER_TRAY_LOCKSCREEN, |
90 IDR_AURA_UBER_TRAY_LOCKSCREEN, | 94 IDR_AURA_UBER_TRAY_LOCKSCREEN, |
91 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, | 95 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, |
92 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, | 96 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, |
93 IDS_ASH_STATUS_TRAY_LOCK); | 97 IDS_ASH_STATUS_TRAY_LOCK); |
| 98 lock_->SetTooltipText( |
| 99 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_LOCK)); |
94 view->AddButton(lock_); | 100 view->AddButton(lock_); |
95 } | 101 } |
96 } | 102 } |
97 | 103 |
98 virtual ~DateDefaultView() {} | 104 virtual ~DateDefaultView() {} |
99 | 105 |
100 private: | 106 private: |
101 // Overridden from views::ButtonListener. | 107 // Overridden from views::ButtonListener. |
102 virtual void ButtonPressed(views::Button* sender, | 108 virtual void ButtonPressed(views::Button* sender, |
103 const ui::Event& event) OVERRIDE { | 109 const ui::Event& event) OVERRIDE { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 time_tray_->UpdateTimeFormat(); | 183 time_tray_->UpdateTimeFormat(); |
178 } | 184 } |
179 | 185 |
180 void TrayDate::Refresh() { | 186 void TrayDate::Refresh() { |
181 if (time_tray_) | 187 if (time_tray_) |
182 time_tray_->UpdateText(); | 188 time_tray_->UpdateText(); |
183 } | 189 } |
184 | 190 |
185 } // namespace internal | 191 } // namespace internal |
186 } // namespace ash | 192 } // namespace ash |
OLD | NEW |