diff options
author | uekawa@chromium.org <uekawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-19 08:20:27 +0000 |
---|---|---|
committer | uekawa@chromium.org <uekawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-19 08:20:27 +0000 |
commit | de4e5d42419ab84a7ddd35b82cca0243f284907c (patch) | |
tree | b306eebcef89fcc23992b87e15e9acc91ed4b6f9 | |
parent | 50d423735a16869a3271386f38fb2b7e1926eab2 (diff) | |
download | chromium_src-de4e5d42419ab84a7ddd35b82cca0243f284907c.zip chromium_src-de4e5d42419ab84a7ddd35b82cca0243f284907c.tar.gz chromium_src-de4e5d42419ab84a7ddd35b82cca0243f284907c.tar.bz2 |
try 3 of: Split out InputMethodMenuManager from InputMethodManager.
(I was missing RemoveObserver in one of the tests and as a result ASAN tests were catching use-after-free.)
Rename input_method_property to input_method_menu_item, and move to ash/ime.
BUG=342336, 343044
Review URL: https://codereview.chromium.org/169033003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251996 0039d316-1c4b-4281-b951-d872f2087c98
28 files changed, 386 insertions, 223 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index d6697a3..3b8d961 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -172,6 +172,10 @@ 'ime/candidate_window_view.h', 'ime/infolist_window.cc', 'ime/infolist_window.h', + 'ime/input_method_menu_item.cc', + 'ime/input_method_menu_item.h', + 'ime/input_method_menu_manager.cc', + 'ime/input_method_menu_manager.h', 'ime/mode_indicator_view.cc', 'ime/mode_indicator_view.h', 'keyboard_uma_event_filter.cc', @@ -866,6 +870,8 @@ 'extended_desktop_unittest.cc', 'focus_cycler_unittest.cc', 'ime/candidate_window_view_unittest.cc', + 'ime/input_method_menu_item_unittest.cc', + 'ime/input_method_menu_manager_unittest.cc', 'keyboard_overlay/keyboard_overlay_delegate_unittest.cc', 'keyboard_overlay/keyboard_overlay_view_unittest.cc', 'magnifier/magnification_controller_unittest.cc', diff --git a/chromeos/ime/input_method_property.cc b/ash/ime/input_method_menu_item.cc index c37d218..6337ec5 100644 --- a/chromeos/ime/input_method_property.cc +++ b/ash/ime/input_method_menu_item.cc @@ -1,17 +1,17 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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/input_method_property.h" +#include "ash/ime/input_method_menu_item.h" #include <sstream> #include "base/logging.h" -namespace chromeos { -namespace input_method { +namespace ash { +namespace ime { -InputMethodProperty::InputMethodProperty(const std::string& in_key, +InputMethodMenuItem::InputMethodMenuItem(const std::string& in_key, const std::string& in_label, bool in_is_selection_item, bool in_is_selection_item_checked) @@ -22,26 +22,26 @@ InputMethodProperty::InputMethodProperty(const std::string& in_key, DCHECK(!key.empty()); } -InputMethodProperty::InputMethodProperty() +InputMethodMenuItem::InputMethodMenuItem() : is_selection_item(false), is_selection_item_checked(false) { } -InputMethodProperty::~InputMethodProperty() { +InputMethodMenuItem::~InputMethodMenuItem() { } -bool InputMethodProperty::operator==(const InputMethodProperty& other) const { +bool InputMethodMenuItem::operator==(const InputMethodMenuItem& other) const { return key == other.key && label == other.label && is_selection_item == other.is_selection_item && is_selection_item_checked == other.is_selection_item_checked; } -bool InputMethodProperty::operator!=(const InputMethodProperty& other) const { +bool InputMethodMenuItem::operator!=(const InputMethodMenuItem& other) const { return !(*this == other); } -std::string InputMethodProperty::ToString() const { +std::string InputMethodMenuItem::ToString() const { std::stringstream stream; stream << "key=" << key << ", label=" << label @@ -50,5 +50,5 @@ std::string InputMethodProperty::ToString() const { return stream.str(); } -} // namespace input_method -} // namespace chromeos +} // namespace ime +} // namespace ash diff --git a/chromeos/ime/input_method_property.h b/ash/ime/input_method_menu_item.h index 25355d1..1407d0a 100644 --- a/chromeos/ime/input_method_property.h +++ b/ash/ime/input_method_menu_item.h @@ -1,29 +1,29 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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_PROPERTY_H_ -#define CHROMEOS_IME_INPUT_METHOD_PROPERTY_H_ +#ifndef ASH_IME_INPUT_METHOD_MENU_ITEM_H_ +#define ASH_IME_INPUT_METHOD_MENU_ITEM_H_ #include <string> #include <vector> -#include "chromeos/chromeos_export.h" +#include "ash/ash_export.h" -namespace chromeos { -namespace input_method { +namespace ash { +namespace ime { // A structure which represents a property for an input method engine. -struct CHROMEOS_EXPORT InputMethodProperty { - InputMethodProperty(const std::string& in_key, +struct ASH_EXPORT InputMethodMenuItem { + InputMethodMenuItem(const std::string& in_key, const std::string& in_label, bool in_is_selection_item, bool in_is_selection_item_checked); - InputMethodProperty(); - ~InputMethodProperty(); + InputMethodMenuItem(); + ~InputMethodMenuItem(); - bool operator==(const InputMethodProperty& other) const; - bool operator!=(const InputMethodProperty& other) const; + bool operator==(const InputMethodMenuItem& other) const; + bool operator!=(const InputMethodMenuItem& other) const; // Debug print function. std::string ToString() const; @@ -36,9 +36,9 @@ struct CHROMEOS_EXPORT InputMethodProperty { bool is_selection_item_checked; // true if |is_selection_item| is true and // the selection_item is selected. }; -typedef std::vector<InputMethodProperty> InputMethodPropertyList; +typedef std::vector<InputMethodMenuItem> InputMethodMenuItemList; -} // namespace input_method -} // namespace chromeos +} // namespace ime +} // namespace ash -#endif // CHROMEOS_IME_INPUT_METHOD_PROPERTY_H_ +#endif // ASH_IME_INPUT_METHOD_MENU_ITEM_H_ diff --git a/ash/ime/input_method_menu_item_unittest.cc b/ash/ime/input_method_menu_item_unittest.cc new file mode 100644 index 0000000..9ac7942 --- /dev/null +++ b/ash/ime/input_method_menu_item_unittest.cc @@ -0,0 +1,32 @@ +// Copyright 2014 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 "ash/ime/input_method_menu_item.h" + +#include "base/logging.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ash { +namespace ime { + +TEST(InputMethodMenuItemTest, TestOperatorEqual) { + InputMethodMenuItem empty; + InputMethodMenuItem reference("key", "label", true, true); + + InputMethodMenuItem p1("X", "label", true, true); + InputMethodMenuItem p2("key", "X", true, true); + InputMethodMenuItem p3("key", "label", false, true); + InputMethodMenuItem p4("key", "label", true, false); + + EXPECT_EQ(empty, empty); + EXPECT_EQ(reference, reference); + EXPECT_NE(reference, empty); + EXPECT_NE(reference, p1); + EXPECT_NE(reference, p2); + EXPECT_NE(reference, p3); + EXPECT_NE(reference, p4); +} + +} // namespace ime +} // namespace ash diff --git a/ash/ime/input_method_menu_manager.cc b/ash/ime/input_method_menu_manager.cc new file mode 100644 index 0000000..ee75621 --- /dev/null +++ b/ash/ime/input_method_menu_manager.cc @@ -0,0 +1,57 @@ +// Copyright 2014 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 "ash/ime/input_method_menu_manager.h" + +#include "base/logging.h" +#include "base/memory/singleton.h" + +namespace ash { +namespace ime { + +InputMethodMenuManager::InputMethodMenuManager() + : menu_list_(), observers_() {} + +InputMethodMenuManager::~InputMethodMenuManager() {} + +void InputMethodMenuManager::AddObserver( + InputMethodMenuManager::Observer* observer) { + observers_.AddObserver(observer); +} + +void InputMethodMenuManager::RemoveObserver( + InputMethodMenuManager::Observer* observer) { + observers_.RemoveObserver(observer); +} + +InputMethodMenuItemList +InputMethodMenuManager::GetCurrentInputMethodMenuItemList() const { + return menu_list_; +} + +void InputMethodMenuManager::SetCurrentInputMethodMenuItemList( + const InputMethodMenuItemList& menu_list) { + menu_list_ = menu_list; + FOR_EACH_OBSERVER(InputMethodMenuManager::Observer, + observers_, + InputMethodMenuItemChanged(this)); +} + +bool InputMethodMenuManager::HasInputMethodMenuItemForKey( + const std::string& key) const { + for (size_t i = 0; i < menu_list_.size(); ++i) { + if (menu_list_[i].key == key) { + return true; + } + } + return false; +} + +// static +InputMethodMenuManager* InputMethodMenuManager::GetInstance() { + return Singleton<InputMethodMenuManager>::get(); +} + +} // namespace ime +} // namespace ash diff --git a/ash/ime/input_method_menu_manager.h b/ash/ime/input_method_menu_manager.h new file mode 100644 index 0000000..ffaeb480 --- /dev/null +++ b/ash/ime/input_method_menu_manager.h @@ -0,0 +1,65 @@ +// Copyright 2014 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 "ash/ash_export.h" + +#include "ash/ime/input_method_menu_item.h" +#include "base/observer_list.h" + +#ifndef ASH_IME_INPUT_METHOD_MENU_MANAGER_H_ +#define ASH_IME_INPUT_METHOD_MENU_MANAGER_H_ + +template<typename Type> struct DefaultSingletonTraits; + +namespace ash { +namespace ime { + +class ASH_EXPORT InputMethodMenuManager { +public: + class Observer { + public: + virtual ~Observer() {} + + // Called when the list of menu items is changed. + virtual void InputMethodMenuItemChanged( + InputMethodMenuManager* manager) = 0; + }; + + ~InputMethodMenuManager(); + + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + + // Obtains the singleton instance. + static InputMethodMenuManager* GetInstance(); + + // Sets the list of input method menu items. The list could be empty(). + void SetCurrentInputMethodMenuItemList( + const InputMethodMenuItemList& menu_list); + + // Gets the list of input method menu items. The list could be empty(). + InputMethodMenuItemList GetCurrentInputMethodMenuItemList() const; + + // True if the key exists in the menu_list_. + bool HasInputMethodMenuItemForKey(const std::string& key) const; + + private: + InputMethodMenuManager(); + + // For Singleton to be able to construct an instance. + friend struct DefaultSingletonTraits<InputMethodMenuManager>; + + // Menu item list of the input method. This is set by extension IMEs. + InputMethodMenuItemList menu_list_; + + // Observers who will be notified when menu changes. + ObserverList<Observer> observers_; + + DISALLOW_COPY_AND_ASSIGN(InputMethodMenuManager); +}; + +} // namespace ime +} // namespace ash + +#endif // ASH_IME_INPUT_METHOD_MENU_MANAGER_H_ diff --git a/ash/ime/input_method_menu_manager_unittest.cc b/ash/ime/input_method_menu_manager_unittest.cc new file mode 100644 index 0000000..ba92001 --- /dev/null +++ b/ash/ime/input_method_menu_manager_unittest.cc @@ -0,0 +1,76 @@ +// Copyright 2014 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 "ash/ime/input_method_menu_manager.h" + +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ash { +namespace ime { + +TEST(InputMethodMenuManagerTest, TestGetSingleton) { + EXPECT_TRUE(InputMethodMenuManager::GetInstance()); +} + +class MockObserver : public InputMethodMenuManager::Observer { + public: + MockObserver() : input_method_menu_item_changed_count_(0) {} + virtual ~MockObserver() {} + + // Called when the list of menu items is changed. + virtual void InputMethodMenuItemChanged( + InputMethodMenuManager* manager) OVERRIDE { + input_method_menu_item_changed_count_++; + } + int input_method_menu_item_changed_count_; +}; + +class InputMethodMenuManagerStatefulTest : public testing::Test{ + public: + InputMethodMenuManagerStatefulTest() + : observer_(new MockObserver()) {} + virtual ~InputMethodMenuManagerStatefulTest() {} + virtual void SetUp() OVERRIDE { + menu_manager_ = InputMethodMenuManager::GetInstance(); + menu_manager_->AddObserver(observer_.get()); + } + + virtual void TearDown() OVERRIDE { + menu_manager_->RemoveObserver(observer_.get()); + } + + InputMethodMenuManager* menu_manager_; + scoped_ptr<MockObserver> observer_; +}; + +TEST_F(InputMethodMenuManagerStatefulTest, AddAndObserve) { + EXPECT_EQ(observer_->input_method_menu_item_changed_count_, 0); + menu_manager_->SetCurrentInputMethodMenuItemList(InputMethodMenuItemList()); + EXPECT_EQ(observer_->input_method_menu_item_changed_count_, 1); +} + +TEST_F(InputMethodMenuManagerStatefulTest, AddAndCheckExists) { + InputMethodMenuItemList list; + list.push_back(InputMethodMenuItem("key1", "label1", false, false)); + list.push_back(InputMethodMenuItem("key2", "label2", false, false)); + menu_manager_->SetCurrentInputMethodMenuItemList(list); + EXPECT_EQ(menu_manager_->GetCurrentInputMethodMenuItemList().size(), 2U); + EXPECT_EQ( + menu_manager_->GetCurrentInputMethodMenuItemList().at(0).ToString(), + "key=key1, label=label1, " + "is_selection_item=0, is_selection_item_checked=0"); + EXPECT_EQ( + menu_manager_->GetCurrentInputMethodMenuItemList().at(1).ToString(), + "key=key2, label=label2, " + "is_selection_item=0, is_selection_item_checked=0"); + + EXPECT_TRUE(menu_manager_->HasInputMethodMenuItemForKey("key1")); + EXPECT_TRUE(menu_manager_->HasInputMethodMenuItemForKey("key2")); + EXPECT_FALSE(menu_manager_->HasInputMethodMenuItemForKey("key-not-exist")); +} + +} // namespace ime +} // namespace ash diff --git a/chrome/browser/chromeos/extensions/input_method_event_router.h b/chrome/browser/chromeos/extensions/input_method_event_router.h index b7f0169..91bfb34 100644 --- a/chrome/browser/chromeos/extensions/input_method_event_router.h +++ b/chrome/browser/chromeos/extensions/input_method_event_router.h @@ -28,8 +28,6 @@ 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 5047d12..f830d57 100644 --- a/chrome/browser/chromeos/input_method/accessibility.cc +++ b/chrome/browser/chromeos/input_method/accessibility.cc @@ -54,9 +54,5 @@ 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 ed04ae0..60fb084 100644 --- a/chrome/browser/chromeos/input_method/accessibility.h +++ b/chrome/browser/chromeos/input_method/accessibility.h @@ -21,8 +21,6 @@ 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 ff298c6..b32a8a8 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc @@ -14,6 +14,8 @@ #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" @@ -375,19 +377,17 @@ bool InputMethodEngine::UpdateMenuItems( if (!active_) return false; - input_method::InputMethodPropertyList property_list; + ash::ime::InputMethodMenuItemList menu_item_list; for (std::vector<MenuItem>::const_iterator item = items.begin(); item != items.end(); ++item) { - input_method::InputMethodProperty property; + ash::ime::InputMethodMenuItem property; MenuItemToProperty(*item, &property); - property_list.push_back(property); + menu_item_list.push_back(property); } - input_method::InputMethodManager* manager = - input_method::InputMethodManager::Get(); - if (manager) - manager->SetCurrentInputMethodProperties(property_list); - + ash::ime::InputMethodMenuManager::GetInstance()-> + SetCurrentInputMethodMenuItemList( + menu_item_list); return true; } @@ -595,9 +595,10 @@ 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, - input_method::InputMethodProperty* property) { + ash::ime::InputMethodMenuItem* 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 2d3bd1a..e365228 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.h +++ b/chrome/browser/chromeos/input_method/input_method_engine.h @@ -17,12 +17,17 @@ 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 @@ -95,9 +100,9 @@ class InputMethodEngine : public InputMethodEngineInterface { virtual void HideInputView() OVERRIDE; private: - // Converts MenuItem to InputMethodProperty. + // Converts MenuItem to InputMethodMenuItem. void MenuItemToProperty(const MenuItem& item, - input_method::InputMethodProperty* property); + ash::ime::InputMethodMenuItem* 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 0823c29..83c681be 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc @@ -2,6 +2,8 @@ // 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" @@ -800,8 +802,9 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineIBusBrowserTest, ASSERT_TRUE(content::ExecuteScript( host->host_contents(), set_menu_item_test_script)); - const InputMethodPropertyList& props = - InputMethodManager::Get()->GetCurrentInputMethodProperties(); + const ash::ime::InputMethodMenuItemList& props = + ash::ime::InputMethodMenuManager::GetInstance()-> + GetCurrentInputMethodMenuItemList(); 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 3432e7b..8fda319 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc @@ -6,6 +6,8 @@ #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" @@ -357,8 +359,11 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal( // extension IMEs via InputMethodEngine::(Set|Update)MenuItems. // If the current input method is a keyboard layout, empty // properties are sufficient. - const InputMethodPropertyList empty_property_list; - SetCurrentInputMethodProperties(empty_property_list); + const ash::ime::InputMethodMenuItemList empty_menu_item_list; + ash::ime::InputMethodMenuManager* input_method_menu_manager = + ash::ime::InputMethodMenuManager::GetInstance(); + input_method_menu_manager->SetCurrentInputMethodMenuItemList( + empty_menu_item_list); const InputMethodDescriptor* descriptor = NULL; if (extension_ime_util::IsExtensionIME(input_method_id_to_switch)) { @@ -426,21 +431,20 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() { } } -void InputMethodManagerImpl::ActivateInputMethodProperty( +void InputMethodManagerImpl::ActivateInputMethodMenuItem( const std::string& key) { DCHECK(!key.empty()); - 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; - } + if (ash::ime::InputMethodMenuManager::GetInstance()-> + HasInputMethodMenuItemForKey(key)) { + IMEEngineHandlerInterface* engine = + IMEBridge::Get()->GetCurrentEngineHandler(); + if (engine) + engine->PropertyActivate(key); + return; } - DVLOG(1) << "ActivateInputMethodProperty: unknown key: " << key; + DVLOG(1) << "ActivateInputMethodMenuItem: unknown key: " << key; } void InputMethodManagerImpl::AddInputMethodExtension( @@ -696,21 +700,6 @@ 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(); } @@ -766,12 +755,6 @@ 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 889a3f2..1969083 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h @@ -67,7 +67,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 ActivateInputMethodProperty(const std::string& key) OVERRIDE; + virtual void ActivateInputMethodMenuItem(const std::string& key) OVERRIDE; virtual void AddInputMethodExtension( const std::string& id, InputMethodEngineInterface* instance) OVERRIDE; @@ -81,10 +81,6 @@ 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; @@ -102,9 +98,6 @@ 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; @@ -190,9 +183,6 @@ 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 cc22f78..4eed0cb 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,6 +6,8 @@ #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" @@ -72,6 +74,8 @@ class InputMethodManagerImplTest : public testing::Test { IMEBridge::Initialize(); IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); + menu_manager_ = ash::ime::InputMethodMenuManager::GetInstance(); + ime_list_.clear(); ComponentExtensionIME ext1; @@ -122,6 +126,7 @@ class InputMethodManagerImplTest : public testing::Test { candidate_window_controller_ = NULL; xkeyboard_ = NULL; manager_.reset(); + IMEBridge::Get()->SetCurrentEngineHandler(NULL); IMEBridge::Shutdown(); } @@ -154,16 +159,18 @@ 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 { +class TestObserver : public InputMethodManager::Observer, + public ash::ime::InputMethodMenuManager::Observer{ public: TestObserver() : input_method_changed_count_(0), - input_method_property_changed_count_(0), + input_method_menu_item_changed_count_(0), last_show_message_(false) { } virtual ~TestObserver() {} @@ -173,13 +180,13 @@ class TestObserver : public InputMethodManager::Observer { ++input_method_changed_count_; last_show_message_ = show_message; } - virtual void InputMethodPropertyChanged( - InputMethodManager* manager) OVERRIDE { - ++input_method_property_changed_count_; + virtual void InputMethodMenuItemChanged( + ash::ime::InputMethodMenuManager* manager) OVERRIDE { + ++input_method_menu_item_changed_count_; } int input_method_changed_count_; - int input_method_property_changed_count_; + int input_method_menu_item_changed_count_; bool last_show_message_; private: @@ -240,14 +247,15 @@ 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", keyboard_layouts); EXPECT_EQ(1, observer.input_method_changed_count_); - EXPECT_EQ(1, observer.input_method_property_changed_count_); + EXPECT_EQ(1, observer.input_method_menu_item_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_property_changed_count_); + EXPECT_EQ(2, observer.input_method_menu_item_changed_count_); manager_->ChangeInputMethod("xkb:us:dvorak:eng"); EXPECT_FALSE(observer.last_show_message_); @@ -258,9 +266,10 @@ TEST_F(InputMethodManagerImplTest, TestObserver) { // If the same input method ID is passed, PropertyChanged() is not // notified. - EXPECT_EQ(2, observer.input_method_property_changed_count_); + EXPECT_EQ(2, observer.input_method_menu_item_changed_count_); manager_->RemoveObserver(&observer); + menu_manager_->RemoveObserver(&observer); } TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { @@ -635,23 +644,24 @@ TEST_F(InputMethodManagerImplTest, TestXkbSetting) { EXPECT_EQ("us(colemak)", xkeyboard_->last_layout_); } -TEST_F(InputMethodManagerImplTest, TestActivateInputMethodProperty) { +TEST_F(InputMethodManagerImplTest, TestActivateInputMethodMenuItem) { const std::string kKey = "key"; - InputMethodPropertyList property_list; - property_list.push_back(InputMethodProperty(kKey, "label", false, false)); - manager_->SetCurrentInputMethodProperties(property_list); + ash::ime::InputMethodMenuItemList menu_list; + menu_list.push_back(ash::ime::InputMethodMenuItem( + kKey, "label", false, false)); + menu_manager_->SetCurrentInputMethodMenuItemList(menu_list); - manager_->ActivateInputMethodProperty(kKey); + manager_->ActivateInputMethodMenuItem(kKey); EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); // Key2 is not registered, so activated property should not be changed. - manager_->ActivateInputMethodProperty("key2"); + manager_->ActivateInputMethodMenuItem("key2"); EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); } TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { InitComponentExtension(); - EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); + EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); std::vector<std::string> ids; @@ -659,26 +669,25 @@ TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { ids.push_back(kNaclMozcUsId); EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); - EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); + EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); manager_->ChangeInputMethod(kNaclMozcUsId); - InputMethodPropertyList current_property_list; - current_property_list.push_back(InputMethodProperty("key", - "label", - false, - false)); - manager_->SetCurrentInputMethodProperties(current_property_list); + ash::ime::InputMethodMenuItemList current_property_list; + current_property_list.push_back(ash::ime::InputMethodMenuItem( + "key", "label", false, false)); + menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); - ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); - EXPECT_EQ("key", manager_->GetCurrentInputMethodProperties().at(0).key); + ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); + EXPECT_EQ("key", + menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); manager_->ChangeInputMethod("xkb:us::eng"); - EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); + EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); } TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { InitComponentExtension(); - EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); + EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); std::vector<std::string> ids; @@ -686,32 +695,31 @@ TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { ids.push_back(kExt2Engine1Id); // T-Chinese EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); - EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); + EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); - InputMethodPropertyList current_property_list; - current_property_list.push_back(InputMethodProperty("key-mozc", - "label", - false, - false)); - manager_->SetCurrentInputMethodProperties(current_property_list); + 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); - ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); - EXPECT_EQ("key-mozc", manager_->GetCurrentInputMethodProperties().at(0).key); + ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); + EXPECT_EQ("key-mozc", + menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); manager_->ChangeInputMethod(kExt2Engine1Id); // Since the IME is changed, the property for mozc Japanese should be hidden. - EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); + EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); // Asynchronous property update signal from mozc-chewing. current_property_list.clear(); - current_property_list.push_back(InputMethodProperty("key-chewing", - "label", - false, - false)); - manager_->SetCurrentInputMethodProperties(current_property_list); - ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); + 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()); EXPECT_EQ("key-chewing", - manager_->GetCurrentInputMethodProperties().at(0).key); + menu_manager_->GetCurrentInputMethodMenuItemList().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 b33e256..0ebcaf3 100644 --- a/chrome/browser/chromeos/input_method/input_method_persistence.cc +++ b/chrome/browser/chromeos/input_method/input_method_persistence.cc @@ -142,9 +142,6 @@ 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 9e19921..27fba16 100644 --- a/chrome/browser/chromeos/input_method/input_method_persistence.h +++ b/chrome/browser/chromeos/input_method/input_method_persistence.h @@ -31,7 +31,6 @@ 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 b5ad032..39e5647 100644 --- a/chrome/browser/chromeos/input_method/mock_input_method_engine.h +++ b/chrome/browser/chromeos/input_method/mock_input_method_engine.h @@ -15,13 +15,18 @@ 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 a4533a2..beb0d28 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::ActivateInputMethodProperty( +void MockInputMethodManager::ActivateInputMethodMenuItem( const std::string& key) { } @@ -144,15 +144,6 @@ 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 794db45..b6a757e 100644 --- a/chrome/browser/chromeos/input_method/mock_input_method_manager.h +++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.h @@ -44,7 +44,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 ActivateInputMethodProperty(const std::string& key) OVERRIDE; + virtual void ActivateInputMethodMenuItem(const std::string& key) OVERRIDE; virtual void AddInputMethodExtension( const std::string& id, InputMethodEngineInterface* instance) OVERRIDE; @@ -58,10 +58,6 @@ 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 cd8241e..4249fc4 100644 --- a/chrome/browser/chromeos/input_method/mode_indicator_controller.cc +++ b/chrome/browser/chromeos/input_method/mode_indicator_controller.cc @@ -92,11 +92,6 @@ 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 9f29041..9023c6c 100644 --- a/chrome/browser/chromeos/input_method/mode_indicator_controller.h +++ b/chrome/browser/chromeos/input_method/mode_indicator_controller.h @@ -48,7 +48,6 @@ 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. diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 1b5784d..2c320e9 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc @@ -11,6 +11,8 @@ #include "ash/ash_switches.h" #include "ash/desktop_background/desktop_background_controller.h" +#include "ash/ime/input_method_menu_item.h" +#include "ash/ime/input_method_menu_manager.h" #include "ash/metrics/user_metrics_recorder.h" #include "ash/session_state_delegate.h" #include "ash/session_state_observer.h" @@ -297,6 +299,7 @@ void SystemTrayDelegateChromeOS::Initialize() { DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); input_method::InputMethodManager::Get()->AddObserver(this); + ash::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); UpdateClockType(); if (SystemKeyEventListener::GetInstance()) @@ -360,6 +363,7 @@ SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); input_method::InputMethodManager::Get()->RemoveObserver(this); + ash::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); if (SystemKeyEventListener::GetInstance()) SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); bluetooth_adapter_->RemoveObserver(this); @@ -772,15 +776,14 @@ void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) { void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( ash::IMEPropertyInfoList* list) { - input_method::InputMethodManager* manager = - input_method::InputMethodManager::Get(); - input_method::InputMethodPropertyList properties = - manager->GetCurrentInputMethodProperties(); - for (size_t i = 0; i < properties.size(); ++i) { + ash::ime::InputMethodMenuItemList menu_list = + ash::ime::InputMethodMenuManager::GetInstance()-> + GetCurrentInputMethodMenuItemList(); + for (size_t i = 0; i < menu_list.size(); ++i) { ash::IMEPropertyInfo property; - property.key = properties[i].key; - property.name = base::UTF8ToUTF16(properties[i].label); - property.selected = properties[i].is_selection_item_checked; + property.key = menu_list[i].key; + property.name = base::UTF8ToUTF16(menu_list[i].label); + property.selected = menu_list[i].is_selection_item_checked; list->push_back(property); } } @@ -790,7 +793,7 @@ void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) { } void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) { - input_method::InputMethodManager::Get()->ActivateInputMethodProperty(key); + input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key); } void SystemTrayDelegateChromeOS::CancelDriveOperation(int32 operation_id) { @@ -1207,8 +1210,9 @@ void SystemTrayDelegateChromeOS::InputMethodChanged( GetSystemTrayNotifier()->NotifyRefreshIME(show_message); } -void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( - input_method::InputMethodManager* manager) { +// Overridden from InputMethodMenuManager::Observer. +void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( + ash::ime::InputMethodMenuManager* manager) { GetSystemTrayNotifier()->NotifyRefreshIME(false); } diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h index 2b1fcb7..ec6fb22 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ +#include "ash/ime/input_method_menu_manager.h" #include "ash/session_state_observer.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_delegate.h" @@ -31,7 +32,8 @@ namespace chromeos { class SystemTrayDelegateChromeOS - : public ash::SystemTrayDelegate, + : public ash::ime::InputMethodMenuManager::Observer, + public ash::SystemTrayDelegate, public SessionManagerClient::Observer, public drive::JobListObserver, public content::NotificationObserver, @@ -182,8 +184,9 @@ class SystemTrayDelegateChromeOS virtual void InputMethodChanged(input_method::InputMethodManager* manager, bool show_message) OVERRIDE; - virtual void InputMethodPropertyChanged( - input_method::InputMethodManager* manager) OVERRIDE; + // Overridden from InputMethodMenuManager::Observer. + virtual void InputMethodMenuItemChanged( + ash::ime::InputMethodMenuManager* manager) OVERRIDE; // Overridden from CrasAudioHandler::AudioObserver. virtual void OnOutputVolumeChanged() OVERRIDE; diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index 1597cb6..924d8cf 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -228,8 +228,6 @@ 'ime/input_method_descriptor.h', 'ime/input_method_manager.cc', 'ime/input_method_manager.h', - 'ime/input_method_property.cc', - 'ime/input_method_property.h', 'ime/input_method_whitelist.cc', 'ime/input_method_whitelist.h', 'ime/xkeyboard.cc', @@ -491,7 +489,6 @@ 'ime/extension_ime_util_unittest.cc', 'ime/composition_text_unittest.cc', 'ime/input_method_manager.h', - 'ime/input_method_property_unittest.cc', 'ime/input_method_whitelist_unittest.cc', 'ime/xkeyboard_unittest.cc', 'login/login_state_unittest.cc', diff --git a/chromeos/ime/input_method_manager.h b/chromeos/ime/input_method_manager.h index a822a94..2eea80e 100644 --- a/chromeos/ime/input_method_manager.h +++ b/chromeos/ime/input_method_manager.h @@ -12,7 +12,6 @@ #include "base/memory/scoped_ptr.h" #include "chromeos/chromeos_export.h" #include "chromeos/ime/input_method_descriptor.h" -#include "chromeos/ime/input_method_property.h" namespace ui { class Accelerator; @@ -44,8 +43,6 @@ class CHROMEOS_EXPORT InputMethodManager { // indicates whether the user should be notified of this change. virtual void InputMethodChanged(InputMethodManager* manager, bool show_message) = 0; - // Called when the list of properties is changed. - virtual void InputMethodPropertyChanged(InputMethodManager* manager) = 0; }; // CandidateWindowObserver is notified of events related to the candidate @@ -127,7 +124,7 @@ class CHROMEOS_EXPORT InputMethodManager { const std::vector<std::string>& initial_layouts) = 0; // Activates the input method property specified by the |key|. - virtual void ActivateInputMethodProperty(const std::string& key) = 0; + virtual void ActivateInputMethodMenuItem(const std::string& key) = 0; // Updates the list of active input method IDs, and then starts or stops the // system input method framework as needed. @@ -160,13 +157,6 @@ class CHROMEOS_EXPORT InputMethodManager { // Gets the descriptor of the input method which is currently selected. virtual InputMethodDescriptor GetCurrentInputMethod() const = 0; - // Gets the list of input method properties. The list could be empty(). - virtual InputMethodPropertyList GetCurrentInputMethodProperties() const = 0; - - // Sets the list of input method properties. The list could be empty(). - virtual void SetCurrentInputMethodProperties( - const InputMethodPropertyList& property_list) = 0; - // Returns an X keyboard object which could be used to change the current XKB // layout, change the caps lock status, and set the auto repeat rate/interval. virtual XKeyboard* GetXKeyboard() = 0; diff --git a/chromeos/ime/input_method_property_unittest.cc b/chromeos/ime/input_method_property_unittest.cc deleted file mode 100644 index d00b532..0000000 --- a/chromeos/ime/input_method_property_unittest.cc +++ /dev/null @@ -1,31 +0,0 @@ -// 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 "base/logging.h" -#include "chromeos/ime/input_method_property.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromeos { -namespace input_method { - -TEST(InputMethodPropertyTest, TestOperatorEqual) { - InputMethodProperty empty; - InputMethodProperty reference("key", "label", true, true); - - InputMethodProperty p1("X", "label", true, true); - InputMethodProperty p2("key", "X", true, true); - InputMethodProperty p3("key", "label", false, true); - InputMethodProperty p4("key", "label", true, false); - - EXPECT_EQ(empty, empty); - EXPECT_EQ(reference, reference); - EXPECT_NE(reference, empty); - EXPECT_NE(reference, p1); - EXPECT_NE(reference, p2); - EXPECT_NE(reference, p3); - EXPECT_NE(reference, p4); -} - -} // namespace input_method -} // namespace chromeos |