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

Unified Diff: chrome/browser/chromeos/input_method/mock_input_method_engine.h

Issue 119133003: Make InputMethodEngine manage its descriptor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/mock_input_method_engine.h
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/chromeos/input_method/mock_input_method_engine.h
similarity index 64%
copy from chrome/browser/chromeos/input_method/input_method_engine.h
copy to chrome/browser/chromeos/input_method/mock_input_method_engine.h
index 77630953991559468808f866dd5a8c865177fd6e..1c4562ee2cfb24d64bf09ef8bc8346d51b3b9e21 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.h
+++ b/chrome/browser/chromeos/input_method/mock_input_method_engine.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
-#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
+#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
+#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
-#include <map>
#include <string>
#include <vector>
#include "chrome/browser/chromeos/input_method/input_method_engine_interface.h"
+#include "chromeos/ime/input_method_descriptor.h"
#include "url/gurl.h"
namespace ui {
@@ -25,23 +25,15 @@ struct InputMethodProperty;
struct KeyEventHandle;
} // namespace input_method
-class InputMethodEngine : public InputMethodEngineInterface {
+class MockInputMethodEngine : public InputMethodEngineInterface {
public:
- InputMethodEngine();
-
- virtual ~InputMethodEngine();
-
- void Initialize(
- InputMethodEngineInterface::Observer* observer,
- const char* engine_name,
- const char* extension_id,
- const char* engine_id,
- const std::vector<std::string>& languages,
- const std::vector<std::string>& layouts,
- const GURL& options_page,
- const GURL& input_view);
+ explicit MockInputMethodEngine(
+ const input_method::InputMethodDescriptor& descriptor);
+ virtual ~MockInputMethodEngine();
// InputMethodEngineInterface overrides.
+ virtual const input_method::InputMethodDescriptor& GetDescriptor()
+ const OVERRIDE;
virtual void StartIme() OVERRIDE;
virtual bool SetComposition(int context_id,
const char* text,
@@ -92,54 +84,13 @@ class InputMethodEngine : public InputMethodEngineInterface {
virtual void HideInputView() OVERRIDE;
private:
- // Converts MenuItem to InputMethodProperty.
- void MenuItemToProperty(const MenuItem& item,
- input_method::InputMethodProperty* property);
-
- // True if the current context has focus.
- bool focused_;
-
- // True if this engine is active.
- bool active_;
-
- // ID that is used for the current input context. False if there is no focus.
- int context_id_;
-
- // Next id that will be assigned to a context.
- int next_context_id_;
-
- // This IME ID in Chrome Extension.
- std::string engine_id_;
-
- // This IME ID in ibus.
- std::string ibus_id_;
-
- // Pointer to the object recieving events for this IME.
- InputMethodEngineInterface::Observer* observer_;
-
- // The current preedit text, and it's cursor position.
- scoped_ptr<IBusText> preedit_text_;
- int preedit_cursor_;
-
- // The current candidate window.
- scoped_ptr<input_method::CandidateWindow> candidate_window_;
+ // Descriptor of this input method.
+ input_method::InputMethodDescriptor descriptor_;
// The current candidate window property.
CandidateWindowProperty candidate_window_property_;
-
- // Indicates whether the candidate window is visible.
- bool window_visible_;
-
- // Mapping of candidate index to candidate id.
- std::vector<int> candidate_ids_;
-
- // Mapping of candidate id to index.
- std::map<int, int> candidate_indexes_;
-
- // Used for input view window.
- GURL input_view_url_;
};
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
+#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_

Powered by Google App Engine
This is Rietveld 408576698