diff options
author | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 12:01:10 +0000 |
---|---|---|
committer | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 12:01:10 +0000 |
commit | 3cf81cb978164c0d417b61170b0565effd1e3305 (patch) | |
tree | a0b207af20980f19d6b29c98ab1fb9f8a5b4e8f2 | |
parent | 33a913bdd5503c105ad6e5350e3170b2a2de4239 (diff) | |
download | chromium_src-3cf81cb978164c0d417b61170b0565effd1e3305.zip chromium_src-3cf81cb978164c0d417b61170b0565effd1e3305.tar.gz chromium_src-3cf81cb978164c0d417b61170b0565effd1e3305.tar.bz2 |
Extends DBusThreadManger to handle IBusPanelService
This patch is 2nd try of http://codereview.chromium.org/11366012/
- Introudced ibus namespace for IBusPanelService which collisions original ibus's class name.
BUG=158264
TEST=ran chromeos_unittests, unit_tests
Review URL: https://chromiumcodereview.appspot.com/11365104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166382 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.cc | 11 | ||||
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.h | 9 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_panel_service.cc | 3 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_panel_service.h | 2 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_panel_service_unittest.cc | 3 | ||||
-rw-r--r-- | chromeos/dbus/ibus/mock_ibus_panel_service.cc | 3 | ||||
-rw-r--r-- | chromeos/dbus/ibus/mock_ibus_panel_service.h | 4 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager.h | 1 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc | 6 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager_without_gmock.h | 7 |
10 files changed, 45 insertions, 4 deletions
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index d689f3c..53566ad 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc @@ -34,6 +34,7 @@ #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" #include "chromeos/dbus/ibus/ibus_engine_service.h" #include "chromeos/dbus/ibus/ibus_input_context_client.h" +#include "chromeos/dbus/ibus/ibus_panel_service.h" #include "chromeos/dbus/image_burner_client.h" #include "chromeos/dbus/introspectable_client.h" #include "chromeos/dbus/modem_messaging_client.h" @@ -210,6 +211,10 @@ class DBusThreadManagerImpl : public DBusThreadManager { ibus_engine_factory_service_.reset( IBusEngineFactoryService::Create(ibus_bus_.get(), client_type)); + // Create the ibus panel service. + ibus_panel_service_.reset( + ibus::IBusPanelService::Create(client_type, ibus_bus_.get())); + ibus_engine_services_.clear(); } @@ -395,6 +400,11 @@ class DBusThreadManagerImpl : public DBusThreadManager { ibus_engine_services_.erase(object_path); } + // DBusThreadManager override. + virtual ibus::IBusPanelService* GetIBusPanelService() OVERRIDE { + return ibus_panel_service_.get(); + } + scoped_ptr<base::Thread> dbus_thread_; scoped_refptr<dbus::Bus> system_bus_; scoped_refptr<dbus::Bus> ibus_bus_; @@ -428,6 +438,7 @@ class DBusThreadManagerImpl : public DBusThreadManager { scoped_ptr<IBusInputContextClient> ibus_input_context_client_; scoped_ptr<IBusEngineFactoryService> ibus_engine_factory_service_; std::map<dbus::ObjectPath, IBusEngineService*> ibus_engine_services_; + scoped_ptr<ibus::IBusPanelService> ibus_panel_service_; std::string ibus_address_; diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index 3de095f..a246cc7 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h @@ -56,6 +56,11 @@ class ShillServiceClient; class SpeechSynthesizerClient; class UpdateEngineClient; +// TODO(nona): Remove ibus namespace after complete libibus removal. +namespace ibus { +class IBusPanelService; +} // namespace ibus + // DBusThreadManager manages the D-Bus thread, the thread dedicated to // handling asynchronous D-Bus operations. // @@ -258,6 +263,10 @@ class CHROMEOS_EXPORT DBusThreadManager { // Removes the ibus engine services for |object_path|. virtual void RemoveIBusEngineService(const dbus::ObjectPath& object_path) = 0; + // Returns the ibus panel service, owned by DBusThreadManager. Do not cache + // this pointer and use it after DBusThreadManager is shut down. + virtual ibus::IBusPanelService* GetIBusPanelService() = 0; + virtual ~DBusThreadManager(); protected: diff --git a/chromeos/dbus/ibus/ibus_panel_service.cc b/chromeos/dbus/ibus/ibus_panel_service.cc index 66e05308..aa03a73 100644 --- a/chromeos/dbus/ibus/ibus_panel_service.cc +++ b/chromeos/dbus/ibus/ibus_panel_service.cc @@ -18,6 +18,8 @@ #include "dbus/object_proxy.h" namespace chromeos { +// TODO(nona): Remove ibus namespace after complete libibus removal. +namespace ibus { class IBusPanelServiceImpl : public IBusPanelService { public: @@ -288,4 +290,5 @@ IBusPanelService* IBusPanelService::Create(DBusClientImplementationType type, } } +} // namespace ibus } // namespace chromeos diff --git a/chromeos/dbus/ibus/ibus_panel_service.h b/chromeos/dbus/ibus/ibus_panel_service.h index a46e553..96c7f68 100644 --- a/chromeos/dbus/ibus/ibus_panel_service.h +++ b/chromeos/dbus/ibus/ibus_panel_service.h @@ -26,7 +26,6 @@ class IBusLookupTable; class IBusProperty; class IBusText; typedef ScopedVector<IBusProperty> IBusPropertyList; -} // namespace // A interface to handle the panel client method call. class CHROMEOS_EXPORT IBusPanelHandlerInterface { @@ -101,6 +100,7 @@ class CHROMEOS_EXPORT IBusPanelService { DISALLOW_COPY_AND_ASSIGN(IBusPanelService); }; +} // namespace ibus } // namespace chromeos #endif // CHROMEOS_DBUS_IBUS_IBUS_PANEL_SERVICE_H_ diff --git a/chromeos/dbus/ibus/ibus_panel_service_unittest.cc b/chromeos/dbus/ibus/ibus_panel_service_unittest.cc index 0703682..9981dc4 100644 --- a/chromeos/dbus/ibus/ibus_panel_service_unittest.cc +++ b/chromeos/dbus/ibus/ibus_panel_service_unittest.cc @@ -25,6 +25,8 @@ using testing::Return; using testing::_; namespace chromeos { +// TODO(nona): Remove ibus namespace after complete libibus removal. +namespace ibus { namespace { @@ -461,4 +463,5 @@ TEST_F(IBusPanelServiceTest, PageDownTest) { service_->PageDown(); } +} // namespace ibus } // namespace chromeos diff --git a/chromeos/dbus/ibus/mock_ibus_panel_service.cc b/chromeos/dbus/ibus/mock_ibus_panel_service.cc index d937ee3..436192d 100644 --- a/chromeos/dbus/ibus/mock_ibus_panel_service.cc +++ b/chromeos/dbus/ibus/mock_ibus_panel_service.cc @@ -12,7 +12,8 @@ MockIBusPanelService::MockIBusPanelService() { MockIBusPanelService::~MockIBusPanelService() { } -void MockIBusPanelService::Initialize(IBusPanelHandlerInterface* handler) { +void MockIBusPanelService::Initialize( + ibus::IBusPanelHandlerInterface* handler) { } void MockIBusPanelService::CandidateClicked(uint32 index, diff --git a/chromeos/dbus/ibus/mock_ibus_panel_service.h b/chromeos/dbus/ibus/mock_ibus_panel_service.h index 4979046..5269a84 100644 --- a/chromeos/dbus/ibus/mock_ibus_panel_service.h +++ b/chromeos/dbus/ibus/mock_ibus_panel_service.h @@ -10,13 +10,13 @@ namespace chromeos { -class MockIBusPanelService : public IBusPanelService { +class MockIBusPanelService : public ibus::IBusPanelService { public: MockIBusPanelService(); virtual ~MockIBusPanelService(); // IBusPanelService overrides. - virtual void Initialize(IBusPanelHandlerInterface* handler) OVERRIDE; + virtual void Initialize(ibus::IBusPanelHandlerInterface* handler) OVERRIDE; virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button, uint32 state) OVERRIDE; diff --git a/chromeos/dbus/mock_dbus_thread_manager.h b/chromeos/dbus/mock_dbus_thread_manager.h index 2cb5372b..92fa127 100644 --- a/chromeos/dbus/mock_dbus_thread_manager.h +++ b/chromeos/dbus/mock_dbus_thread_manager.h @@ -93,6 +93,7 @@ class MockDBusThreadManager : public DBusThreadManager { IBusEngineService*(const dbus::ObjectPath& object_path)); MOCK_METHOD1(RemoveIBusEngineService, void(const dbus::ObjectPath& object_path)); + MOCK_METHOD0(GetIBusPanelService, ibus::IBusPanelService*(void)); MockBluetoothAdapterClient* mock_bluetooth_adapter_client() { return mock_bluetooth_adapter_client_.get(); diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc index 4f3d0d9..3749a56 100644 --- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc +++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc @@ -9,6 +9,7 @@ #include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h" #include "chromeos/dbus/ibus/mock_ibus_engine_service.h" #include "chromeos/dbus/ibus/mock_ibus_input_context_client.h" +#include "chromeos/dbus/ibus/mock_ibus_panel_service.h" namespace chromeos { @@ -219,4 +220,9 @@ void MockDBusThreadManagerWithoutGMock::RemoveIBusEngineService( const dbus::ObjectPath& object_path) { } +ibus::IBusPanelService* + MockDBusThreadManagerWithoutGMock::GetIBusPanelService() { + return mock_ibus_panel_service_.get(); +} + } // namespace chromeos diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h index 930ec19..631101f 100644 --- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h +++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h @@ -23,6 +23,7 @@ class MockIBusClient; class MockIBusEngineFactoryService; class MockIBusEngineService; class MockIBusInputContextClient; +class MockIBusPanelService; // This class provides an another mock DBusThreadManager without gmock // dependency. This class is used only for places where GMock is not allowed @@ -71,6 +72,7 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { const dbus::ObjectPath& object_path) OVERRIDE; virtual void RemoveIBusEngineService( const dbus::ObjectPath& object_path) OVERRIDE; + virtual ibus::IBusPanelService* GetIBusPanelService() OVERRIDE; MockIBusClient* mock_ibus_client() { return mock_ibus_client_.get(); @@ -88,6 +90,10 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { return mock_ibus_engine_factory_service_.get(); } + MockIBusPanelService* mock_ibus_panel_service() { + return mock_ibus_panel_service_.get(); + } + void set_ibus_bus(dbus::Bus* ibus_bus) { ibus_bus_ = ibus_bus; } @@ -97,6 +103,7 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { scoped_ptr<MockIBusInputContextClient> mock_ibus_input_context_client_; scoped_ptr<MockIBusEngineService> mock_ibus_engine_service_; scoped_ptr<MockIBusEngineFactoryService> mock_ibus_engine_factory_service_; + scoped_ptr<MockIBusPanelService> mock_ibus_panel_service_; dbus::Bus* ibus_bus_; |