| 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" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 void CapsLockMenuButton::CreateAndShowBubble() { | 310 void CapsLockMenuButton::CreateAndShowBubble() { |
| 311 if (IsBubbleShown()) { | 311 if (IsBubbleShown()) { |
| 312 NOTREACHED(); | 312 NOTREACHED(); |
| 313 return; | 313 return; |
| 314 } | 314 } |
| 315 | 315 |
| 316 gfx::Rect button_bounds = GetScreenBounds(); | 316 gfx::Rect button_bounds = GetScreenBounds(); |
| 317 button_bounds.set_y(button_bounds.y() + 1); // See login/message_bubble.cc. | 317 button_bounds.set_y(button_bounds.y() + 1); // See login/message_bubble.cc. |
| 318 | 318 |
| 319 bubble_ = Bubble::ShowFocusless(GetWidget(), | 319 bubble_ = Bubble::ShowFocusless(GetWidget(), button_bounds, |
| 320 button_bounds, | 320 views::BubbleBorder::TOP_RIGHT, |
| 321 views::BubbleBorder::TOP_RIGHT, | 321 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, |
| 322 new CapsLockMenuButton::StatusView(this), | 322 new CapsLockMenuButton::StatusView(this), |
| 323 NULL /* no delegate */, | 323 NULL /* no delegate */, |
| 324 true /* show_while_screen_is_locked */); | 324 true /* show_while_screen_is_locked */); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void CapsLockMenuButton::HideBubble() { | 327 void CapsLockMenuButton::HideBubble() { |
| 328 if (!IsBubbleShown()) | 328 if (!IsBubbleShown()) |
| 329 return; | 329 return; |
| 330 bubble_timer_.Stop(); // no-op if it's not running. | 330 bubble_timer_.Stop(); // no-op if it's not running. |
| 331 bubble_->Close(); | 331 bubble_->Close(); |
| 332 bubble_ = NULL; | 332 bubble_ = NULL; |
| 333 } | 333 } |
| 334 | 334 |
| 335 bool CapsLockMenuButton::HasCapsLock() const { | 335 bool CapsLockMenuButton::HasCapsLock() const { |
| 336 return (prefs_ && | 336 return (prefs_ && |
| 337 (remap_search_key_to_.GetValue() == input_method::kCapsLockKey)) || | 337 (remap_search_key_to_.GetValue() == input_method::kCapsLockKey)) || |
| 338 // A keyboard for Linux usually has Caps Lock. | 338 // A keyboard for Linux usually has Caps Lock. |
| 339 !system::runtime_environment::IsRunningOnChromeOS(); | 339 !system::runtime_environment::IsRunningOnChromeOS(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace chromeos | 342 } // namespace chromeos |
| OLD | NEW |