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

Side by Side Diff: ash/shell/keyboard_controller_proxy_stub.cc

Issue 1155013005: Refactoring the ownership of ui::InputMethod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 6 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
OLDNEW
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 "ash/shell/keyboard_controller_proxy_stub.h" 5 #include "ash/shell/keyboard_controller_proxy_stub.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/wm/window_util.h"
9 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/aura/window_tree_host.h"
10 #include "ui/base/ime/mock_input_method.h" 12 #include "ui/base/ime/mock_input_method.h"
11 #include "ui/wm/core/input_method_event_filter.h"
12 13
13 using namespace content; 14 using namespace content;
14 15
15 namespace ash { 16 namespace ash {
16 17
17 KeyboardControllerProxyStub::KeyboardControllerProxyStub() 18 KeyboardControllerProxyStub::KeyboardControllerProxyStub()
18 : keyboard::KeyboardControllerProxy(Shell::GetInstance() 19 : keyboard::KeyboardControllerProxy(Shell::GetInstance()
19 ->delegate() 20 ->delegate()
20 ->GetActiveBrowserContext()) { 21 ->GetActiveBrowserContext()) {
21 } 22 }
22 23
23 KeyboardControllerProxyStub::~KeyboardControllerProxyStub() { 24 KeyboardControllerProxyStub::~KeyboardControllerProxyStub() {
24 } 25 }
25 26
26 bool KeyboardControllerProxyStub::HasKeyboardWindow() const { 27 bool KeyboardControllerProxyStub::HasKeyboardWindow() const {
27 return keyboard_; 28 return keyboard_;
28 } 29 }
29 30
30 aura::Window* KeyboardControllerProxyStub::GetKeyboardWindow() { 31 aura::Window* KeyboardControllerProxyStub::GetKeyboardWindow() {
31 if (!keyboard_) { 32 if (!keyboard_) {
32 keyboard_.reset(new aura::Window(&delegate_)); 33 keyboard_.reset(new aura::Window(&delegate_));
33 keyboard_->Init(ui::LAYER_NOT_DRAWN); 34 keyboard_->Init(ui::LAYER_NOT_DRAWN);
34 } 35 }
35 return keyboard_.get(); 36 return keyboard_.get();
36 } 37 }
37 38
38 ui::InputMethod* KeyboardControllerProxyStub::GetInputMethod() { 39 ui::InputMethod* KeyboardControllerProxyStub::GetInputMethod() {
39 return Shell::GetInstance()->input_method_filter()->input_method(); 40 aura::Window* root_window = wm::GetActiveWindow();
41 if (root_window)
42 root_window = root_window->GetRootWindow();
43 if (!root_window)
44 root_window = Shell::GetTargetRootWindow();
James Cook 2015/06/03 16:34:27 same nit, GetPrimaryRootWindow()?
Shu Chen 2015/06/04 01:59:44 Done.
45 return root_window->GetHost()->GetInputMethod();
40 } 46 }
41 47
42 void KeyboardControllerProxyStub::RequestAudioInput( 48 void KeyboardControllerProxyStub::RequestAudioInput(
43 WebContents* web_contents, 49 WebContents* web_contents,
44 const MediaStreamRequest& request, 50 const MediaStreamRequest& request,
45 const MediaResponseCallback& callback) { 51 const MediaResponseCallback& callback) {
46 } 52 }
47 53
48 void KeyboardControllerProxyStub::LoadSystemKeyboard() { 54 void KeyboardControllerProxyStub::LoadSystemKeyboard() {
49 } 55 }
50 56
51 void KeyboardControllerProxyStub::ReloadKeyboardIfNeeded() { 57 void KeyboardControllerProxyStub::ReloadKeyboardIfNeeded() {
52 } 58 }
53 59
54 } // namespace ash 60 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698