Chromium Code Reviews| 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/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" | 14 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" |
| 15 #include "chrome/browser/ui/ash/ash_util.h" | |
| 15 #include "ui/base/ime/ime_bridge.h" | 16 #include "ui/base/ime/ime_bridge.h" |
| 16 #include "ui/chromeos/ime/infolist_window.h" | 17 #include "ui/chromeos/ime/infolist_window.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 namespace input_method { | 21 namespace input_method { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 } // namespace | 25 } // namespace |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 37 if (candidate_window_view_) { | 38 if (candidate_window_view_) { |
| 38 candidate_window_view_->RemoveObserver(this); | 39 candidate_window_view_->RemoveObserver(this); |
| 39 candidate_window_view_->GetWidget()->RemoveObserver(this); | 40 candidate_window_view_->GetWidget()->RemoveObserver(this); |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 43 void CandidateWindowControllerImpl::InitCandidateWindowView() { | 44 void CandidateWindowControllerImpl::InitCandidateWindowView() { |
| 44 if (candidate_window_view_) | 45 if (candidate_window_view_) |
| 45 return; | 46 return; |
| 46 | 47 |
| 47 aura::Window* active_window = ash::wm::GetActiveWindow(); | 48 gfx::NativeView parent = nullptr; |
| 48 candidate_window_view_ = | 49 if (!chrome::IsRunningInMash()) { |
| 49 new ui::ime::CandidateWindowView(ash::Shell::GetContainer( | 50 aura::Window* active_window = ash::wm::GetActiveWindow(); |
| 50 active_window ? active_window->GetRootWindow() | 51 parent = ash::Shell::GetContainer( |
| 51 : ash::Shell::GetTargetRootWindow(), | 52 active_window ? active_window->GetRootWindow() |
| 52 ash::kShellWindowId_SettingBubbleContainer)); | 53 : ash::Shell::GetTargetRootWindow(), |
| 54 ash::kShellWindowId_SettingBubbleContainer); | |
| 55 } | |
| 56 candidate_window_view_ = new ui::ime::CandidateWindowView(parent); | |
|
sadrul
2017/01/23 18:20:11
Can you comment on how this candidate window will
Hadi
2017/01/23 21:11:34
Setting parent as null doesn't provide the same be
| |
| 53 candidate_window_view_->AddObserver(this); | 57 candidate_window_view_->AddObserver(this); |
| 54 candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_); | 58 candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_); |
| 55 views::Widget* widget = candidate_window_view_->InitWidget(); | 59 views::Widget* widget = candidate_window_view_->InitWidget(); |
| 56 widget->AddObserver(this); | 60 widget->AddObserver(this); |
| 57 widget->Show(); | 61 widget->Show(); |
| 58 for (auto& observer : observers_) | 62 for (auto& observer : observers_) |
| 59 observer.CandidateWindowOpened(); | 63 observer.CandidateWindowOpened(); |
| 60 } | 64 } |
| 61 | 65 |
| 62 void CandidateWindowControllerImpl::Hide() { | 66 void CandidateWindowControllerImpl::Hide() { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 observers_.AddObserver(observer); | 195 observers_.AddObserver(observer); |
| 192 } | 196 } |
| 193 | 197 |
| 194 void CandidateWindowControllerImpl::RemoveObserver( | 198 void CandidateWindowControllerImpl::RemoveObserver( |
| 195 CandidateWindowController::Observer* observer) { | 199 CandidateWindowController::Observer* observer) { |
| 196 observers_.RemoveObserver(observer); | 200 observers_.RemoveObserver(observer); |
| 197 } | 201 } |
| 198 | 202 |
| 199 } // namespace input_method | 203 } // namespace input_method |
| 200 } // namespace chromeos | 204 } // namespace chromeos |
| OLD | NEW |