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

Side by Side Diff: ui/base/ime/chromeos/ime_keyboard_ozone.cc

Issue 1908583002: Use FakeImeKeyboard when running in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO. Created 4 years, 8 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 | « ui/base/ime/chromeos/ime_keyboard_ozone.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/base/ime/chromeos/ime_keyboard_ozone.h" 5 #include "ui/base/ime/chromeos/ime_keyboard_ozone.h"
6 6
7 #include "base/command_line.h"
7 #include "ui/ozone/public/input_controller.h" 8 #include "ui/ozone/public/input_controller.h"
8 #include "ui/ozone/public/ozone_platform.h" 9 #include "ui/ozone/public/ozone_platform.h"
9 10
10 namespace chromeos { 11 namespace chromeos {
11 namespace input_method { 12 namespace input_method {
12 13
13 ImeKeyboardOzone::ImeKeyboardOzone(ui::InputController* input_controller) 14 namespace {
14 : input_controller_(input_controller) { 15
16 bool RunningInsideMash() {
17 return base::CommandLine::ForCurrentProcess()->HasSwitch(
18 "mojo-platform-channel-handle");
15 } 19 }
16 20
21 std::unique_ptr<ui::InputController> CreateStubInputControllerIfNecessary() {
22 if (RunningInsideMash())
23 return ui::CreateStubInputController();
24 return nullptr;
25 }
26
27 } // namespace
28
29 // TODO(kylechar/moshayedi): Revisit creating the stub InputController after
30 // mus+ash IME plan exists.
31 ImeKeyboardOzone::ImeKeyboardOzone()
32 : stub_controller_(CreateStubInputControllerIfNecessary()),
33 input_controller_(
34 stub_controller_
35 ? stub_controller_.get()
36 : ui::OzonePlatform::GetInstance()->GetInputController()) {
37 DCHECK(input_controller_);
38 }
17 39
18 ImeKeyboardOzone::~ImeKeyboardOzone() { 40 ImeKeyboardOzone::~ImeKeyboardOzone() {
19 } 41 }
20 42
21 bool ImeKeyboardOzone::SetCurrentKeyboardLayoutByName( 43 bool ImeKeyboardOzone::SetCurrentKeyboardLayoutByName(
22 const std::string& layout_name) { 44 const std::string& layout_name) {
23 last_layout_ = layout_name; 45 last_layout_ = layout_name;
24 input_controller_->SetCurrentLayoutByName(layout_name); 46 input_controller_->SetCurrentLayoutByName(layout_name);
25 return true; 47 return true;
26 } 48 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 input_controller_->SetAutoRepeatEnabled(enabled); 80 input_controller_->SetAutoRepeatEnabled(enabled);
59 return true; 81 return true;
60 } 82 }
61 83
62 bool ImeKeyboardOzone::GetAutoRepeatEnabled() { 84 bool ImeKeyboardOzone::GetAutoRepeatEnabled() {
63 return input_controller_->IsAutoRepeatEnabled(); 85 return input_controller_->IsAutoRepeatEnabled();
64 } 86 }
65 87
66 // static 88 // static
67 ImeKeyboard* ImeKeyboard::Create() { 89 ImeKeyboard* ImeKeyboard::Create() {
68 return new ImeKeyboardOzone( 90 return new ImeKeyboardOzone();
sadrul 2016/04/20 17:51:19 Can we change the code that creates this? InputMet
kylechar 2016/04/20 18:16:27 Yeah, that makes way more sense.
69 ui::OzonePlatform::GetInstance()->GetInputController());
70 } 91 }
71 92
72 } // namespace input_method 93 } // namespace input_method
73 } // namespace chromeos 94 } // namespace chromeos
OLDNEW
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_ozone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698