OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ime_menu/ime_menu_tray.h" | 5 #include "ash/system/ime_menu/ime_menu_tray.h" |
6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" |
7 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
8 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
9 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
10 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
11 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #include "ash/shell_port.h" | 14 #include "ash/shell_port.h" |
14 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
15 #include "ash/system/ime_menu/ime_list_view.h" | 16 #include "ash/system/ime_menu/ime_list_view.h" |
16 #include "ash/system/tray/system_menu_button.h" | 17 #include "ash/system/tray/system_menu_button.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 SetupLabelForTray(label_); | 291 SetupLabelForTray(label_); |
291 label_->SetElideBehavior(gfx::TRUNCATE); | 292 label_->SetElideBehavior(gfx::TRUNCATE); |
292 tray_container()->AddChildView(label_); | 293 tray_container()->AddChildView(label_); |
293 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); | 294 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); |
294 tray_notifier->AddIMEObserver(this); | 295 tray_notifier->AddIMEObserver(this); |
295 tray_notifier->AddVirtualKeyboardObserver(this); | 296 tray_notifier->AddVirtualKeyboardObserver(this); |
296 } | 297 } |
297 | 298 |
298 ImeMenuTray::~ImeMenuTray() { | 299 ImeMenuTray::~ImeMenuTray() { |
299 if (bubble_) | 300 if (bubble_) |
300 bubble_->bubble_view()->reset_delegate(); | 301 bubble_->bubble_view()->ResetDelegate(); |
301 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); | 302 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); |
302 tray_notifier->RemoveIMEObserver(this); | 303 tray_notifier->RemoveIMEObserver(this); |
303 tray_notifier->RemoveVirtualKeyboardObserver(this); | 304 tray_notifier->RemoveVirtualKeyboardObserver(this); |
304 keyboard::KeyboardController* keyboard_controller = | 305 keyboard::KeyboardController* keyboard_controller = |
305 keyboard::KeyboardController::GetInstance(); | 306 keyboard::KeyboardController::GetInstance(); |
306 if (keyboard_controller) | 307 if (keyboard_controller) |
307 keyboard_controller->RemoveObserver(this); | 308 keyboard_controller->RemoveObserver(this); |
308 } | 309 } |
309 | 310 |
310 void ImeMenuTray::ShowImeMenuBubble() { | 311 void ImeMenuTray::ShowImeMenuBubble() { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 HideImeMenuBubble(); | 463 HideImeMenuBubble(); |
463 } | 464 } |
464 | 465 |
465 void ImeMenuTray::BubbleViewDestroyed() { | 466 void ImeMenuTray::BubbleViewDestroyed() { |
466 } | 467 } |
467 | 468 |
468 void ImeMenuTray::OnMouseEnteredView() {} | 469 void ImeMenuTray::OnMouseEnteredView() {} |
469 | 470 |
470 void ImeMenuTray::OnMouseExitedView() {} | 471 void ImeMenuTray::OnMouseExitedView() {} |
471 | 472 |
| 473 void ImeMenuTray::RegisterAccelerators( |
| 474 const std::vector<ui::Accelerator>& accelerators, |
| 475 views::TrayBubbleView* tray_bubble_view) { |
| 476 Shell::Get()->accelerator_controller()->Register(accelerators, |
| 477 tray_bubble_view); |
| 478 } |
| 479 |
| 480 void ImeMenuTray::UnregisterAllAccelerators( |
| 481 views::TrayBubbleView* tray_bubble_view) { |
| 482 Shell::Get()->accelerator_controller()->UnregisterAll(tray_bubble_view); |
| 483 } |
| 484 |
472 base::string16 ImeMenuTray::GetAccessibleNameForBubble() { | 485 base::string16 ImeMenuTray::GetAccessibleNameForBubble() { |
473 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME); | 486 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME); |
474 } | 487 } |
475 | 488 |
| 489 bool ImeMenuTray::ShouldEnableExtraKeyboardAccessibility() { |
| 490 return Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); |
| 491 } |
| 492 |
476 void ImeMenuTray::HideBubble(const views::TrayBubbleView* bubble_view) { | 493 void ImeMenuTray::HideBubble(const views::TrayBubbleView* bubble_view) { |
477 HideBubbleWithView(bubble_view); | 494 HideBubbleWithView(bubble_view); |
478 } | 495 } |
479 | 496 |
480 void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {} | 497 void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {} |
481 | 498 |
482 void ImeMenuTray::OnKeyboardClosed() { | 499 void ImeMenuTray::OnKeyboardClosed() { |
483 if (InputMethodManager::Get()) | 500 if (InputMethodManager::Get()) |
484 InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string()); | 501 InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string()); |
485 keyboard::KeyboardController* keyboard_controller = | 502 keyboard::KeyboardController* keyboard_controller = |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 else | 560 else |
544 label_->SetText(current_ime_.short_name); | 561 label_->SetText(current_ime_.short_name); |
545 } | 562 } |
546 | 563 |
547 void ImeMenuTray::DisableVirtualKeyboard() { | 564 void ImeMenuTray::DisableVirtualKeyboard() { |
548 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); | 565 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); |
549 force_show_keyboard_ = false; | 566 force_show_keyboard_ = false; |
550 } | 567 } |
551 | 568 |
552 } // namespace ash | 569 } // namespace ash |
OLD | NEW |