summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/extensions/input_method_event_router.h2
-rw-r--r--chrome/browser/chromeos/input_method/accessibility.cc4
-rw-r--r--chrome/browser/chromeos/input_method/accessibility.h2
-rw-r--r--chrome/browser/chromeos/input_method/input_method_engine.cc18
-rw-r--r--chrome/browser/chromeos/input_method/input_method_engine.h11
-rw-r--r--chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc7
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager_impl.cc51
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager_impl.h12
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc95
-rw-r--r--chrome/browser/chromeos/input_method/input_method_persistence.cc3
-rw-r--r--chrome/browser/chromeos/input_method/input_method_persistence.h1
-rw-r--r--chrome/browser/chromeos/input_method/mock_input_method_engine.h7
-rw-r--r--chrome/browser/chromeos/input_method/mock_input_method_manager.cc11
-rw-r--r--chrome/browser/chromeos/input_method/mock_input_method_manager.h6
-rw-r--r--chrome/browser/chromeos/input_method/mode_indicator_controller.cc5
-rw-r--r--chrome/browser/chromeos/input_method/mode_indicator_controller.h1
16 files changed, 136 insertions, 100 deletions
diff --git a/chrome/browser/chromeos/extensions/input_method_event_router.h b/chrome/browser/chromeos/extensions/input_method_event_router.h
index 91bfb34..b7f0169 100644
--- a/chrome/browser/chromeos/extensions/input_method_event_router.h
+++ b/chrome/browser/chromeos/extensions/input_method_event_router.h
@@ -28,6 +28,8 @@ class ExtensionInputMethodEventRouter
virtual void InputMethodChanged(
input_method::InputMethodManager* manager,
bool show_message) OVERRIDE;
+ virtual void InputMethodPropertyChanged(
+ input_method::InputMethodManager* manager) OVERRIDE {}
private:
content::BrowserContext* context_;
diff --git a/chrome/browser/chromeos/input_method/accessibility.cc b/chrome/browser/chromeos/input_method/accessibility.cc
index f830d57..5047d12 100644
--- a/chrome/browser/chromeos/input_method/accessibility.cc
+++ b/chrome/browser/chromeos/input_method/accessibility.cc
@@ -54,5 +54,9 @@ void Accessibility::InputMethodChanged(InputMethodManager* imm,
ui::AccessibilityTypes::EVENT_ALERT, &event);
}
+void Accessibility::InputMethodPropertyChanged(InputMethodManager* imm) {
+ // Do nothing.
+}
+
} // namespace input_method
} // namespace chromeos
diff --git a/chrome/browser/chromeos/input_method/accessibility.h b/chrome/browser/chromeos/input_method/accessibility.h
index 60fb084..ed04ae0 100644
--- a/chrome/browser/chromeos/input_method/accessibility.h
+++ b/chrome/browser/chromeos/input_method/accessibility.h
@@ -21,6 +21,8 @@ class Accessibility
// InputMethodManager::Observer implementation.
virtual void InputMethodChanged(InputMethodManager* imm,
bool show_message) OVERRIDE;
+ virtual void InputMethodPropertyChanged(InputMethodManager* imm) OVERRIDE;
+
InputMethodManager* imm_;
DISALLOW_COPY_AND_ASSIGN(Accessibility);
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc
index e2d0c2c..0de0541 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.cc
+++ b/chrome/browser/chromeos/input_method/input_method_engine.cc
@@ -14,8 +14,6 @@
#undef RootWindow
#include <map>
-#include "ash/ime/input_method_menu_item.h"
-#include "ash/ime/input_method_menu_manager.h"
#include "ash/shell.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -373,16 +371,19 @@ bool InputMethodEngine::UpdateMenuItems(
if (!active_)
return false;
- ash::ime::InputMethodMenuItemList menu_item_list;
+ input_method::InputMethodPropertyList property_list;
for (std::vector<MenuItem>::const_iterator item = items.begin();
item != items.end(); ++item) {
- ash::ime::InputMethodMenuItem property;
+ input_method::InputMethodProperty property;
MenuItemToProperty(*item, &property);
- menu_item_list.push_back(property);
+ property_list.push_back(property);
}
- ash::ime::InputMethodMenuManager::Get()->SetCurrentInputMethodMenuItemList(
- menu_item_list);
+ input_method::InputMethodManager* manager =
+ input_method::InputMethodManager::Get();
+ if (manager)
+ manager->SetCurrentInputMethodProperties(property_list);
+
return true;
}
@@ -582,10 +583,9 @@ void InputMethodEngine::SetSurroundingText(const std::string& text,
static_cast<int>(anchor_pos));
}
-// TODO(uekawa): rename this method to a more reasonable name.
void InputMethodEngine::MenuItemToProperty(
const MenuItem& item,
- ash::ime::InputMethodMenuItem* property) {
+ input_method::InputMethodProperty* property) {
property->key = item.id;
if (item.modified & MENU_ITEM_MODIFIED_LABEL) {
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/chromeos/input_method/input_method_engine.h
index 64dd8e2..ce817d38 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.h
+++ b/chrome/browser/chromeos/input_method/input_method_engine.h
@@ -17,17 +17,12 @@ class CandidateWindow;
class KeyEvent;
} // namespace ui
-namespace ash {
-namespace ime {
-struct InputMethodMenuItem;
-} // namespace ime
-} // namespace ash
-
namespace chromeos {
class CompositionText;
namespace input_method {
+struct InputMethodProperty;
struct KeyEventHandle;
} // namespace input_method
@@ -100,9 +95,9 @@ class InputMethodEngine : public InputMethodEngineInterface {
virtual void HideInputView() OVERRIDE;
private:
- // Converts MenuItem to InputMethodMenuItem.
+ // Converts MenuItem to InputMethodProperty.
void MenuItemToProperty(const MenuItem& item,
- ash::ime::InputMethodMenuItem* property);
+ input_method::InputMethodProperty* property);
// Descriptor of this input method.
input_method::InputMethodDescriptor descriptor_;
diff --git a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc
index d3912f9..62d2a68 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc
+++ b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/ime/input_method_menu_item.h"
-#include "ash/ime/input_method_menu_manager.h"
#include "base/bind_helpers.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -797,9 +795,8 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineIBusBrowserTest,
ASSERT_TRUE(content::ExecuteScript(
host->host_contents(), set_menu_item_test_script));
- const ash::ime::InputMethodMenuItemList& props =
- ash::ime::InputMethodMenuManager::Get()->
- GetCurrentInputMethodMenuItemList();
+ const InputMethodPropertyList& props =
+ InputMethodManager::Get()->GetCurrentInputMethodProperties();
ASSERT_EQ(5U, props.size());
EXPECT_EQ("ID0", props[0].key);
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
index 1d2f339..719aecc 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -6,8 +6,6 @@
#include <algorithm> // std::find
-#include "ash/ime/input_method_menu_item.h"
-#include "ash/ime/input_method_menu_manager.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/location.h"
@@ -57,13 +55,11 @@ InputMethodManagerImpl::InputMethodManagerImpl(
util_(delegate_.get(), GetSupportedInputMethods()),
component_extension_ime_manager_(new ComponentExtensionIMEManager()),
weak_ptr_factory_(this) {
- ash::ime::InputMethodMenuManager::Initialize();
}
InputMethodManagerImpl::~InputMethodManagerImpl() {
if (candidate_window_controller_.get())
candidate_window_controller_->RemoveObserver(this);
- ash::ime::InputMethodMenuManager::Shutdown();
}
void InputMethodManagerImpl::AddObserver(
@@ -354,11 +350,8 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal(
// extension IMEs via InputMethodEngine::(Set|Update)MenuItems.
// If the current input method is a keyboard layout, empty
// properties are sufficient.
- const ash::ime::InputMethodMenuItemList empty_menu_item_list;
- ash::ime::InputMethodMenuManager* input_method_menu_manager =
- ash::ime::InputMethodMenuManager::Get();
- input_method_menu_manager->SetCurrentInputMethodMenuItemList(
- empty_menu_item_list);
+ const InputMethodPropertyList empty_property_list;
+ SetCurrentInputMethodProperties(empty_property_list);
const InputMethodDescriptor* descriptor = NULL;
if (extension_ime_util::IsExtensionIME(input_method_id_to_switch)) {
@@ -426,20 +419,21 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() {
}
}
-void InputMethodManagerImpl::ActivateInputMethodMenuItem(
+void InputMethodManagerImpl::ActivateInputMethodProperty(
const std::string& key) {
DCHECK(!key.empty());
- if (ash::ime::InputMethodMenuManager::Get()->
- HasInputMethodMenuItemForKey(key)) {
- IMEEngineHandlerInterface* engine =
- IMEBridge::Get()->GetCurrentEngineHandler();
- if (engine)
- engine->PropertyActivate(key);
- return;
+ for (size_t i = 0; i < property_list_.size(); ++i) {
+ if (property_list_[i].key == key) {
+ IMEEngineHandlerInterface* engine =
+ IMEBridge::Get()->GetCurrentEngineHandler();
+ if (engine)
+ engine->PropertyActivate(key);
+ return;
+ }
}
- DVLOG(1) << "ActivateInputMethodMenuItem: unknown key: " << key;
+ DVLOG(1) << "ActivateInputMethodProperty: unknown key: " << key;
}
void InputMethodManagerImpl::AddInputMethodExtension(
@@ -693,6 +687,21 @@ InputMethodDescriptor InputMethodManagerImpl::GetCurrentInputMethod() const {
return current_input_method_;
}
+InputMethodPropertyList
+InputMethodManagerImpl::GetCurrentInputMethodProperties() const {
+ // This check is necessary since an IME property (e.g. for Pinyin) might be
+ // sent from ibus-daemon AFTER the current input method is switched to XKB.
+ if (InputMethodUtil::IsKeyboardLayout(GetCurrentInputMethod().id()))
+ return InputMethodPropertyList(); // Empty list.
+ return property_list_;
+}
+
+void InputMethodManagerImpl::SetCurrentInputMethodProperties(
+ const InputMethodPropertyList& property_list) {
+ property_list_ = property_list;
+ PropertyChanged();
+}
+
XKeyboard* InputMethodManagerImpl::GetXKeyboard() {
return xkeyboard_.get();
}
@@ -748,6 +757,12 @@ void InputMethodManagerImpl::InitializeComponentExtensionForTesting(
OnComponentExtensionInitialized(delegate.Pass());
}
+void InputMethodManagerImpl::PropertyChanged() {
+ FOR_EACH_OBSERVER(InputMethodManager::Observer,
+ observers_,
+ InputMethodPropertyChanged(this));
+}
+
void InputMethodManagerImpl::CandidateClicked(int index) {
IMEEngineHandlerInterface* engine =
IMEBridge::Get()->GetCurrentEngineHandler();
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.h b/chrome/browser/chromeos/input_method/input_method_manager_impl.h
index 5716704..f24152e 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h
@@ -66,7 +66,7 @@ class InputMethodManagerImpl : public InputMethodManager,
virtual bool EnableInputMethod(const std::string& new_active_input_method_id)
OVERRIDE;
virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE;
- virtual void ActivateInputMethodMenuItem(const std::string& key) OVERRIDE;
+ virtual void ActivateInputMethodProperty(const std::string& key) OVERRIDE;
virtual void AddInputMethodExtension(
const std::string& id,
InputMethodEngineInterface* instance) OVERRIDE;
@@ -80,6 +80,10 @@ class InputMethodManagerImpl : public InputMethodManager,
const ui::Accelerator& accelerator) OVERRIDE;
virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE;
virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE;
+ virtual InputMethodPropertyList
+ GetCurrentInputMethodProperties() const OVERRIDE;
+ virtual void SetCurrentInputMethodProperties(
+ const InputMethodPropertyList& property_list) OVERRIDE;
virtual XKeyboard* GetXKeyboard() OVERRIDE;
virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE;
@@ -97,6 +101,9 @@ class InputMethodManagerImpl : public InputMethodManager,
scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate);
private:
+ // Notifies observers that the property list is updated.
+ void PropertyChanged();
+
// CandidateWindowController::Observer overrides:
virtual void CandidateClicked(int index) OVERRIDE;
virtual void CandidateWindowOpened() OVERRIDE;
@@ -182,6 +189,9 @@ class InputMethodManagerImpl : public InputMethodManager,
// those created by extension.
std::map<std::string, InputMethodDescriptor> extra_input_methods_;
+ // Property list of the input method. This is set by extension IMEs.
+ InputMethodPropertyList property_list_;
+
// The candidate window. This will be deleted when the APP_TERMINATING
// message is sent.
scoped_ptr<CandidateWindowController> candidate_window_controller_;
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
index 7ae647b..18428df 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
@@ -6,8 +6,6 @@
#include <algorithm>
-#include "ash/ime/input_method_menu_item.h"
-#include "ash/ime/input_method_menu_manager.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -73,8 +71,6 @@ class InputMethodManagerImplTest : public testing::Test {
IMEBridge::Initialize();
IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get());
- menu_manager_ = ash::ime::InputMethodMenuManager::Get();
-
ime_list_.clear();
ComponentExtensionIME ext1;
@@ -125,7 +121,6 @@ class InputMethodManagerImplTest : public testing::Test {
candidate_window_controller_ = NULL;
xkeyboard_ = NULL;
manager_.reset();
-
IMEBridge::Get()->SetCurrentEngineHandler(NULL);
IMEBridge::Shutdown();
}
@@ -158,18 +153,16 @@ class InputMethodManagerImplTest : public testing::Test {
base::MessageLoop message_loop_;
MockComponentExtIMEManagerDelegate* mock_delegate_;
std::vector<ComponentExtensionIME> ime_list_;
- ash::ime::InputMethodMenuManager* menu_manager_;
private:
DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest);
};
-class TestObserver : public InputMethodManager::Observer,
- public ash::ime::InputMethodMenuManager::Observer{
+class TestObserver : public InputMethodManager::Observer {
public:
TestObserver()
: input_method_changed_count_(0),
- input_method_menu_item_changed_count_(0),
+ input_method_property_changed_count_(0),
last_show_message_(false) {
}
virtual ~TestObserver() {}
@@ -179,13 +172,13 @@ class TestObserver : public InputMethodManager::Observer,
++input_method_changed_count_;
last_show_message_ = show_message;
}
- virtual void InputMethodMenuItemChanged(
- ash::ime::InputMethodMenuManager* manager) OVERRIDE {
- ++input_method_menu_item_changed_count_;
+ virtual void InputMethodPropertyChanged(
+ InputMethodManager* manager) OVERRIDE {
+ ++input_method_property_changed_count_;
}
int input_method_changed_count_;
- int input_method_menu_item_changed_count_;
+ int input_method_property_changed_count_;
bool last_show_message_;
private:
@@ -243,15 +236,14 @@ TEST_F(InputMethodManagerImplTest, TestObserver) {
TestObserver observer;
InitComponentExtension();
manager_->AddObserver(&observer);
- menu_manager_->AddObserver(&observer);
EXPECT_EQ(0, observer.input_method_changed_count_);
manager_->EnableLoginLayouts("en-US", "xkb:us::eng");
EXPECT_EQ(1, observer.input_method_changed_count_);
- EXPECT_EQ(1, observer.input_method_menu_item_changed_count_);
+ EXPECT_EQ(1, observer.input_method_property_changed_count_);
manager_->ChangeInputMethod("xkb:us:dvorak:eng");
EXPECT_FALSE(observer.last_show_message_);
EXPECT_EQ(2, observer.input_method_changed_count_);
- EXPECT_EQ(2, observer.input_method_menu_item_changed_count_);
+ EXPECT_EQ(2, observer.input_method_property_changed_count_);
manager_->ChangeInputMethod("xkb:us:dvorak:eng");
EXPECT_FALSE(observer.last_show_message_);
@@ -262,7 +254,7 @@ TEST_F(InputMethodManagerImplTest, TestObserver) {
// If the same input method ID is passed, PropertyChanged() is not
// notified.
- EXPECT_EQ(2, observer.input_method_menu_item_changed_count_);
+ EXPECT_EQ(2, observer.input_method_property_changed_count_);
manager_->RemoveObserver(&observer);
}
@@ -601,24 +593,23 @@ TEST_F(InputMethodManagerImplTest, TestXkbSetting) {
EXPECT_EQ("us(colemak)", xkeyboard_->last_layout_);
}
-TEST_F(InputMethodManagerImplTest, TestActivateInputMethodMenuItem) {
+TEST_F(InputMethodManagerImplTest, TestActivateInputMethodProperty) {
const std::string kKey = "key";
- ash::ime::InputMethodMenuItemList menu_list;
- menu_list.push_back(ash::ime::InputMethodMenuItem(
- kKey, "label", false, false));
- menu_manager_->SetCurrentInputMethodMenuItemList(menu_list);
+ InputMethodPropertyList property_list;
+ property_list.push_back(InputMethodProperty(kKey, "label", false, false));
+ manager_->SetCurrentInputMethodProperties(property_list);
- manager_->ActivateInputMethodMenuItem(kKey);
+ manager_->ActivateInputMethodProperty(kKey);
EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property());
// Key2 is not registered, so activated property should not be changed.
- manager_->ActivateInputMethodMenuItem("key2");
+ manager_->ActivateInputMethodProperty("key2");
EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property());
}
TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) {
InitComponentExtension();
- EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty());
+ EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty());
manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN);
std::vector<std::string> ids;
@@ -626,25 +617,26 @@ TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) {
ids.push_back(kNaclMozcUsId);
EXPECT_TRUE(manager_->EnableInputMethods(ids));
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods());
- EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty());
+ EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty());
manager_->ChangeInputMethod(kNaclMozcUsId);
- ash::ime::InputMethodMenuItemList current_property_list;
- current_property_list.push_back(ash::ime::InputMethodMenuItem(
- "key", "label", false, false));
- menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list);
+ InputMethodPropertyList current_property_list;
+ current_property_list.push_back(InputMethodProperty("key",
+ "label",
+ false,
+ false));
+ manager_->SetCurrentInputMethodProperties(current_property_list);
- ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size());
- EXPECT_EQ("key",
- menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key);
+ ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size());
+ EXPECT_EQ("key", manager_->GetCurrentInputMethodProperties().at(0).key);
manager_->ChangeInputMethod("xkb:us::eng");
- EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty());
+ EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty());
}
TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) {
InitComponentExtension();
- EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty());
+ EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty());
manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN);
std::vector<std::string> ids;
@@ -652,31 +644,32 @@ TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) {
ids.push_back(kExt2Engine1Id); // T-Chinese
EXPECT_TRUE(manager_->EnableInputMethods(ids));
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods());
- EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty());
+ EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty());
- ash::ime::InputMethodMenuItemList current_property_list;
- current_property_list.push_back(ash::ime::InputMethodMenuItem("key-mozc",
- "label",
- false,
- false));
- menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list);
+ InputMethodPropertyList current_property_list;
+ current_property_list.push_back(InputMethodProperty("key-mozc",
+ "label",
+ false,
+ false));
+ manager_->SetCurrentInputMethodProperties(current_property_list);
- ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size());
- EXPECT_EQ("key-mozc",
- menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key);
+ ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size());
+ EXPECT_EQ("key-mozc", manager_->GetCurrentInputMethodProperties().at(0).key);
manager_->ChangeInputMethod(kExt2Engine1Id);
// Since the IME is changed, the property for mozc Japanese should be hidden.
- EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty());
+ EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty());
// Asynchronous property update signal from mozc-chewing.
current_property_list.clear();
- current_property_list.push_back(ash::ime::InputMethodMenuItem(
- "key-chewing", "label", false, false));
- menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list);
- ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size());
+ current_property_list.push_back(InputMethodProperty("key-chewing",
+ "label",
+ false,
+ false));
+ manager_->SetCurrentInputMethodProperties(current_property_list);
+ ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size());
EXPECT_EQ("key-chewing",
- menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key);
+ manager_->GetCurrentInputMethodProperties().at(0).key);
}
TEST_F(InputMethodManagerImplTest, TestNextInputMethod) {
diff --git a/chrome/browser/chromeos/input_method/input_method_persistence.cc b/chrome/browser/chromeos/input_method/input_method_persistence.cc
index 0ebcaf3..b33e256 100644
--- a/chrome/browser/chromeos/input_method/input_method_persistence.cc
+++ b/chrome/browser/chromeos/input_method/input_method_persistence.cc
@@ -142,6 +142,9 @@ void InputMethodPersistence::InputMethodChanged(
NOTREACHED();
}
+void InputMethodPersistence::InputMethodPropertyChanged(
+ InputMethodManager* manager) {}
+
void InputMethodPersistence::OnSessionStateChange(
InputMethodManager::State new_state) {
state_ = new_state;
diff --git a/chrome/browser/chromeos/input_method/input_method_persistence.h b/chrome/browser/chromeos/input_method/input_method_persistence.h
index 27fba16..9e19921 100644
--- a/chrome/browser/chromeos/input_method/input_method_persistence.h
+++ b/chrome/browser/chromeos/input_method/input_method_persistence.h
@@ -31,6 +31,7 @@ class InputMethodPersistence : public InputMethodManager::Observer {
// InputMethodManager::Observer overrides.
virtual void InputMethodChanged(InputMethodManager* manager,
bool show_message) OVERRIDE;
+ virtual void InputMethodPropertyChanged(InputMethodManager* manager) OVERRIDE;
private:
InputMethodManager* input_method_manager_;
diff --git a/chrome/browser/chromeos/input_method/mock_input_method_engine.h b/chrome/browser/chromeos/input_method/mock_input_method_engine.h
index 39e5647..b5ad032 100644
--- a/chrome/browser/chromeos/input_method/mock_input_method_engine.h
+++ b/chrome/browser/chromeos/input_method/mock_input_method_engine.h
@@ -15,18 +15,13 @@ namespace ui {
class KeyEvent;
} // namespace ui
-namespace ash {
-namespace ime {
-struct InputMethodMenuItem;
-} // namespace ime
-} // namespace ash
-
namespace chromeos {
class CompositionText;
namespace input_method {
class CandidateWindow;
+struct InputMethodProperty;
struct KeyEventHandle;
} // namespace input_method
diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc b/chrome/browser/chromeos/input_method/mock_input_method_manager.cc
index 5d55d7b..8c0594f 100644
--- a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc
+++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.cc
@@ -91,7 +91,7 @@ void MockInputMethodManager::ChangeInputMethod(
const std::string& input_method_id) {
}
-void MockInputMethodManager::ActivateInputMethodMenuItem(
+void MockInputMethodManager::ActivateInputMethodProperty(
const std::string& key) {
}
@@ -144,6 +144,15 @@ InputMethodDescriptor MockInputMethodManager::GetCurrentInputMethod() const {
return descriptor;
}
+InputMethodPropertyList
+MockInputMethodManager::GetCurrentInputMethodProperties() const {
+ return InputMethodPropertyList();
+}
+
+void MockInputMethodManager::SetCurrentInputMethodProperties(
+ const InputMethodPropertyList& property_list) {
+}
+
XKeyboard* MockInputMethodManager::GetXKeyboard() {
return &xkeyboard_;
}
diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.h b/chrome/browser/chromeos/input_method/mock_input_method_manager.h
index e5d612a..ef8001f 100644
--- a/chrome/browser/chromeos/input_method/mock_input_method_manager.h
+++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.h
@@ -43,7 +43,7 @@ class MockInputMethodManager : public InputMethodManager {
virtual bool EnableInputMethod(
const std::string& new_active_input_method_id) OVERRIDE;
virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE;
- virtual void ActivateInputMethodMenuItem(const std::string& key) OVERRIDE;
+ virtual void ActivateInputMethodProperty(const std::string& key) OVERRIDE;
virtual void AddInputMethodExtension(
const std::string& id,
InputMethodEngineInterface* instance) OVERRIDE;
@@ -57,6 +57,10 @@ class MockInputMethodManager : public InputMethodManager {
const ui::Accelerator& accelerator) OVERRIDE;
virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE;
virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE;
+ virtual InputMethodPropertyList
+ GetCurrentInputMethodProperties() const OVERRIDE;
+ virtual void SetCurrentInputMethodProperties(
+ const InputMethodPropertyList& property_list) OVERRIDE;
virtual XKeyboard* GetXKeyboard() OVERRIDE;
virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE;
virtual ComponentExtensionIMEManager*
diff --git a/chrome/browser/chromeos/input_method/mode_indicator_controller.cc b/chrome/browser/chromeos/input_method/mode_indicator_controller.cc
index 4249fc4..cd8241e 100644
--- a/chrome/browser/chromeos/input_method/mode_indicator_controller.cc
+++ b/chrome/browser/chromeos/input_method/mode_indicator_controller.cc
@@ -92,6 +92,11 @@ void ModeIndicatorController::InputMethodChanged(InputMethodManager* manager,
ShowModeIndicator();
}
+void ModeIndicatorController::InputMethodPropertyChanged(
+ InputMethodManager* manager) {
+ // Do nothing.
+}
+
void ModeIndicatorController::ShowModeIndicator() {
// TODO(komatsu): When this is permanently enabled by defalut,
// delete command_line.h and chromeos_switches.h from the header
diff --git a/chrome/browser/chromeos/input_method/mode_indicator_controller.h b/chrome/browser/chromeos/input_method/mode_indicator_controller.h
index 9023c6c..9f29041 100644
--- a/chrome/browser/chromeos/input_method/mode_indicator_controller.h
+++ b/chrome/browser/chromeos/input_method/mode_indicator_controller.h
@@ -48,6 +48,7 @@ class ModeIndicatorController
// InputMethodManager::Observer implementation.
virtual void InputMethodChanged(InputMethodManager* manager,
bool show_message) OVERRIDE;
+ virtual void InputMethodPropertyChanged(InputMethodManager* manager) OVERRIDE;
// Show the mode inidicator with the current ime's short name if all
// the conditions are cleared.