| 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 "chrome/browser/chromeos/input_method/candidate_window_controller_impl.
h" | 5 #include "chrome/browser/chromeos/input_method/candidate_window_controller_impl.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ime/infolist_window.h" | |
| 11 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 12 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 13 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
| 14 #include "base/logging.h" | 13 #include "base/logging.h" |
| 15 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" | 14 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" |
| 15 #include "ui/chromeos/ime/infolist_window.h" |
| 16 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 namespace input_method { | 20 namespace input_method { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 candidate_window_view_->GetWidget()->RemoveObserver(this); | 39 candidate_window_view_->GetWidget()->RemoveObserver(this); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void CandidateWindowControllerImpl::InitCandidateWindowView() { | 43 void CandidateWindowControllerImpl::InitCandidateWindowView() { |
| 44 if (candidate_window_view_) | 44 if (candidate_window_view_) |
| 45 return; | 45 return; |
| 46 | 46 |
| 47 aura::Window* active_window = ash::wm::GetActiveWindow(); | 47 aura::Window* active_window = ash::wm::GetActiveWindow(); |
| 48 candidate_window_view_ = | 48 candidate_window_view_ = |
| 49 new ash::ime::CandidateWindowView(ash::Shell::GetContainer( | 49 new ui::ime::CandidateWindowView(ash::Shell::GetContainer( |
| 50 active_window ? active_window->GetRootWindow() | 50 active_window ? active_window->GetRootWindow() |
| 51 : ash::Shell::GetTargetRootWindow(), | 51 : ash::Shell::GetTargetRootWindow(), |
| 52 ash::kShellWindowId_SettingBubbleContainer)); | 52 ash::kShellWindowId_SettingBubbleContainer)); |
| 53 candidate_window_view_->AddObserver(this); | 53 candidate_window_view_->AddObserver(this); |
| 54 candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_); | 54 candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_); |
| 55 views::Widget* widget = candidate_window_view_->InitWidget(); | 55 views::Widget* widget = candidate_window_view_->InitWidget(); |
| 56 widget->AddObserver(this); | 56 widget->AddObserver(this); |
| 57 widget->Show(); | 57 widget->Show(); |
| 58 FOR_EACH_OBSERVER(CandidateWindowController::Observer, observers_, | 58 FOR_EACH_OBSERVER(CandidateWindowController::Observer, observers_, |
| 59 CandidateWindowOpened()); | 59 CandidateWindowOpened()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Highlight moves out of the infolist entries. | 136 // Highlight moves out of the infolist entries. |
| 137 if (!has_highlighted) { | 137 if (!has_highlighted) { |
| 138 if (infolist_window_) | 138 if (infolist_window_) |
| 139 infolist_window_->HideWithDelay(); | 139 infolist_window_->HideWithDelay(); |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 | 142 |
| 143 if (infolist_window_) { | 143 if (infolist_window_) { |
| 144 infolist_window_->Relayout(infolist_entries); | 144 infolist_window_->Relayout(infolist_entries); |
| 145 } else { | 145 } else { |
| 146 infolist_window_ = new ash::ime::InfolistWindow( | 146 infolist_window_ = new ui::ime::InfolistWindow( |
| 147 candidate_window_view_, infolist_entries); | 147 candidate_window_view_, infolist_entries); |
| 148 infolist_window_->InitWidget(); | 148 infolist_window_->InitWidget(); |
| 149 infolist_window_->GetWidget()->AddObserver(this); | 149 infolist_window_->GetWidget()->AddObserver(this); |
| 150 } | 150 } |
| 151 infolist_window_->ShowWithDelay(); | 151 infolist_window_->ShowWithDelay(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void CandidateWindowControllerImpl::UpdatePreeditText( | 154 void CandidateWindowControllerImpl::UpdatePreeditText( |
| 155 const base::string16& text, unsigned int cursor, bool visible) { | 155 const base::string16& text, unsigned int cursor, bool visible) { |
| 156 // If it's not visible, hide the preedit text and return. | 156 // If it's not visible, hide the preedit text and return. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 observers_.AddObserver(observer); | 189 observers_.AddObserver(observer); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void CandidateWindowControllerImpl::RemoveObserver( | 192 void CandidateWindowControllerImpl::RemoveObserver( |
| 193 CandidateWindowController::Observer* observer) { | 193 CandidateWindowController::Observer* observer) { |
| 194 observers_.RemoveObserver(observer); | 194 observers_.RemoveObserver(observer); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace input_method | 197 } // namespace input_method |
| 198 } // namespace chromeos | 198 } // namespace chromeos |
| OLD | NEW |