summaryrefslogtreecommitdiffstats
path: root/chromeos/ime
diff options
context:
space:
mode:
authornona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-25 12:02:01 +0000
committernona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-25 12:02:01 +0000
commitb911e9ee8fd513606422d920348f932c26aa288d (patch)
tree5beaf9ec149ae7a1a7b19b943acacd915c278bd0 /chromeos/ime
parentce764fc7806b476e753f3643a4f8b9f316c71fd8 (diff)
downloadchromium_src-b911e9ee8fd513606422d920348f932c26aa288d.zip
chromium_src-b911e9ee8fd513606422d920348f932c26aa288d.tar.gz
chromium_src-b911e9ee8fd513606422d920348f932c26aa288d.tar.bz2
Extract input_method_delegate.h from c/b/chromeos
This is part of extraction work for input method from chrome/browser/chromeos. BUG=164375 TEST=None TBR=sky Review URL: https://chromiumcodereview.appspot.com/12780014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/ime')
-rw-r--r--chromeos/ime/input_method_delegate.h34
-rw-r--r--chromeos/ime/mock_input_method_delegate.cc26
-rw-r--r--chromeos/ime/mock_input_method_delegate.h42
3 files changed, 102 insertions, 0 deletions
diff --git a/chromeos/ime/input_method_delegate.h b/chromeos/ime/input_method_delegate.h
new file mode 100644
index 0000000..e242f3b
--- /dev/null
+++ b/chromeos/ime/input_method_delegate.h
@@ -0,0 +1,34 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_IME_INPUT_METHOD_DELEGATE_H_
+#define CHROMEOS_IME_INPUT_METHOD_DELEGATE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+
+namespace chromeos {
+namespace input_method {
+
+// Provides access to read/persist Input Method-related properties.
+class InputMethodDelegate {
+ public:
+ InputMethodDelegate() {}
+ virtual ~InputMethodDelegate() {}
+
+ // Retrieves the hardware keyboard layout ID. May return an empty string if
+ // the ID is unknown.
+ virtual std::string GetHardwareKeyboardLayout() const = 0;
+ // Retrieves the currently active UI locale.
+ virtual std::string GetActiveLocale() const = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InputMethodDelegate);
+};
+
+} // namespace input_method
+} // namespace chromeos
+
+#endif // CHROMEOS_IME_INPUT_METHOD_DELEGATE_H_
diff --git a/chromeos/ime/mock_input_method_delegate.cc b/chromeos/ime/mock_input_method_delegate.cc
new file mode 100644
index 0000000..0f68132
--- /dev/null
+++ b/chromeos/ime/mock_input_method_delegate.cc
@@ -0,0 +1,26 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/ime/mock_input_method_delegate.h"
+
+namespace chromeos {
+namespace input_method {
+
+MockInputMethodDelegate::MockInputMethodDelegate()
+ : active_locale_("en") {
+}
+
+MockInputMethodDelegate::~MockInputMethodDelegate() {
+}
+
+std::string MockInputMethodDelegate::GetHardwareKeyboardLayout() const {
+ return hardware_keyboard_layout_;
+}
+
+std::string MockInputMethodDelegate::GetActiveLocale() const {
+ return active_locale_;
+}
+
+} // namespace input_method
+} // namespace chromeos
diff --git a/chromeos/ime/mock_input_method_delegate.h b/chromeos/ime/mock_input_method_delegate.h
new file mode 100644
index 0000000..f7f2be9
--- /dev/null
+++ b/chromeos/ime/mock_input_method_delegate.h
@@ -0,0 +1,42 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_IME_MOCK_INPUT_METHOD_DELEGATE_H_
+#define CHROMEOS_IME_MOCK_INPUT_METHOD_DELEGATE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/ime/input_method_delegate.h"
+
+namespace chromeos {
+namespace input_method {
+
+class CHROMEOS_EXPORT MockInputMethodDelegate : public InputMethodDelegate {
+ public:
+ MockInputMethodDelegate();
+ virtual ~MockInputMethodDelegate();
+
+ // InputMethodDelegate implementation:
+ virtual std::string GetHardwareKeyboardLayout() const OVERRIDE;
+ virtual std::string GetActiveLocale() const OVERRIDE;
+
+ void set_hardware_keyboard_layout(const std::string& value) {
+ hardware_keyboard_layout_ = value;
+ }
+
+ void set_active_locale(const std::string& value) {
+ active_locale_ = value;
+ }
+
+ private:
+ std::string hardware_keyboard_layout_;
+ std::string active_locale_;
+ DISALLOW_COPY_AND_ASSIGN(MockInputMethodDelegate);
+};
+
+} // namespace input_method
+} // namespace chromeos
+
+#endif // CHROMEOS_IME_MOCK_INPUT_METHOD_DELEGATE_H_