Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(857)

Side by Side Diff: ash/common/system/chromeos/tray_caps_lock.cc

Issue 2761063002: Move more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/system/chromeos/tray_caps_lock.h" 5 #include "ash/common/system/chromeos/tray_caps_lock.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/system/tray/actionable_view.h" 8 #include "ash/common/system/tray/actionable_view.h"
9 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // Updates the label text and the shortcut text. 84 // Updates the label text and the shortcut text.
85 void Update(bool caps_lock_enabled) { 85 void Update(bool caps_lock_enabled) {
86 const int text_string_id = caps_lock_enabled 86 const int text_string_id = caps_lock_enabled
87 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED 87 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED
88 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_DISABLED; 88 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_DISABLED;
89 text_label_->SetText(l10n_util::GetStringUTF16(text_string_id)); 89 text_label_->SetText(l10n_util::GetStringUTF16(text_string_id));
90 90
91 int shortcut_string_id = 0; 91 int shortcut_string_id = 0;
92 bool search_mapped_to_caps_lock = 92 bool search_mapped_to_caps_lock =
93 WmShell::Get()->system_tray_delegate()->IsSearchKeyMappedToCapsLock(); 93 Shell::Get()->system_tray_delegate()->IsSearchKeyMappedToCapsLock();
94 if (caps_lock_enabled) { 94 if (caps_lock_enabled) {
95 shortcut_string_id = 95 shortcut_string_id =
96 search_mapped_to_caps_lock 96 search_mapped_to_caps_lock
97 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_SEARCH_OR_SHIFT 97 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_SEARCH_OR_SHIFT
98 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_ALT_SEARCH_OR_SHIFT; 98 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_ALT_SEARCH_OR_SHIFT;
99 } else { 99 } else {
100 shortcut_string_id = 100 shortcut_string_id =
101 search_mapped_to_caps_lock 101 search_mapped_to_caps_lock
102 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_SEARCH 102 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_SEARCH
103 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_ALT_SEARCH; 103 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_SHORTCUT_ALT_SEARCH;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 views::BoxLayout::kHorizontal, kTrayPopupPaddingHorizontal, 10, 202 views::BoxLayout::kHorizontal, kTrayPopupPaddingHorizontal, 10,
203 kTrayPopupPaddingBetweenItems)); 203 kTrayPopupPaddingBetweenItems));
204 204
205 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 205 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
206 views::ImageView* image = new views::ImageView; 206 views::ImageView* image = new views::ImageView;
207 image->SetImage( 207 image->SetImage(
208 CreateVectorIcon(kSystemMenuCapsLockIcon, kMenuIconSize, kMenuIconColor)); 208 CreateVectorIcon(kSystemMenuCapsLockIcon, kMenuIconSize, kMenuIconColor));
209 detailed_->AddChildView(image); 209 detailed_->AddChildView(image);
210 210
211 const int string_id = 211 const int string_id =
212 WmShell::Get()->system_tray_delegate()->IsSearchKeyMappedToCapsLock() 212 Shell::Get()->system_tray_delegate()->IsSearchKeyMappedToCapsLock()
213 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_SEARCH 213 ? IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_SEARCH
214 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_ALT_SEARCH; 214 : IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_ALT_SEARCH;
215 views::Label* label = TrayPopupUtils::CreateDefaultLabel(); 215 views::Label* label = TrayPopupUtils::CreateDefaultLabel();
216 label->SetText(bundle.GetLocalizedString(string_id)); 216 label->SetText(bundle.GetLocalizedString(string_id));
217 label->SetMultiLine(true); 217 label->SetMultiLine(true);
218 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 218 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
219 detailed_->AddChildView(label); 219 detailed_->AddChildView(label);
220 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_CAPS_LOCK_DETAILED); 220 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_CAPS_LOCK_DETAILED);
221 221
222 return detailed_; 222 return detailed_;
223 } 223 }
224 224
225 void TrayCapsLock::DestroyDefaultView() { 225 void TrayCapsLock::DestroyDefaultView() {
226 default_ = nullptr; 226 default_ = nullptr;
227 } 227 }
228 228
229 void TrayCapsLock::DestroyDetailedView() { 229 void TrayCapsLock::DestroyDetailedView() {
230 detailed_ = nullptr; 230 detailed_ = nullptr;
231 } 231 }
232 232
233 } // namespace ash 233 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/supervised/tray_supervised_user.cc ('k') | ash/common/system/chromeos/tray_tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698