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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.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 17 matching lines...) Expand all Loading... |
28 shortcut_label_(new views::Label) { | 28 shortcut_label_(new views::Label) { |
29 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 29 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
30 kTrayPopupPaddingHorizontal, | 30 kTrayPopupPaddingHorizontal, |
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 ToSkBitmap()); | 38 ToImageSkia()); |
39 AddChildView(image); | 39 AddChildView(image); |
40 | 40 |
41 text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 41 text_label_->SetHorizontalAlignment(views::Label::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() {} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 DCHECK(detailed_ == NULL); | 124 DCHECK(detailed_ == NULL); |
125 detailed_ = new views::View; | 125 detailed_ = new views::View; |
126 | 126 |
127 detailed_->SetLayoutManager(new | 127 detailed_->SetLayoutManager(new |
128 views::BoxLayout(views::BoxLayout::kHorizontal, | 128 views::BoxLayout(views::BoxLayout::kHorizontal, |
129 kTrayPopupPaddingHorizontal, 10, kTrayPopupPaddingBetweenItems)); | 129 kTrayPopupPaddingHorizontal, 10, kTrayPopupPaddingBetweenItems)); |
130 | 130 |
131 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 131 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
132 views::ImageView* image = new views::ImageView; | 132 views::ImageView* image = new views::ImageView; |
133 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). | 133 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). |
134 ToSkBitmap()); | 134 ToImageSkia()); |
135 | 135 |
136 detailed_->AddChildView(image); | 136 detailed_->AddChildView(image); |
137 | 137 |
138 const int string_id = search_mapped_to_caps_lock_ ? | 138 const int string_id = search_mapped_to_caps_lock_ ? |
139 IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED_PRESS_SEARCH : | 139 IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED_PRESS_SEARCH : |
140 IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED_PRESS_SHIFT_AND_SEARCH_KEYS; | 140 IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED_PRESS_SHIFT_AND_SEARCH_KEYS; |
141 detailed_->AddChildView( | 141 detailed_->AddChildView( |
142 new views::Label(bundle.GetLocalizedString(string_id))); | 142 new views::Label(bundle.GetLocalizedString(string_id))); |
143 | 143 |
144 return detailed_; | 144 return detailed_; |
(...skipping 20 matching lines...) Expand all Loading... |
165 } else { | 165 } else { |
166 if (enabled) | 166 if (enabled) |
167 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); | 167 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); |
168 else if (detailed_) | 168 else if (detailed_) |
169 detailed_->GetWidget()->Close(); | 169 detailed_->GetWidget()->Close(); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 } // namespace internal | 173 } // namespace internal |
174 } // namespace ash | 174 } // namespace ash |
OLD | NEW |