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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_ozone.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/chromeos/ime_keyboard_ozone.cc
diff --git a/ui/base/ime/chromeos/ime_keyboard_ozone.cc b/ui/base/ime/chromeos/ime_keyboard_ozone.cc
index 8aa09e08b51131b1873e101a7fc2e68be049f947..c4103951bea87a070816207fe233300b3a550fb8 100644
--- a/ui/base/ime/chromeos/ime_keyboard_ozone.cc
+++ b/ui/base/ime/chromeos/ime_keyboard_ozone.cc
@@ -4,16 +4,38 @@
#include "ui/base/ime/chromeos/ime_keyboard_ozone.h"
+#include "base/command_line.h"
#include "ui/ozone/public/input_controller.h"
#include "ui/ozone/public/ozone_platform.h"
namespace chromeos {
namespace input_method {
-ImeKeyboardOzone::ImeKeyboardOzone(ui::InputController* input_controller)
- : input_controller_(input_controller) {
+namespace {
+
+bool RunningInsideMash() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ "mojo-platform-channel-handle");
+}
+
+std::unique_ptr<ui::InputController> CreateStubInputControllerIfNecessary() {
+ if (RunningInsideMash())
+ return ui::CreateStubInputController();
+ return nullptr;
}
+} // namespace
+
+// TODO(kylechar/moshayedi): Revisit creating the stub InputController after
+// mus+ash IME plan exists.
+ImeKeyboardOzone::ImeKeyboardOzone()
+ : stub_controller_(CreateStubInputControllerIfNecessary()),
+ input_controller_(
+ stub_controller_
+ ? stub_controller_.get()
+ : ui::OzonePlatform::GetInstance()->GetInputController()) {
+ DCHECK(input_controller_);
+}
ImeKeyboardOzone::~ImeKeyboardOzone() {
}
@@ -65,8 +87,7 @@ bool ImeKeyboardOzone::GetAutoRepeatEnabled() {
// static
ImeKeyboard* ImeKeyboard::Create() {
- return new ImeKeyboardOzone(
- ui::OzonePlatform::GetInstance()->GetInputController());
+ 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.
}
} // namespace input_method
« 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