Commit fbd7f4da authored by yusukes@google.com's avatar yusukes@google.com

- Rename InputMethodManager::current_input_method() to...

- Rename InputMethodManager::current_input_method() to InputMethodManager::GetCurrentInputMethod() since it's not a simple getter.
- Do the same for previous_input_method() and current_ime_properties().
- Rename 'struct ImeProperty' to 'struct InputMethodProperty' to avoid abbreviations.

This is for crosbug.com/19655.

BUG=chromium-os:19655
TEST=try

Review URL: https://chromiumcodereview.appspot.com/9696025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126812 0039d316-1c4b-4281-b951-d872f2087c98
parent 771527b3
......@@ -56,13 +56,13 @@ void ExtensionInputMethodEventRouter::InputMethodChanged(
void ExtensionInputMethodEventRouter::ActiveInputMethodsChanged(
input_method::InputMethodManager *manager,
const input_method::InputMethodDescriptor & current_input_method,
const input_method::InputMethodDescriptor &current_input_method,
size_t num_active_input_methods) {
}
void ExtensionInputMethodEventRouter::PropertyListChanged(
input_method::InputMethodManager *manager,
const input_method::ImePropertyList & current_ime_properties) {
const input_method::InputMethodPropertyList &current_ime_properties) {
}
std::string ExtensionInputMethodEventRouter::GetInputMethodForXkb(
......
......@@ -28,7 +28,7 @@ class ExtensionInputMethodEventRouter
size_t num_active_input_methods) OVERRIDE;
virtual void PropertyListChanged(
input_method::InputMethodManager* manager,
const input_method::ImePropertyList& current_ime_properties) OVERRIDE;
const input_method::InputMethodPropertyList& properties) OVERRIDE;
// Returns input method name for the given XKB (X keyboard extensions in X
// Window System) id.
......
......@@ -137,7 +137,7 @@ std::string InputMethodDescriptor::ToString() const {
return stream.str();
}
ImeProperty::ImeProperty(const std::string& in_key,
InputMethodProperty::InputMethodProperty(const std::string& in_key,
const std::string& in_label,
bool in_is_selection_item,
bool in_is_selection_item_checked,
......@@ -150,16 +150,16 @@ ImeProperty::ImeProperty(const std::string& in_key,
DCHECK(!key.empty());
}
ImeProperty::ImeProperty()
InputMethodProperty::InputMethodProperty()
: is_selection_item(false),
is_selection_item_checked(false),
selection_item_id(kInvalidSelectionItemId) {
}
ImeProperty::~ImeProperty() {
InputMethodProperty::~InputMethodProperty() {
}
std::string ImeProperty::ToString() const {
std::string InputMethodProperty::ToString() const {
std::stringstream stream;
stream << "key=" << key
<< ", label=" << label
......@@ -262,7 +262,7 @@ bool PropertyHasChildren(IBusProperty* prop) {
// returns false if sanity checks for |ibus_prop| fail.
bool ConvertProperty(IBusProperty* ibus_prop,
int selection_item_id,
ImePropertyList* out_prop_list) {
InputMethodPropertyList* out_prop_list) {
DCHECK(ibus_prop);
DCHECK(ibus_prop->key);
DCHECK(out_prop_list);
......@@ -287,7 +287,7 @@ bool ConvertProperty(IBusProperty* ibus_prop,
const bool is_selection_item = (ibus_prop->type == PROP_TYPE_RADIO);
selection_item_id = is_selection_item ?
selection_item_id : ImeProperty::kInvalidSelectionItemId;
selection_item_id : InputMethodProperty::kInvalidSelectionItemId;
bool is_selection_item_checked = false;
if (ibus_prop->state == PROP_STATE_INCONSISTENT) {
......@@ -328,7 +328,7 @@ bool ConvertProperty(IBusProperty* ibus_prop,
label = Or(ibus_prop->key, "");
}
out_prop_list->push_back(ImeProperty(ibus_prop->key,
out_prop_list->push_back(InputMethodProperty(ibus_prop->key,
label,
is_selection_item,
is_selection_item_checked,
......@@ -340,7 +340,8 @@ bool ConvertProperty(IBusProperty* ibus_prop,
// may or may not have children. See the comment for FlattenPropertyList
// for details. Returns true if no error is found.
// TODO(yusukes): Write unittest.
bool FlattenProperty(IBusProperty* ibus_prop, ImePropertyList* out_prop_list) {
bool FlattenProperty(IBusProperty* ibus_prop,
InputMethodPropertyList* out_prop_list) {
DCHECK(ibus_prop);
DCHECK(out_prop_list);
......@@ -358,7 +359,7 @@ bool FlattenProperty(IBusProperty* ibus_prop, ImePropertyList* out_prop_list) {
continue;
}
// Convert |prop| to ImeProperty and push it to |out_prop_list|.
// Convert |prop| to InputMethodProperty and push it to |out_prop_list|.
if (!ConvertProperty(prop, current_selection_item_id, out_prop_list)) {
return false;
}
......@@ -407,7 +408,7 @@ bool FlattenProperty(IBusProperty* ibus_prop, ImePropertyList* out_prop_list) {
// ======================================================================
// TODO(yusukes): Write unittest.
bool FlattenPropertyList(
IBusPropList* ibus_prop_list, ImePropertyList* out_prop_list) {
IBusPropList* ibus_prop_list, InputMethodPropertyList* out_prop_list) {
DCHECK(ibus_prop_list);
DCHECK(out_prop_list);
......@@ -986,7 +987,7 @@ class IBusControllerImpl : public IBusController {
void DoRegisterProperties(IBusPropList* ibus_prop_list) {
VLOG(1) << "RegisterProperties" << (ibus_prop_list ? "" : " (clear)");
ImePropertyList prop_list; // our representation.
InputMethodPropertyList prop_list; // our representation.
if (ibus_prop_list) {
// You can call
// LOG(INFO) << "\n" << PrintPropList(ibus_prop_list, 0);
......@@ -1197,7 +1198,7 @@ class IBusControllerImpl : public IBusController {
// LOG(INFO) << "\n" << PrintProp(ibus_prop, 0);
// here to dump |ibus_prop|.
ImePropertyList prop_list; // our representation.
InputMethodPropertyList prop_list; // our representation.
if (!FlattenProperty(ibus_prop, &prop_list)) {
// Don't update the UI on errors.
LOG(ERROR) << "Malformed properties are detected";
......
......@@ -75,27 +75,22 @@ class InputMethodDescriptor {
std::string language_code_;
};
// A structure which represents a property for an input method engine. For
// details, please check a comment for the LanguageRegisterImePropertiesFunction
// typedef below.
// TODO(yusukes): Rename this struct. "InputMethodProperty" might be better?
struct ImeProperty {
ImeProperty(const std::string& in_key,
// A structure which represents a property for an input method engine.
struct InputMethodProperty {
InputMethodProperty(const std::string& in_key,
const std::string& in_label,
bool in_is_selection_item,
bool in_is_selection_item_checked,
int in_selection_item_id);
ImeProperty();
~ImeProperty();
InputMethodProperty();
~InputMethodProperty();
// Debug print function.
std::string ToString() const;
std::string key; // A key which identifies the property. Non-empty string.
// (e.g. "InputMode.HalfWidthKatakana")
// DEPRECATED: TODO(yusukes): Remove this when it's ready.
std::string deprecated_icon_path;
std::string label; // A description of the property. Non-empty string.
// (e.g. "Switch to full punctuation mode", "Hiragana")
bool is_selection_item; // true if the property is a selection item.
......@@ -106,7 +101,7 @@ struct ImeProperty {
// false.
static const int kInvalidSelectionItemId = -1;
};
typedef std::vector<ImeProperty> ImePropertyList;
typedef std::vector<InputMethodProperty> InputMethodPropertyList;
// A structure which represents a value of an input method configuration item.
// This struct is used by SetInputMethodConfig().
......@@ -167,7 +162,8 @@ class IBusController {
// ----------------------------------
// ...
// ----------------------------------
virtual void OnRegisterImeProperties(const ImePropertyList& prop_list) = 0;
virtual void OnRegisterImeProperties(
const InputMethodPropertyList& prop_list) = 0;
// Called when "UpdateProperty" signal is sent from ibus-daemon. The
// signal contains one or more properties which is updated
......@@ -191,7 +187,8 @@ class IBusController {
//
// Note: Please do not use selection_item_ids in |prop_list|. Dummy
// values are filled in the field.
virtual void OnUpdateImeProperty(const ImePropertyList& prop_list) = 0;
virtual void OnUpdateImeProperty(
const InputMethodPropertyList& prop_list) = 0;
// Called when ibus connects or disconnects.
virtual void OnConnectionChange(bool connected) = 0;
......
......@@ -325,7 +325,7 @@ class IBusUiControllerImpl : public IBusUiController {
private:
std::string GetCurrentInputMethodId() {
InputMethodManager* manager = InputMethodManager::GetInstance();
return manager->current_input_method().id();
return manager->GetCurrentInputMethod().id();
}
IBusUiControllerImpl* ui_;
......
......@@ -113,10 +113,10 @@ const size_t kInputMethodSpecificHotkeySettingsLen =
// Finds a property which has |new_prop.key| from |prop_list|, and replaces the
// property with |new_prop|. Returns true if such a property is found.
bool FindAndUpdateProperty(
const chromeos::input_method::ImeProperty& new_prop,
chromeos::input_method::ImePropertyList* prop_list) {
const chromeos::input_method::InputMethodProperty& new_prop,
chromeos::input_method::InputMethodPropertyList* prop_list) {
for (size_t i = 0; i < prop_list->size(); ++i) {
chromeos::input_method::ImeProperty& prop = prop_list->at(i);
chromeos::input_method::InputMethodProperty& prop = prop_list->at(i);
if (prop.key == new_prop.key) {
const int saved_id = prop.selection_item_id;
// Update the list except the radio id. As written in
......@@ -315,7 +315,7 @@ class InputMethodManagerImpl
// We shouldn't use SetCurrentKeyboardLayoutByName() here. See
// comments at ChangeCurrentInputMethod() for details.
ChangeCurrentInputMethodFromId(input_method_id);
OnRegisterImeProperties(ImePropertyList()); // notify the button.
OnRegisterImeProperties(InputMethodPropertyList()); // notify the button.
} else {
// Otherwise, start the input method daemon, and change the input
// method via the daemon.
......@@ -477,24 +477,24 @@ class InputMethodManagerImpl
}
}
virtual InputMethodDescriptor previous_input_method() const {
virtual InputMethodDescriptor GetPreviousInputMethod() const {
if (previous_input_method_.id().empty()) {
return InputMethodDescriptor::GetFallbackInputMethodDescriptor();
}
return previous_input_method_;
}
virtual InputMethodDescriptor current_input_method() const {
virtual InputMethodDescriptor GetCurrentInputMethod() const {
if (current_input_method_.id().empty()) {
return InputMethodDescriptor::GetFallbackInputMethodDescriptor();
}
return current_input_method_;
}
virtual ImePropertyList current_ime_properties() const {
virtual InputMethodPropertyList GetCurrentInputMethodProperties() const {
if (should_hide_properties_ ||
InputMethodUtil::IsKeyboardLayout(current_input_method().id())) {
return ImePropertyList();
InputMethodUtil::IsKeyboardLayout(GetCurrentInputMethod().id())) {
return InputMethodPropertyList();
}
return current_ime_properties_;
}
......@@ -876,7 +876,7 @@ class InputMethodManagerImpl
const size_t num_active_input_methods = GetNumActiveInputMethods();
FOR_EACH_OBSERVER(InputMethodManager::Observer, observers_,
ActiveInputMethodsChanged(this,
current_input_method(),
GetCurrentInputMethod(),
num_active_input_methods));
}
}
......@@ -1022,7 +1022,7 @@ class InputMethodManagerImpl
// IBusController override.
virtual void OnRegisterImeProperties(
const ImePropertyList& prop_list) {
const InputMethodPropertyList& prop_list) {
// See comments in InputMethodChangedHandler.
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
LOG(ERROR) << "Not on UI thread";
......@@ -1034,7 +1034,7 @@ class InputMethodManagerImpl
// IBusController override.
virtual void OnUpdateImeProperty(
const ImePropertyList& prop_list) {
const InputMethodPropertyList& prop_list) {
// See comments in InputMethodChangedHandler.
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
LOG(ERROR) << "Not on UI thread";
......@@ -1199,7 +1199,7 @@ class InputMethodManagerImpl
}
// Registers the properties used by the current input method.
void RegisterProperties(const ImePropertyList& prop_list) {
void RegisterProperties(const InputMethodPropertyList& prop_list) {
// |prop_list| might be empty. This means "hide properties."
if (prop_list.empty()) {
should_hide_properties_ = true;
......@@ -1209,7 +1209,8 @@ class InputMethodManagerImpl
}
// Update input method menu
FOR_EACH_OBSERVER(InputMethodManager::Observer, observers_,
PropertyListChanged(this, current_ime_properties()));
PropertyListChanged(this,
GetCurrentInputMethodProperties()));
}
// Starts the input method daemon. Unlike MaybeStopInputMethodDaemon(),
......@@ -1221,14 +1222,15 @@ class InputMethodManagerImpl
}
// Updates the properties used by the current input method.
void UpdateProperty(const ImePropertyList& prop_list) {
void UpdateProperty(const InputMethodPropertyList& prop_list) {
for (size_t i = 0; i < prop_list.size(); ++i) {
FindAndUpdateProperty(prop_list[i], &current_ime_properties_);
}
// Update input method menu
FOR_EACH_OBSERVER(InputMethodManager::Observer, observers_,
PropertyListChanged(this, current_ime_properties()));
PropertyListChanged(this,
GetCurrentInputMethodProperties()));
}
// Launches an input method procsess specified by the given command
......@@ -1461,7 +1463,7 @@ class InputMethodManagerImpl
// The input method properties which the current input method uses. The list
// might be empty when no input method is used.
ImePropertyList current_ime_properties_;
InputMethodPropertyList current_ime_properties_;
bool should_hide_properties_;
typedef std::pair<std::string, std::string> ConfigKeyType;
......
......@@ -55,7 +55,7 @@ class InputMethodManager {
// Called when the list of properties is changed.
virtual void PropertyListChanged(
InputMethodManager* manager,
const ImePropertyList& current_ime_properties) = 0;
const InputMethodPropertyList& current_ime_properties) = 0;
};
// CandidateWindowObserver is notified of events related to the candidate
......@@ -269,10 +269,10 @@ class InputMethodManager {
// the |accelerator|.
virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) = 0;
virtual InputMethodDescriptor previous_input_method() const = 0;
virtual InputMethodDescriptor current_input_method() const = 0;
virtual InputMethodDescriptor GetPreviousInputMethod() const = 0;
virtual InputMethodDescriptor GetCurrentInputMethod() const = 0;
virtual ImePropertyList current_ime_properties() const = 0;
virtual InputMethodPropertyList GetCurrentInputMethodProperties() const = 0;
};
} // namespace input_method
......
......@@ -42,99 +42,99 @@ IN_PROC_BROWSER_TEST_F(InputMethodManagerTest, TestEnableInputMethods) {
IN_PROC_BROWSER_TEST_F(InputMethodManagerTest, TestNextInputMethod) {
manager_->EnableInputMethods("en-US", kKeyboardLayoutsOnly, "xkb:us::eng");
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods());
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:dvorak:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:dvorak:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:colemak:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:colemak:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
}
IN_PROC_BROWSER_TEST_F(InputMethodManagerTest, TestPreviousInputMethod) {
manager_->EnableInputMethods("en-US", kKeyboardLayoutsOnly, "xkb:us::eng");
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods());
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us:intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToNextInputMethod();
EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us:intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id());
}
IN_PROC_BROWSER_TEST_F(InputMethodManagerTest, TestSwitchInputMethod) {
manager_->EnableInputMethods("en-US", kKeyboardLayoutsOnly, "xkb:us::eng");
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods());
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
// Henkan, Muhenkan, ZenkakuHankaku should be ignored when no Japanese IMEs
// and keyboards are enabled.
EXPECT_FALSE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_CONVERT, false, false, false)));
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_FALSE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_NONCONVERT, false, false, false)));
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_FALSE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_DBE_SBCSCHAR, false, false, false)));
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_FALSE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_DBE_DBCSCHAR, false, false, false)));
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
// Do the same tests for Korean.
EXPECT_FALSE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_HANGUL, false, false, false)));
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_FALSE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_SPACE, true, false, false)));
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
// Enable "xkb:jp::jpn" and press Muhenkan/ZenkakuHankaku.
manager_->EnableInputMethods("ja", kKeyboardLayoutsOnly, "xkb:us::eng");
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods());
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_TRUE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_NONCONVERT, false, false, false)));
EXPECT_EQ("xkb:jp::jpn", manager_->current_input_method().id());
EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_TRUE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_DBE_SBCSCHAR, false, false, false)));
EXPECT_EQ("xkb:jp::jpn", manager_->current_input_method().id());
EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_TRUE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_DBE_DBCSCHAR, false, false, false)));
EXPECT_EQ("xkb:jp::jpn", manager_->current_input_method().id());
EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id());
// Do the same tests for Korean.
manager_->EnableInputMethods("ko", kKeyboardLayoutsOnly, "xkb:us::eng");
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods());
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_TRUE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_HANGUL, false, false, false)));
EXPECT_EQ("xkb:kr:kr104:kor", manager_->current_input_method().id());
EXPECT_EQ("xkb:kr:kr104:kor", manager_->GetCurrentInputMethod().id());
manager_->SwitchToPreviousInputMethod();
EXPECT_EQ("xkb:us::eng", manager_->current_input_method().id());
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id());
EXPECT_TRUE(manager_->SwitchInputMethod(
ui::Accelerator(ui::VKEY_SPACE, true, false, false)));
EXPECT_EQ("xkb:kr:kr104:kor", manager_->current_input_method().id());
EXPECT_EQ("xkb:kr:kr104:kor", manager_->GetCurrentInputMethod().id());
}
} // namespace input_method
......
......@@ -1108,7 +1108,7 @@ void LoginUtilsImpl::SetFirstLoginPrefs(PrefService* prefs) {
input_method::InputMethodManager::GetInstance();
std::vector<std::string> input_method_ids;
manager->GetInputMethodUtil()->GetFirstLoginInputMethodIds(
locale, manager->current_input_method(), &input_method_ids);
locale, manager->GetCurrentInputMethod(), &input_method_ids);
// Save the input methods in the user's preferences.
StringPrefMember language_preload_engines;
language_preload_engines.Init(prefs::kLanguagePreloadEngines,
......
......@@ -128,8 +128,8 @@ class ScreenLockObserver : public chromeos::PowerManagerClient::Observer,
chromeos::input_method::InputMethodManager* manager =
chromeos::input_method::InputMethodManager::GetInstance();
saved_previous_input_method_id_ = manager->previous_input_method().id();
saved_current_input_method_id_ = manager->current_input_method().id();
saved_previous_input_method_id_ = manager->GetPreviousInputMethod().id();
saved_current_input_method_id_ = manager->GetCurrentInputMethod().id();
scoped_ptr<chromeos::input_method::InputMethodDescriptors>
active_input_method_list(manager->GetActiveInputMethods());
......
......@@ -210,12 +210,12 @@ bool InputMethodMenu::IsItemCheckedAt(int index) const {
const input_method::InputMethodDescriptor& input_method
= input_method_descriptors_->at(index);
return input_method == InputMethodManager::GetInstance()->
current_input_method();
GetCurrentInputMethod();
}
if (GetPropertyIndex(index, &index)) {
const input_method::ImePropertyList& property_list
= InputMethodManager::GetInstance()->current_ime_properties();
const input_method::InputMethodPropertyList& property_list
= InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
return property_list.at(index).is_selection_item_checked;
}
......@@ -232,8 +232,8 @@ int InputMethodMenu::GetGroupIdAt(int index) const {
}
if (GetPropertyIndex(index, &index)) {
const input_method::ImePropertyList& property_list
= InputMethodManager::GetInstance()->current_ime_properties();
const input_method::InputMethodPropertyList& property_list
= InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
return property_list.at(index).selection_item_id;
}
......@@ -299,8 +299,8 @@ ui::MenuModel::ItemType InputMethodMenu::GetTypeAt(int index) const {
}
if (GetPropertyIndex(index, &index)) {
const input_method::ImePropertyList& property_list
= InputMethodManager::GetInstance()->current_ime_properties();
const input_method::InputMethodPropertyList& property_list
= InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
if (property_list.at(index).is_selection_item) {
return ui::MenuModel::TYPE_RADIO;
}
......@@ -325,8 +325,8 @@ string16 InputMethodMenu::GetLabelAt(int index) const {
name = GetTextForMenu(input_method_descriptors_->at(index));
} else if (GetPropertyIndex(index, &index)) {
InputMethodManager* manager = InputMethodManager::GetInstance();
const input_method::ImePropertyList& property_list =
manager->current_ime_properties();
const input_method::InputMethodPropertyList& property_list =
manager->GetCurrentInputMethodProperties();
return manager->GetInputMethodUtil()->TranslateString(
property_list.at(index).label);
}
......@@ -356,8 +356,8 @@ void InputMethodMenu::ActivatedAt(int index) {
if (GetPropertyIndex(index, &index)) {
// Intra-IME switching (e.g. Japanese-Hiragana to Japanese-Katakana).
const input_method::ImePropertyList& property_list
= InputMethodManager::GetInstance()->current_ime_properties();
const input_method::InputMethodPropertyList& property_list
= InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
const std::string key = property_list.at(index).key;
if (property_list.at(index).is_selection_item) {
// Radio button is clicked.
......@@ -437,7 +437,7 @@ void InputMethodMenu::PreferenceUpdateNeeded(
void InputMethodMenu::PropertyListChanged(
InputMethodManager* manager,
const input_method::ImePropertyList& current_ime_properties) {
const input_method::InputMethodPropertyList& current_ime_properties) {
// Usual order of notifications of input method change is:
// 1. RegisterProperties(empty)
// 2. RegisterProperties(list-of-new-properties)
......@@ -452,7 +452,7 @@ void InputMethodMenu::PropertyListChanged(
// awkward clear-then-register behavior.
if (!current_ime_properties.empty()) {
const input_method::InputMethodDescriptor& input_method =
manager->current_input_method();
manager->GetCurrentInputMethod();
size_t num_active_input_methods = manager->GetNumActiveInputMethods();
UpdateUIFromInputMethod(input_method, num_active_input_methods);
}
......@@ -526,8 +526,8 @@ void InputMethodMenu::RebuildModel() {
need_separator = true;
}
const input_method::ImePropertyList& property_list
= InputMethodManager::GetInstance()->current_ime_properties();
const input_method::InputMethodPropertyList& property_list
= InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
if (!property_list.empty()) {
if (need_separator) {
model_->AddSeparator();
......@@ -576,8 +576,8 @@ bool InputMethodMenu::GetPropertyIndex(int index, int* property_index) const {
if ((model_->GetTypeAt(index) == ui::MenuModel::TYPE_RADIO) &&
(model_->GetCommandIdAt(index) == COMMAND_ID_IME_PROPERTIES)) {
const int tmp_property_index = model_->GetGroupIdAt(index);
const input_method::ImePropertyList& property_list
= InputMethodManager::GetInstance()->current_ime_properties();
const input_method::InputMethodPropertyList& property_list
= InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
if (tmp_property_index < static_cast<int>(property_list.size())) {
*property_index = tmp_property_index;
return true;
......@@ -699,7 +699,7 @@ void InputMethodMenu::Observe(int type,
InitializePrefMembers();
AddObservers();
InputMethodManager* manager = InputMethodManager::GetInstance();
UpdateUIFromInputMethod(manager->current_input_method(),
UpdateUIFromInputMethod(manager->GetCurrentInputMethod(),
manager->GetNumActiveInputMethods());
}
#endif
......
......@@ -84,7 +84,7 @@ class InputMethodMenu
size_t num_active_input_methods) OVERRIDE;
virtual void PropertyListChanged(
input_method::InputMethodManager* manager,
const input_method::ImePropertyList& current_ime_properties) OVERRIDE;
const input_method::InputMethodPropertyList& properties) OVERRIDE;
// InputMethodManager::PreferenceObserver implementation.
virtual void PreferenceUpdateNeeded(
......
......@@ -152,7 +152,7 @@ void InputMethodMenuButton::UpdateUIFromCurrentInputMethod() {
input_method::InputMethodManager* input_method_manager =
input_method::InputMethodManager::GetInstance();
const input_method::InputMethodDescriptor& input_method =
input_method_manager->current_input_method();
input_method_manager->GetCurrentInputMethod();
const string16 name = InputMethodMenu::GetTextForIndicator(input_method);
const string16 tooltip = InputMethodMenu::GetTextForMenu(input_method);
const size_t num_active_input_methods =
......
......@@ -85,7 +85,7 @@ class InputMethodObserver : public input_method::InputMethodManager::Observer {
}
virtual void PropertyListChanged(
input_method::InputMethodManager* manager,
const input_method::ImePropertyList& current_ime_properties) OVERRIDE {
const input_method::InputMethodPropertyList& properties) OVERRIDE {
}
std::string current_input_method_id_;
......
......@@ -26,7 +26,7 @@ bool GetInputMethodFunction::RunImpl() {
chromeos::input_method::InputMethodManager* manager =
chromeos::input_method::InputMethodManager::GetInstance();
const std::string input_method =
router->GetInputMethodForXkb(manager->current_input_method().id());
router->GetInputMethodForXkb(manager->GetCurrentInputMethod().id());
result_.reset(Value::CreateStringValue(input_method));
return true;
#endif
......
......@@ -267,7 +267,7 @@ void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) {
chromeos::input_method::InputMethodManager* manager =
chromeos::input_method::InputMethodManager::GetInstance();
const chromeos::input_method::InputMethodDescriptor& descriptor =
manager->current_input_method();
manager->GetCurrentInputMethod();
StringValue param(descriptor.id());
web_ui()->CallJavascriptFunction("initKeyboardOverlayId", param);
}
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 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.
......@@ -222,7 +222,7 @@ ListValue* NetworkScreenHandler::GetInputMethods() {
input_method::InputMethodManager::GetInstance();
scoped_ptr<input_method::InputMethodDescriptors> input_methods(
manager->GetActiveInputMethods());
std::string current_input_method_id = manager->current_input_method().id();
std::string current_input_method_id = manager->GetCurrentInputMethod().id();
for (size_t i = 0; i < input_methods->size(); ++i) {
DictionaryValue* input_method = new DictionaryValue;
input_method->SetString("value", input_methods->at(i).id());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment