Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc

Issue 2651733002: IME for Mus: Avoid crash in InitWindowCandidateView(). (Closed)
Patch Set: Added TODO. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // TODO(moshayedi): crbug.com/637416. Setting parent is nullptr in mash is
sadrul 2017/01/24 15:59:10 Can you actually file a new bug specifically for m
48 candidate_window_view_ = 49 // just for the sake of not crashing. It doesn't provide the same behaviour
49 new ui::ime::CandidateWindowView(ash::Shell::GetContainer( 50 // as we have in ChromeOS. For example, candidate pop-up disappears when
50 active_window ? active_window->GetRootWindow() 51 // dragging the window in mash, but it shouldn't. We should find a better
51 : ash::Shell::GetTargetRootWindow(), 52 // solution.
52 ash::kShellWindowId_SettingBubbleContainer)); 53 gfx::NativeView parent = nullptr;
54 if (!chrome::IsRunningInMash()) {
55 aura::Window* active_window = ash::wm::GetActiveWindow();
56 parent = ash::Shell::GetContainer(
57 active_window ? active_window->GetRootWindow()
58 : ash::Shell::GetTargetRootWindow(),
59 ash::kShellWindowId_SettingBubbleContainer);
60 }
61 candidate_window_view_ = new ui::ime::CandidateWindowView(parent);
53 candidate_window_view_->AddObserver(this); 62 candidate_window_view_->AddObserver(this);
54 candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_); 63 candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_);
55 views::Widget* widget = candidate_window_view_->InitWidget(); 64 views::Widget* widget = candidate_window_view_->InitWidget();
56 widget->AddObserver(this); 65 widget->AddObserver(this);
57 widget->Show(); 66 widget->Show();
58 for (auto& observer : observers_) 67 for (auto& observer : observers_)
59 observer.CandidateWindowOpened(); 68 observer.CandidateWindowOpened();
60 } 69 }
61 70
62 void CandidateWindowControllerImpl::Hide() { 71 void CandidateWindowControllerImpl::Hide() {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 observers_.AddObserver(observer); 200 observers_.AddObserver(observer);
192 } 201 }
193 202
194 void CandidateWindowControllerImpl::RemoveObserver( 203 void CandidateWindowControllerImpl::RemoveObserver(
195 CandidateWindowController::Observer* observer) { 204 CandidateWindowController::Observer* observer) {
196 observers_.RemoveObserver(observer); 205 observers_.RemoveObserver(observer);
197 } 206 }
198 207
199 } // namespace input_method 208 } // namespace input_method
200 } // namespace chromeos 209 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698