OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/status/caps_lock_menu_button.h" | 5 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 10 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 11 #include "chrome/browser/chromeos/login/screen_locker.h" |
11 #include "chrome/browser/chromeos/status/status_area_bubble.h" | 12 #include "chrome/browser/chromeos/status/status_area_bubble.h" |
12 #include "chrome/browser/chromeos/system/runtime_environment.h" | 13 #include "chrome/browser/chromeos/system/runtime_environment.h" |
13 #include "chrome/browser/chromeos/view_ids.h" | 14 #include "chrome/browser/chromeos/view_ids.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return bubble_controller_.get() && bubble_controller_->IsBubbleShown(); | 197 return bubble_controller_.get() && bubble_controller_->IsBubbleShown(); |
197 } | 198 } |
198 | 199 |
199 void CapsLockMenuButton::MaybeShowBubble() { | 200 void CapsLockMenuButton::MaybeShowBubble() { |
200 if (IsBubbleShown() || | 201 if (IsBubbleShown() || |
201 // We've already shown the bubble |kMaxBubbleCount| times. | 202 // We've already shown the bubble |kMaxBubbleCount| times. |
202 !should_show_bubble_ || | 203 !should_show_bubble_ || |
203 // Don't show the bubble when Caps Lock key is available. | 204 // Don't show the bubble when Caps Lock key is available. |
204 HasCapsLock() || | 205 HasCapsLock() || |
205 // Don't show it when the status area is hidden. | 206 // Don't show it when the status area is hidden. |
206 (parent() && !parent()->visible())) | 207 (parent() && !parent()->visible()) || |
| 208 // Don't show the bubble when screen is locked as this results in two |
| 209 // visible caps lock bubbles (crbug.com/105280). The greater problem of |
| 210 // displaying bubbles from all caps lock menu buttons regardless of |
| 211 // visibility is described in crbug.com/106776. |
| 212 ScreenLocker::default_screen_locker()) |
207 return; | 213 return; |
208 | 214 |
209 ++bubble_count_; | 215 ++bubble_count_; |
210 if (bubble_count_ > kMaxBubbleCount) { | 216 if (bubble_count_ > kMaxBubbleCount) { |
211 should_show_bubble_ = false; | 217 should_show_bubble_ = false; |
212 } else { | 218 } else { |
213 CreateAndShowBubble(); | 219 CreateAndShowBubble(); |
214 } | 220 } |
215 } | 221 } |
216 | 222 |
(...skipping 14 matching lines...) Expand all Loading... |
231 } | 237 } |
232 | 238 |
233 bool CapsLockMenuButton::HasCapsLock() const { | 239 bool CapsLockMenuButton::HasCapsLock() const { |
234 return (prefs_ && | 240 return (prefs_ && |
235 (remap_search_key_to_.GetValue() == input_method::kCapsLockKey)) || | 241 (remap_search_key_to_.GetValue() == input_method::kCapsLockKey)) || |
236 // A keyboard for Linux usually has Caps Lock. | 242 // A keyboard for Linux usually has Caps Lock. |
237 !system::runtime_environment::IsRunningOnChromeOS(); | 243 !system::runtime_environment::IsRunningOnChromeOS(); |
238 } | 244 } |
239 | 245 |
240 } // namespace chromeos | 246 } // namespace chromeos |
OLD | NEW |