| 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/chromeos/tray_caps_lock.h" | 5 #include "ash/system/chromeos/tray_caps_lock.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/tray/actionable_view.h" | 9 #include "ash/system/tray/actionable_view.h" |
| 10 #include "ash/system/tray/fixed_sized_image_view.h" | 10 #include "ash/system/tray/fixed_sized_image_view.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } else if (detailed_) { | 166 } else if (detailed_) { |
| 167 detailed_->GetWidget()->Close(); | 167 detailed_->GetWidget()->Close(); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool TrayCapsLock::GetInitialVisibility() { | 172 bool TrayCapsLock::GetInitialVisibility() { |
| 173 return CapsLockIsEnabled(); | 173 return CapsLockIsEnabled(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 views::View* TrayCapsLock::CreateDefaultView(user::LoginStatus status) { | 176 views::View* TrayCapsLock::CreateDefaultView(LoginStatus status) { |
| 177 if (!caps_lock_enabled_) | 177 if (!caps_lock_enabled_) |
| 178 return NULL; | 178 return NULL; |
| 179 DCHECK(default_ == NULL); | 179 DCHECK(default_ == NULL); |
| 180 default_ = new CapsLockDefaultView; | 180 default_ = new CapsLockDefaultView; |
| 181 default_->Update(caps_lock_enabled_); | 181 default_->Update(caps_lock_enabled_); |
| 182 return default_; | 182 return default_; |
| 183 } | 183 } |
| 184 | 184 |
| 185 views::View* TrayCapsLock::CreateDetailedView(user::LoginStatus status) { | 185 views::View* TrayCapsLock::CreateDetailedView(LoginStatus status) { |
| 186 DCHECK(detailed_ == NULL); | 186 DCHECK(detailed_ == NULL); |
| 187 detailed_ = new views::View; | 187 detailed_ = new views::View; |
| 188 | 188 |
| 189 detailed_->SetLayoutManager(new | 189 detailed_->SetLayoutManager(new |
| 190 views::BoxLayout(views::BoxLayout::kHorizontal, | 190 views::BoxLayout(views::BoxLayout::kHorizontal, |
| 191 kTrayPopupPaddingHorizontal, 10, kTrayPopupPaddingBetweenItems)); | 191 kTrayPopupPaddingHorizontal, 10, kTrayPopupPaddingBetweenItems)); |
| 192 | 192 |
| 193 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 193 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 194 views::ImageView* image = new views::ImageView; | 194 views::ImageView* image = new views::ImageView; |
| 195 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). | 195 image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). |
| (...skipping 17 matching lines...) Expand all Loading... |
| 213 | 213 |
| 214 void TrayCapsLock::DestroyDefaultView() { | 214 void TrayCapsLock::DestroyDefaultView() { |
| 215 default_ = NULL; | 215 default_ = NULL; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void TrayCapsLock::DestroyDetailedView() { | 218 void TrayCapsLock::DestroyDetailedView() { |
| 219 detailed_ = NULL; | 219 detailed_ = NULL; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace ash | 222 } // namespace ash |
| OLD | NEW |