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/tray_caps_lock.h" | 5 #include "ash/system/tray_caps_lock.h" |
6 | 6 |
7 #include "ash/caps_lock_delegate.h" | 7 #include "ash/caps_lock_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "ash/system/tray/tray_views.h" | 10 #include "ash/system/tray/tray_views.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 0, | 31 0, |
32 kTrayPopupPaddingBetweenItems)); | 32 kTrayPopupPaddingBetweenItems)); |
33 | 33 |
34 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 34 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
35 FixedSizedImageView* image = | 35 FixedSizedImageView* image = |
36 new FixedSizedImageView(0, kTrayPopupItemHeight); | 36 new FixedSizedImageView(0, kTrayPopupItemHeight); |
37 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). | 37 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). |
38 ToImageSkia()); | 38 ToImageSkia()); |
39 AddChildView(image); | 39 AddChildView(image); |
40 | 40 |
41 text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 41 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
42 AddChildView(text_label_); | 42 AddChildView(text_label_); |
43 | 43 |
44 shortcut_label_->SetEnabled(false); | 44 shortcut_label_->SetEnabled(false); |
45 AddChildView(shortcut_label_); | 45 AddChildView(shortcut_label_); |
46 } | 46 } |
47 | 47 |
48 virtual ~CapsLockDefaultView() {} | 48 virtual ~CapsLockDefaultView() {} |
49 | 49 |
50 // Updates the label text and the shortcut text. | 50 // Updates the label text and the shortcut text. |
51 void Update(bool caps_lock_enabled, bool search_mapped_to_caps_lock) { | 51 void Update(bool caps_lock_enabled, bool search_mapped_to_caps_lock) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). | 140 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). |
141 ToImageSkia()); | 141 ToImageSkia()); |
142 | 142 |
143 detailed_->AddChildView(image); | 143 detailed_->AddChildView(image); |
144 | 144 |
145 const int string_id = search_mapped_to_caps_lock_ ? | 145 const int string_id = search_mapped_to_caps_lock_ ? |
146 IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_SEARCH : | 146 IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_SEARCH : |
147 IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_ALT_SEARCH; | 147 IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_ALT_SEARCH; |
148 views::Label* label = new views::Label(bundle.GetLocalizedString(string_id)); | 148 views::Label* label = new views::Label(bundle.GetLocalizedString(string_id)); |
149 label->SetMultiLine(true); | 149 label->SetMultiLine(true); |
150 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 150 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
151 detailed_->AddChildView(label); | 151 detailed_->AddChildView(label); |
152 | 152 |
153 return detailed_; | 153 return detailed_; |
154 } | 154 } |
155 | 155 |
156 void TrayCapsLock::DestroyDefaultView() { | 156 void TrayCapsLock::DestroyDefaultView() { |
157 default_ = NULL; | 157 default_ = NULL; |
158 } | 158 } |
159 | 159 |
160 void TrayCapsLock::DestroyDetailedView() { | 160 void TrayCapsLock::DestroyDetailedView() { |
(...skipping 17 matching lines...) Expand all Loading... |
178 message_shown_ = true; | 178 message_shown_ = true; |
179 } | 179 } |
180 } else if (detailed_) { | 180 } else if (detailed_) { |
181 detailed_->GetWidget()->Close(); | 181 detailed_->GetWidget()->Close(); |
182 } | 182 } |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 } // namespace internal | 186 } // namespace internal |
187 } // namespace ash | 187 } // namespace ash |
OLD | NEW |