| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input_method/mode_indicator_controller.h" | 5 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" |
| 6 | 6 |
| 7 #include "ash/ime/mode_indicator_view.h" | 7 #include "ash/ime/mode_indicator_view.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 void ModeIndicatorController::ShowModeIndicator() { | 93 void ModeIndicatorController::ShowModeIndicator() { |
| 94 // TODO(komatsu): Show the mode indicator in the right bottom of the | 94 // TODO(komatsu): Show the mode indicator in the right bottom of the |
| 95 // display when the launch bar is hidden and the focus is out. To | 95 // display when the launch bar is hidden and the focus is out. To |
| 96 // implement it, we should consider to use message center or system | 96 // implement it, we should consider to use message center or system |
| 97 // notification. Note, launch bar can be vertical and can be placed | 97 // notification. Note, launch bar can be vertical and can be placed |
| 98 // right/left side of display. | 98 // right/left side of display. |
| 99 if (!is_focused_) | 99 if (!is_focused_) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 // Get the short name of the changed input method (e.g. US, JA, etc.) | 102 // Get the short name of the changed input method (e.g. US, JA, etc.) |
| 103 const InputMethodDescriptor descriptor = imm_->GetCurrentInputMethod(); | 103 const InputMethodDescriptor descriptor = |
| 104 imm_->GetActiveIMEState()->GetCurrentInputMethod(); |
| 104 const base::string16 short_name = | 105 const base::string16 short_name = |
| 105 imm_->GetInputMethodUtil()->GetInputMethodShortName(descriptor); | 106 imm_->GetInputMethodUtil()->GetInputMethodShortName(descriptor); |
| 106 | 107 |
| 107 aura::Window* parent = | 108 aura::Window* parent = |
| 108 ash::Shell::GetContainer(ash::wm::GetActiveWindow()->GetRootWindow(), | 109 ash::Shell::GetContainer(ash::wm::GetActiveWindow()->GetRootWindow(), |
| 109 ash::kShellWindowId_SettingBubbleContainer); | 110 ash::kShellWindowId_SettingBubbleContainer); |
| 110 ash::ime::ModeIndicatorView* mi_view = new ash::ime::ModeIndicatorView( | 111 ash::ime::ModeIndicatorView* mi_view = new ash::ime::ModeIndicatorView( |
| 111 parent, cursor_bounds_, short_name); | 112 parent, cursor_bounds_, short_name); |
| 112 views::BubbleDelegateView::CreateBubble(mi_view); | 113 views::BubbleDelegateView::CreateBubble(mi_view); |
| 113 | 114 |
| 114 views::Widget* mi_widget = mi_view->GetWidget(); | 115 views::Widget* mi_widget = mi_view->GetWidget(); |
| 115 if (GetModeIndicatorObserverForTesting()) | 116 if (GetModeIndicatorObserverForTesting()) |
| 116 GetModeIndicatorObserverForTesting()->AddModeIndicatorWidget(mi_widget); | 117 GetModeIndicatorObserverForTesting()->AddModeIndicatorWidget(mi_widget); |
| 117 | 118 |
| 118 mi_observer_->AddModeIndicatorWidget(mi_widget); | 119 mi_observer_->AddModeIndicatorWidget(mi_widget); |
| 119 mi_view->ShowAndFadeOut(); | 120 mi_view->ShowAndFadeOut(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace input_method | 123 } // namespace input_method |
| 123 } // namespace chromeos | 124 } // namespace chromeos |
| OLD | NEW |