summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller.h11
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller_base.cc28
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller_base.h22
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc105
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller_impl.cc107
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller_impl.h35
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller_unittest.cc7
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager_impl.cc13
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager_impl.h4
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc22
-rw-r--r--chrome/browser/chromeos/input_method/mock_ibus_controller.cc14
-rw-r--r--chrome/browser/chromeos/input_method/mock_ibus_controller.h11
-rw-r--r--chrome/browser/chromeos/input_method/mock_input_method_manager.cc7
-rw-r--r--chrome/browser/chromeos/input_method/mock_input_method_manager.h4
-rw-r--r--chrome/browser/chromeos/preferences.cc150
-rw-r--r--chrome/browser/chromeos/preferences.h25
-rw-r--r--chrome/browser/chromeos/preferences_unittest.cc10
17 files changed, 13 insertions, 562 deletions
diff --git a/chrome/browser/chromeos/input_method/ibus_controller.h b/chrome/browser/chromeos/input_method/ibus_controller.h
index 0c3830a..1645b08 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller.h
+++ b/chrome/browser/chromeos/input_method/ibus_controller.h
@@ -12,14 +12,11 @@
namespace chromeos {
namespace input_method {
-struct InputMethodConfigValue;
struct InputMethodProperty;
typedef std::vector<InputMethodProperty> InputMethodPropertyList;
// IBusController is used to interact with the system input method framework
// (which is currently IBus).
-// TODO(nona): Split this class into IBusPropertyHandler and IBusConfigHandler.
-// Note: IBusConfig will be deprecated once ibus-daemon is gone.
class IBusController {
public:
class Observer {
@@ -39,14 +36,6 @@ class IBusController {
virtual void ClearProperties() = 0;
- // Sets a configuration of an input method engine. Returns true if the
- // configuration is successfully set. For example, when you set
- // "engine/Mozc/history_learning_level", |section| should be "engine/Mozc",
- // and |config_name| should be "history_learning_level".
- virtual bool SetInputMethodConfig(const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) = 0;
-
// Activates the input method property specified by the |key|. Returns true on
// success.
virtual bool ActivateInputMethodProperty(const std::string& key) = 0;
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_base.cc b/chrome/browser/chromeos/input_method/ibus_controller_base.cc
index be8592b..0f16084 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_base.cc
+++ b/chrome/browser/chromeos/input_method/ibus_controller_base.cc
@@ -21,39 +21,11 @@ void IBusControllerBase::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
-bool IBusControllerBase::SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) {
- DCHECK(!section.empty());
- DCHECK(!config_name.empty());
-
- const ConfigKeyType key(section, config_name);
- if (!SetInputMethodConfigInternal(key, value))
- return false;
- current_config_values_[key] = value;
- return true;
-}
-
const InputMethodPropertyList&
IBusControllerBase::GetCurrentProperties() const {
return current_property_list_;
}
-bool IBusControllerBase::GetInputMethodConfigForTesting(
- const std::string& section,
- const std::string& config_name,
- InputMethodConfigValue* out_value) {
- DCHECK(out_value);
- const ConfigKeyType key(section, config_name);
- InputMethodConfigRequests::const_iterator iter =
- current_config_values_.find(key);
- if (iter == current_config_values_.end())
- return false;
- *out_value = iter->second;
- return true;
-}
-
void IBusControllerBase::ClearProperties() {
current_property_list_.clear();
}
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_base.h b/chrome/browser/chromeos/input_method/ibus_controller_base.h
index 2503b51..83b0f93 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_base.h
+++ b/chrome/browser/chromeos/input_method/ibus_controller_base.h
@@ -10,7 +10,6 @@
#include "base/observer_list.h"
#include "chrome/browser/chromeos/input_method/ibus_controller.h"
-#include "chromeos/ime/input_method_config.h"
#include "chromeos/ime/input_method_property.h"
namespace chromeos {
@@ -27,18 +26,9 @@ class IBusControllerBase : public IBusController {
// functions.
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
- virtual bool SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) OVERRIDE;
virtual const InputMethodPropertyList& GetCurrentProperties() const OVERRIDE;
virtual void ClearProperties() OVERRIDE;
- // Gets the current input method configuration.
- bool GetInputMethodConfigForTesting(const std::string& section,
- const std::string& config_name,
- InputMethodConfigValue* out_value);
-
// Notifies all |observers_|.
void NotifyPropertyChangedForTesting();
@@ -47,20 +37,8 @@ class IBusControllerBase : public IBusController {
const InputMethodPropertyList& current_property_list);
protected:
- typedef std::pair<std::string, std::string> ConfigKeyType;
- typedef std::map<
- ConfigKeyType, InputMethodConfigValue> InputMethodConfigRequests;
-
- virtual bool SetInputMethodConfigInternal(
- const ConfigKeyType& key,
- const InputMethodConfigValue& value) = 0;
-
ObserverList<Observer> observers_;
- // Values that have been set via SetInputMethodConfig(). We keep a copy
- // available to (re)send when the system input method framework (re)starts.
- InputMethodConfigRequests current_config_values_;
-
// The value which will be returned by GetCurrentProperties(). Derived classes
// should update this variable when needed.
InputMethodPropertyList current_property_list_;
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc b/chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc
index 611cf3d..353b109 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc
+++ b/chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc
@@ -5,7 +5,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/input_method/ibus_controller_base.h"
-#include "chromeos/ime/input_method_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
@@ -17,9 +16,7 @@ namespace {
// RemoveObserver() methods in IBusControllerBase.
class TestIBusController : public IBusControllerBase {
public:
- TestIBusController()
- : set_input_method_config_internal_count_(0),
- set_input_method_config_internal_return_(true) {
+ TestIBusController() {
}
virtual ~TestIBusController() {
}
@@ -34,28 +31,7 @@ class TestIBusController : public IBusControllerBase {
return observers_.size();
}
- int set_input_method_config_internal_count() const {
- return set_input_method_config_internal_count_;
- }
- void set_set_input_method_config_internal_return(bool new_value) {
- set_input_method_config_internal_return_ = new_value;
- }
- const ConfigKeyType& last_key() const { return last_key_; }
-
- protected:
- virtual bool SetInputMethodConfigInternal(
- const ConfigKeyType& key,
- const InputMethodConfigValue& value) OVERRIDE {
- ++set_input_method_config_internal_count_;
- last_key_ = key;
- return set_input_method_config_internal_return_;
- }
-
private:
- int set_input_method_config_internal_count_;
- bool set_input_method_config_internal_return_;
- ConfigKeyType last_key_;
-
DISALLOW_COPY_AND_ASSIGN(TestIBusController);
};
@@ -80,85 +56,6 @@ class IBusControllerBaseTest : public testing::Test {
} // namespace
-TEST_F(IBusControllerBaseTest, TestSetInputMethodConfig) {
- InputMethodConfigValue value_set;
- InputMethodConfigValue value_get;
- EXPECT_FALSE(controller_->GetInputMethodConfigForTesting("section",
- "name",
- &value_get));
- EXPECT_EQ(0, controller_->set_input_method_config_internal_count());
-
- // Set a value.
- value_set.type = InputMethodConfigValue::kValueTypeInt;
- value_set.int_value = 12345;
- EXPECT_TRUE(controller_->SetInputMethodConfig("section",
- "name",
- value_set));
- EXPECT_EQ(1, controller_->set_input_method_config_internal_count());
- EXPECT_EQ("section", controller_->last_key().first);
- EXPECT_EQ("name", controller_->last_key().second);
-
- // Get the value.
- EXPECT_TRUE(controller_->GetInputMethodConfigForTesting("section",
- "name",
- &value_get));
- EXPECT_EQ(value_set.type, value_get.type);
- EXPECT_EQ(value_set.int_value, value_get.int_value);
-
- // Set another value.
- value_set.type = InputMethodConfigValue::kValueTypeBool;
- value_set.bool_value = true;
- EXPECT_TRUE(controller_->SetInputMethodConfig("section/2",
- "name2",
- value_set));
- EXPECT_EQ(2, controller_->set_input_method_config_internal_count());
- EXPECT_EQ("section/2", controller_->last_key().first);
- EXPECT_EQ("name2", controller_->last_key().second);
-
- // Overwrite the first value.
- value_set.type = InputMethodConfigValue::kValueTypeInt;
- value_set.int_value = 54321;
- EXPECT_TRUE(controller_->SetInputMethodConfig("section",
- "name",
- value_set));
- EXPECT_EQ(3, controller_->set_input_method_config_internal_count());
- EXPECT_EQ("section", controller_->last_key().first);
- EXPECT_EQ("name", controller_->last_key().second);
-
- // Get the value.
- EXPECT_TRUE(controller_->GetInputMethodConfigForTesting("section",
- "name",
- &value_get));
- EXPECT_EQ(value_set.type, value_get.type);
- EXPECT_EQ(value_set.int_value, value_get.int_value);
-
- // Get a non existent value.
- EXPECT_FALSE(controller_->GetInputMethodConfigForTesting("sectionX",
- "name",
- &value_get));
- EXPECT_FALSE(controller_->GetInputMethodConfigForTesting("section",
- "nameX",
- &value_get));
-}
-
-TEST_F(IBusControllerBaseTest, TestSetInputMethodConfigInternal) {
- InputMethodConfigValue value_set;
- InputMethodConfigValue value_get;
- // Set a value. In this case, SetInputMethodConfigInternal returns false.
- controller_->set_set_input_method_config_internal_return(false);
- value_set.type = InputMethodConfigValue::kValueTypeInt;
- value_set.int_value = 12345;
- EXPECT_FALSE(controller_->SetInputMethodConfig("section",
- "name",
- value_set));
- EXPECT_EQ(1, controller_->set_input_method_config_internal_count());
-
- // Getting the value should fail.
- EXPECT_FALSE(controller_->GetInputMethodConfigForTesting("section",
- "name",
- &value_get));
-}
-
TEST_F(IBusControllerBaseTest, TestAddRemoveObserver) {
TestObserver observer1;
TestObserver observer2;
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc
index 5cb4461..1bd85f9 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc
+++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc
@@ -22,16 +22,11 @@
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/ibus/ibus_client.h"
-#include "chromeos/dbus/ibus/ibus_config_client.h"
-#include "chromeos/dbus/ibus/ibus_constants.h"
-#include "chromeos/dbus/ibus/ibus_input_context_client.h"
-#include "chromeos/dbus/ibus/ibus_panel_service.h"
#include "chromeos/dbus/ibus/ibus_property.h"
#include "chromeos/ime/component_extension_ime_manager.h"
#include "chromeos/ime/extension_ime_util.h"
#include "chromeos/ime/ibus_bridge.h"
+#include "chromeos/ime/ime_constants.h"
#include "chromeos/ime/input_method_config.h"
#include "chromeos/ime/input_method_property.h"
#include "ui/aura/client/aura_constants.h"
@@ -55,10 +50,6 @@ bool FindAndUpdateProperty(
return false;
}
-void ConfigSetValueErrorCallback() {
- DVLOG(1) << "IBusConfig: SetValue is failed.";
-}
-
} // namespace
namespace chromeos {
@@ -190,21 +181,15 @@ bool FlattenPropertyList(const IBusPropertyList& ibus_prop_list,
} // namespace
-IBusControllerImpl::IBusControllerImpl()
- : weak_ptr_factory_(this) {
- IBusDaemonController::GetInstance()->AddObserver(this);
+IBusControllerImpl::IBusControllerImpl() {
+ IBusBridge::Get()->SetPropertyHandler(this);
}
IBusControllerImpl::~IBusControllerImpl() {
- IBusDaemonController::GetInstance()->RemoveObserver(this);
+ IBusBridge::Get()->SetPropertyHandler(NULL);
}
bool IBusControllerImpl::ActivateInputMethodProperty(const std::string& key) {
- if (!IBusConnectionsAreAlive()) {
- DVLOG(1) << "ActivateInputMethodProperty: IBus connection is not alive";
- return false;
- }
-
// The third parameter of ibus_input_context_property_activate() has to be
// true when the |key| points to a radio button. false otherwise.
bool is_radio = true;
@@ -220,68 +205,13 @@ bool IBusControllerImpl::ActivateInputMethodProperty(const std::string& key) {
return false;
}
- IBusInputContextClient* client
- = DBusThreadManager::Get()->GetIBusInputContextClient();
- if (client)
- client->PropertyActivate(key,
+ IBusEngineHandlerInterface* engine = IBusBridge::Get()->GetEngineHandler();
+ if (engine)
+ engine->PropertyActivate(key,
static_cast<ibus::IBusPropertyState>(is_radio));
return true;
}
-bool IBusControllerImpl::IBusConnectionsAreAlive() {
- return DBusThreadManager::Get() &&
- DBusThreadManager::Get()->GetIBusBus() != NULL;
-}
-
-bool IBusControllerImpl::SetInputMethodConfigInternal(
- const ConfigKeyType& key,
- const InputMethodConfigValue& value) {
- if (value.type != InputMethodConfigValue::kValueTypeString &&
- value.type != InputMethodConfigValue::kValueTypeInt &&
- value.type != InputMethodConfigValue::kValueTypeBool &&
- value.type != InputMethodConfigValue::kValueTypeStringList) {
- DVLOG(1) << "SendInputMethodConfig: unknown value.type";
- return false;
- }
-
- IBusConfigClient* client = DBusThreadManager::Get()->GetIBusConfigClient();
- if (!client) {
- // Should return true if the ibus-memconf is not ready to use, otherwise IME
- // configuration will not be initialized.
- return true;
- }
-
- switch (value.type) {
- case InputMethodConfigValue::kValueTypeString:
- client->SetStringValue(key.first,
- key.second,
- value.string_value,
- base::Bind(&ConfigSetValueErrorCallback));
- return true;
- case InputMethodConfigValue::kValueTypeInt:
- client->SetIntValue(key.first,
- key.second,
- value.int_value,
- base::Bind(&ConfigSetValueErrorCallback));
- return true;
- case InputMethodConfigValue::kValueTypeBool:
- client->SetBoolValue(key.first,
- key.second,
- value.bool_value,
- base::Bind(&ConfigSetValueErrorCallback));
- return true;
- case InputMethodConfigValue::kValueTypeStringList:
- client->SetStringListValue(key.first,
- key.second,
- value.string_list_value,
- base::Bind(&ConfigSetValueErrorCallback));
- return true;
- default:
- NOTREACHED() << "SendInputMethodConfig: unknown value.type";
- return false;
- }
-}
-
void IBusControllerImpl::RegisterProperties(
const IBusPropertyList& ibus_prop_list) {
current_property_list_.clear();
@@ -307,29 +237,6 @@ void IBusControllerImpl::UpdateProperty(const IBusProperty& ibus_prop) {
}
}
-void IBusControllerImpl::OnIBusConfigClientInitialized() {
- DCHECK(thread_checker_.CalledOnValidThread());
- InputMethodConfigRequests::const_iterator iter =
- current_config_values_.begin();
- for (; iter != current_config_values_.end(); ++iter) {
- SetInputMethodConfigInternal(iter->first, iter->second);
- }
-}
-
-void IBusControllerImpl::OnConnected() {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- DBusThreadManager::Get()->GetIBusPanelService()->SetUpPropertyHandler(this);
-
- DBusThreadManager::Get()->GetIBusConfigClient()->InitializeAsync(
- base::Bind(&IBusControllerImpl::OnIBusConfigClientInitialized,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void IBusControllerImpl::OnDisconnected() {
- DBusThreadManager::Get()->GetIBusPanelService()->SetUpPropertyHandler(NULL);
-}
-
// static
bool IBusControllerImpl::FindAndUpdatePropertyForTesting(
const chromeos::input_method::InputMethodProperty& new_prop,
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.h b/chrome/browser/chromeos/input_method/ibus_controller_impl.h
index 486094f..e262e8d 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_impl.h
+++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.h
@@ -8,20 +8,12 @@
#include <string>
#include <vector>
-#include "base/threading/thread_checker.h"
#include "chrome/browser/chromeos/input_method/ibus_controller_base.h"
-#include "chromeos/dbus/ibus/ibus_panel_service.h"
#include "chromeos/ime/ibus_bridge.h"
-#include "chromeos/ime/ibus_daemon_controller.h"
-
-namespace ui {
-class InputMethodIBus;
-} // namespace ui
namespace chromeos {
namespace input_method {
-struct InputMethodConfigValue;
struct InputMethodProperty;
typedef std::vector<InputMethodProperty> InputMethodPropertyList;
@@ -29,8 +21,7 @@ typedef std::vector<InputMethodProperty> InputMethodPropertyList;
// TODO(nona): Merge to IBusControllerBase, there is no longer reason to split
// this class into Impl and Base.
class IBusControllerImpl : public IBusControllerBase,
- public IBusPanelPropertyHandlerInterface,
- public IBusDaemonController::Observer {
+ public IBusPanelPropertyHandlerInterface {
public:
IBusControllerImpl();
virtual ~IBusControllerImpl();
@@ -45,35 +36,11 @@ class IBusControllerImpl : public IBusControllerBase,
InputMethodPropertyList* prop_list);
private:
- // IBusDaemonController overrides:
- virtual void OnConnected() OVERRIDE;
- virtual void OnDisconnected() OVERRIDE;
-
- // IBusControllerBase overrides:
- virtual bool SetInputMethodConfigInternal(
- const ConfigKeyType& key,
- const InputMethodConfigValue& value) OVERRIDE;
-
// IBusPanelPropertyHandlerInterface overrides:
virtual void RegisterProperties(
const IBusPropertyList& properties) OVERRIDE;
virtual void UpdateProperty(const IBusProperty& property) OVERRIDE;
- // Checks if |ibus_| and |ibus_config_| connections are alive.
- bool IBusConnectionsAreAlive();
-
- // Called when the IBusConfigClient is initialized.
- void OnIBusConfigClientInitialized();
-
- // Current input context path.
- std::string current_input_context_path_;
-
- // IBusControllerImpl should be used only on UI thread.
- base::ThreadChecker thread_checker_;
-
- // Used for making callbacks for PostTask.
- base::WeakPtrFactory<IBusControllerImpl> weak_ptr_factory_;
-
DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl);
};
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_unittest.cc b/chrome/browser/chromeos/input_method/ibus_controller_unittest.cc
index fd32f51..7b74d96 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_unittest.cc
+++ b/chrome/browser/chromeos/input_method/ibus_controller_unittest.cc
@@ -5,20 +5,19 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/input_method/ibus_controller.h"
-#include "chromeos/ime/mock_ibus_daemon_controller.h"
+#include "chromeos/ime/ibus_bridge.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
namespace input_method {
TEST(IBusControllerTest, TestCreate) {
- chromeos::IBusDaemonController::InitializeForTesting(
- new chromeos::MockIBusDaemonController());
+ IBusBridge::Initialize();
{
scoped_ptr<IBusController> controller(IBusController::Create());
EXPECT_TRUE(controller.get());
}
- chromeos::IBusDaemonController::Shutdown();
+ IBusBridge::Shutdown();
}
} // namespace input_method
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 20fba08..5a41b15 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -381,19 +381,6 @@ bool InputMethodManagerImpl::MigrateKoreanKeyboard(
return false;
}
-bool InputMethodManagerImpl::SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) {
- DCHECK(section != language_prefs::kGeneralSectionName ||
- config_name != language_prefs::kPreloadEnginesConfigName);
-
- if (state_ == STATE_TERMINATING)
- return false;
-
- return ibus_controller_->SetInputMethodConfig(section, config_name, value);
-}
-
void InputMethodManagerImpl::ChangeInputMethod(
const std::string& input_method_id) {
ChangeInputMethodInternal(input_method_id, false);
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 1d0d417..88f1875 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h
@@ -73,10 +73,6 @@ class InputMethodManagerImpl : public InputMethodManager,
virtual bool MigrateKoreanKeyboard(
const std::string& keyboard_id,
std::vector<std::string>* input_method_ids) OVERRIDE;
- virtual bool SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) OVERRIDE;
virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE;
virtual void ActivateInputMethodProperty(const std::string& key) OVERRIDE;
virtual void AddInputMethodExtension(
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 d0547bd..e68fe3e 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
@@ -346,28 +346,6 @@ TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) {
EXPECT_TRUE(Contain(*methods.get(), *id_to_find));
}
-TEST_F(InputMethodManagerImplTest, TestSetInputMethodConfig) {
- InputMethodConfigValue config;
- config.type = InputMethodConfigValue::kValueTypeString;
- config.string_value = "string";
- EXPECT_EQ(0, controller_->set_input_method_config_internal_count_);
- EXPECT_TRUE(manager_->SetInputMethodConfig("section", "name", config));
- EXPECT_EQ(1, controller_->set_input_method_config_internal_count_);
- EXPECT_EQ("section",
- controller_->set_input_method_config_internal_key_.first);
- EXPECT_EQ("name",
- controller_->set_input_method_config_internal_key_.second);
- EXPECT_EQ(config.type,
- controller_->set_input_method_config_internal_value_.type);
- EXPECT_EQ(config.string_value,
- controller_->set_input_method_config_internal_value_.string_value);
-
- // SetInputMethodConfig should be no-op in STATE_TERMINATING.
- manager_->SetState(InputMethodManager::STATE_TERMINATING);
- EXPECT_FALSE(manager_->SetInputMethodConfig("section", "name", config));
- EXPECT_EQ(1, controller_->set_input_method_config_internal_count_);
-}
-
TEST_F(InputMethodManagerImplTest, TestEnableTwoLayouts) {
// For http://crbug.com/19655#c11 - (8), step 6.
TestObserver observer;
diff --git a/chrome/browser/chromeos/input_method/mock_ibus_controller.cc b/chrome/browser/chromeos/input_method/mock_ibus_controller.cc
index 05f067c..babc5d9 100644
--- a/chrome/browser/chromeos/input_method/mock_ibus_controller.cc
+++ b/chrome/browser/chromeos/input_method/mock_ibus_controller.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/input_method/mock_ibus_controller.h"
-#include "chromeos/ime/input_method_config.h"
#include "chromeos/ime/input_method_property.h"
namespace chromeos {
@@ -12,9 +11,7 @@ namespace input_method {
MockIBusController::MockIBusController()
: activate_input_method_property_count_(0),
- activate_input_method_property_return_(true),
- set_input_method_config_internal_count_(0),
- set_input_method_config_internal_return_(true) {
+ activate_input_method_property_return_(true) {
}
MockIBusController::~MockIBusController() {
@@ -26,14 +23,5 @@ bool MockIBusController::ActivateInputMethodProperty(const std::string& key) {
return activate_input_method_property_return_;
}
-bool MockIBusController::SetInputMethodConfigInternal(
- const ConfigKeyType& key,
- const InputMethodConfigValue& value) {
- ++set_input_method_config_internal_count_;
- set_input_method_config_internal_key_ = key;
- set_input_method_config_internal_value_ = value;
- return set_input_method_config_internal_return_;
-}
-
} // namespace input_method
} // namespace chromeos
diff --git a/chrome/browser/chromeos/input_method/mock_ibus_controller.h b/chrome/browser/chromeos/input_method/mock_ibus_controller.h
index c405d8e..e27c336 100644
--- a/chrome/browser/chromeos/input_method/mock_ibus_controller.h
+++ b/chrome/browser/chromeos/input_method/mock_ibus_controller.h
@@ -10,7 +10,6 @@
namespace chromeos {
namespace input_method {
-struct InputMethodConfigValue;
struct InputMethodProperty;
// Mock IBusController implementation.
@@ -26,16 +25,6 @@ class MockIBusController : public IBusControllerBase {
int activate_input_method_property_count_;
std::string activate_input_method_property_key_;
bool activate_input_method_property_return_;
- int set_input_method_config_internal_count_;
- ConfigKeyType set_input_method_config_internal_key_;
- InputMethodConfigValue set_input_method_config_internal_value_;
- bool set_input_method_config_internal_return_;
-
- protected:
- // IBusControllerBase overrides:
- virtual bool SetInputMethodConfigInternal(
- const ConfigKeyType& key,
- const InputMethodConfigValue& value) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(MockIBusController);
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 4aeef61..da3369414 100644
--- a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc
+++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.cc
@@ -85,13 +85,6 @@ bool MockInputMethodManager::MigrateKoreanKeyboard(
return false;
}
-bool MockInputMethodManager::SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) {
- return true;
-}
-
void MockInputMethodManager::ChangeInputMethod(
const std::string& input_method_id) {
}
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 5db4950..0534b8a 100644
--- a/chrome/browser/chromeos/input_method/mock_input_method_manager.h
+++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.h
@@ -45,10 +45,6 @@ class MockInputMethodManager : public InputMethodManager {
virtual bool MigrateKoreanKeyboard(
const std::string& keyboard_id,
std::vector<std::string>* input_method_ids) OVERRIDE;
- virtual bool SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const InputMethodConfigValue& value) OVERRIDE;
virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE;
virtual void ActivateInputMethodProperty(const std::string& key) OVERRIDE;
virtual void AddInputMethodExtension(
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 00f5cd0..a031a16 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -656,113 +656,6 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) {
input_method_manager_->SetEnabledExtensionImes(&split_values);
}
- // Do not check |*pref_name| of the prefs for remembering current/previous
- // input methods here. We're only interested in initial values of the prefs.
-
- // TODO(nona): remove all IME preference entries. crbug.com/256102
- for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kChewingBooleanPrefs[i].pref_name) {
- SetLanguageConfigBoolean(
- language_prefs::kChewingSectionName,
- language_prefs::kChewingBooleanPrefs[i].ibus_config_name,
- chewing_boolean_prefs_[i].GetValue());
- }
- }
- for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
- if (!pref_name ||
- *pref_name ==
- language_prefs::kChewingMultipleChoicePrefs[i].pref_name) {
- SetLanguageConfigString(
- language_prefs::kChewingSectionName,
- language_prefs::kChewingMultipleChoicePrefs[i].ibus_config_name,
- chewing_multiple_choice_prefs_[i].GetValue());
- }
- }
- if (!pref_name ||
- *pref_name == language_prefs::kChewingHsuSelKeyType.pref_name) {
- SetLanguageConfigInteger(
- language_prefs::kChewingSectionName,
- language_prefs::kChewingHsuSelKeyType.ibus_config_name,
- chewing_hsu_sel_key_type_.GetValue());
- }
- for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kChewingIntegerPrefs[i].pref_name) {
- SetLanguageConfigInteger(
- language_prefs::kChewingSectionName,
- language_prefs::kChewingIntegerPrefs[i].ibus_config_name,
- chewing_integer_prefs_[i].GetValue());
- }
- }
- if (!pref_name ||
- *pref_name == prefs::kLanguageHangulKeyboard) {
- std::vector<std::string> new_input_method_ids;
- if (input_method_manager_->MigrateKoreanKeyboard(
- hangul_keyboard_.GetValue(),
- &new_input_method_ids)) {
- preload_engines_.SetValue(JoinString(new_input_method_ids, ','));
- hangul_keyboard_.SetValue("dummy_value_already_migrated");
- }
- }
- if (!pref_name || *pref_name == prefs::kLanguageHangulHanjaBindingKeys) {
- SetLanguageConfigString(language_prefs::kHangulSectionName,
- language_prefs::kHangulHanjaBindingKeysConfigName,
- hangul_hanja_binding_keys_.GetValue());
- }
- for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kPinyinBooleanPrefs[i].pref_name) {
- SetLanguageConfigBoolean(
- language_prefs::kPinyinSectionName,
- language_prefs::kPinyinBooleanPrefs[i].ibus_config_name,
- pinyin_boolean_prefs_[i].GetValue());
- }
- }
- for (size_t i = 0; i < language_prefs::kNumPinyinIntegerPrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kPinyinIntegerPrefs[i].pref_name) {
- SetLanguageConfigInteger(
- language_prefs::kPinyinSectionName,
- language_prefs::kPinyinIntegerPrefs[i].ibus_config_name,
- pinyin_int_prefs_[i].GetValue());
- }
- }
- if (!pref_name ||
- *pref_name == language_prefs::kPinyinDoublePinyinSchema.pref_name) {
- SetLanguageConfigInteger(
- language_prefs::kPinyinSectionName,
- language_prefs::kPinyinDoublePinyinSchema.ibus_config_name,
- pinyin_double_pinyin_schema_.GetValue());
- }
- for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kMozcBooleanPrefs[i].pref_name) {
- SetLanguageConfigBoolean(
- language_prefs::kMozcSectionName,
- language_prefs::kMozcBooleanPrefs[i].ibus_config_name,
- mozc_boolean_prefs_[i].GetValue());
- }
- }
- for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kMozcMultipleChoicePrefs[i].pref_name) {
- SetLanguageConfigString(
- language_prefs::kMozcSectionName,
- language_prefs::kMozcMultipleChoicePrefs[i].ibus_config_name,
- mozc_multiple_choice_prefs_[i].GetValue());
- }
- }
- for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
- if (!pref_name ||
- *pref_name == language_prefs::kMozcIntegerPrefs[i].pref_name) {
- SetLanguageConfigInteger(
- language_prefs::kMozcSectionName,
- language_prefs::kMozcIntegerPrefs[i].ibus_config_name,
- mozc_integer_prefs_[i].GetValue());
- }
- }
-
// Change the download directory to the default value if a Drive directory is
// selected and Drive is disabled.
if (!pref_name || *pref_name == prefs::kDisableDrive) {
@@ -793,45 +686,6 @@ void Preferences::ForceNaturalScrollDefault() {
}
}
-void Preferences::SetLanguageConfigBoolean(const char* section,
- const char* name,
- bool value) {
- input_method::InputMethodConfigValue config;
- config.type = input_method::InputMethodConfigValue::kValueTypeBool;
- config.bool_value = value;
- input_method_manager_->SetInputMethodConfig(section, name, config);
-}
-
-void Preferences::SetLanguageConfigInteger(const char* section,
- const char* name,
- int value) {
- input_method::InputMethodConfigValue config;
- config.type = input_method::InputMethodConfigValue::kValueTypeInt;
- config.int_value = value;
- input_method_manager_->SetInputMethodConfig(section, name, config);
-}
-
-void Preferences::SetLanguageConfigString(const char* section,
- const char* name,
- const std::string& value) {
- input_method::InputMethodConfigValue config;
- config.type = input_method::InputMethodConfigValue::kValueTypeString;
- config.string_value = value;
- input_method_manager_->SetInputMethodConfig(section, name, config);
-}
-
-void Preferences::SetLanguageConfigStringList(
- const char* section,
- const char* name,
- const std::vector<std::string>& values) {
- input_method::InputMethodConfigValue config;
- config.type = input_method::InputMethodConfigValue::kValueTypeStringList;
- for (size_t i = 0; i < values.size(); ++i)
- config.string_list_value.push_back(values[i]);
-
- input_method_manager_->SetInputMethodConfig(section, name, config);
-}
-
void Preferences::SetLanguageConfigStringListAsCSV(const char* section,
const char* name,
const std::string& value) {
@@ -850,10 +704,6 @@ void Preferences::SetLanguageConfigStringListAsCSV(const char* section,
input_method_manager_->EnableInputMethods(split_values);
return;
}
-
- // We should call the cros API even when |value| is empty, to disable default
- // config.
- SetLanguageConfigStringList(section, name, split_values);
}
void Preferences::SetInputMethodList() {
diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h
index 9c98650..dda3427 100644
--- a/chrome/browser/chromeos/preferences.h
+++ b/chrome/browser/chromeos/preferences.h
@@ -64,31 +64,6 @@ class Preferences : public PrefServiceSyncableObserver,
// stored in the preferences.
void NotifyPrefChanged(const std::string* pref_name);
- // Writes boolean |value| to the input method (IBus) configuration daemon.
- // |section| (e.g. "general") and |name| (e.g. "use_global_engine") should
- // not be NULL.
- void SetLanguageConfigBoolean(const char* section,
- const char* name,
- bool value);
-
- // Writes integer |value| to the input method (IBus) configuration daemon.
- // |section| and |name| should not be NULL.
- void SetLanguageConfigInteger(const char* section,
- const char* name,
- int value);
-
- // Writes string |value| to the input method (IBus) configuration daemon.
- // |section| and |name| should not be NULL.
- void SetLanguageConfigString(const char* section,
- const char* name,
- const std::string& value);
-
- // Writes a string list to the input method (IBus) configuration daemon.
- // |section| and |name| should not be NULL.
- void SetLanguageConfigStringList(const char* section,
- const char* name,
- const std::vector<std::string>& values);
-
// A variant of SetLanguageConfigStringList. You can pass comma-separated
// values. Examples of |value|: "", "Control+space,Hiragana"
void SetLanguageConfigStringListAsCSV(const char* section,
diff --git a/chrome/browser/chromeos/preferences_unittest.cc b/chrome/browser/chromeos/preferences_unittest.cc
index cbab4a6..979e154 100644
--- a/chrome/browser/chromeos/preferences_unittest.cc
+++ b/chrome/browser/chromeos/preferences_unittest.cc
@@ -25,16 +25,6 @@ class MyMockInputMethodManager : public input_method::MockInputMethodManager {
virtual ~MyMockInputMethodManager() {
}
- virtual bool SetInputMethodConfig(
- const std::string& section,
- const std::string& config_name,
- const input_method::InputMethodConfigValue& value) OVERRIDE {
- // Assume the preload engines list is "KeyboardC,KeyboardA,KeyboardB".
- // Switch to the first one, C.
- ChangeInputMethod("KeyboardC");
- return true;
- }
-
virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE {
last_input_method_id_ = input_method_id;
// Do the same thing as BrowserStateMonitor::UpdateUserPreferences.