diff options
author | haruki@chromium.org <haruki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-14 07:35:22 +0000 |
---|---|---|
committer | haruki@chromium.org <haruki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-14 07:35:22 +0000 |
commit | c4db97748115195f8ac3fcd6fb87dd88b6eb3a19 (patch) | |
tree | 2d72abb5b95b915f4788c86a51f76b0271a9498d /chromeos | |
parent | 1683a0dcdbc371102affc860e2fffc5ee78538de (diff) | |
download | chromium_src-c4db97748115195f8ac3fcd6fb87dd88b6eb3a19.zip chromium_src-c4db97748115195f8ac3fcd6fb87dd88b6eb3a19.tar.gz chromium_src-c4db97748115195f8ac3fcd6fb87dd88b6eb3a19.tar.bz2 |
ibus: Implement a noop callback for FocusIn, FocusOut, StateChange method calls from IBus.
BUG=164525
TEST=Try using Japanese IME and check the user log in chrome://system.
Review URL: https://chromiumcodereview.appspot.com/11570002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/ibus/ibus_constants.h | 6 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_panel_service.cc | 35 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_panel_service_unittest.cc | 18 |
3 files changed, 59 insertions, 0 deletions
diff --git a/chromeos/dbus/ibus/ibus_constants.h b/chromeos/dbus/ibus/ibus_constants.h index 4be68fc..628ac82 100644 --- a/chromeos/dbus/ibus/ibus_constants.h +++ b/chromeos/dbus/ibus/ibus_constants.h @@ -91,6 +91,12 @@ const char kCursorUpSignal[] = "CursorUp"; const char kCursorDownSignal[] = "CursorDown"; const char kPageUpSignal[] = "PageUp"; const char kPageDownSignal[] = "PageDown"; + +// Methods to be just ignored. We do not use these methods in the UI. +// See http://crbug.com/164525. +const char kFocusInMethod[] = "FocusIn"; +const char kFocusOutMethod[] = "FocusOut"; +const char kStateChangedMethod[] = "StateChanged"; } // namespace panel // Following variables indicate state of IBusProperty. diff --git a/chromeos/dbus/ibus/ibus_panel_service.cc b/chromeos/dbus/ibus/ibus_panel_service.cc index 28224c1..644a937 100644 --- a/chromeos/dbus/ibus/ibus_panel_service.cc +++ b/chromeos/dbus/ibus/ibus_panel_service.cc @@ -95,6 +95,30 @@ class IBusPanelServiceImpl : public IBusPanelService { base::Bind(&IBusPanelServiceImpl::OnMethodExported, weak_ptr_factory_.GetWeakPtr())); + exported_object_->ExportMethod( + ibus::panel::kServiceInterface, + ibus::panel::kFocusInMethod, + base::Bind(&IBusPanelServiceImpl::NoOperation, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&IBusPanelServiceImpl::OnMethodExported, + weak_ptr_factory_.GetWeakPtr())); + + exported_object_->ExportMethod( + ibus::panel::kServiceInterface, + ibus::panel::kFocusOutMethod, + base::Bind(&IBusPanelServiceImpl::NoOperation, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&IBusPanelServiceImpl::OnMethodExported, + weak_ptr_factory_.GetWeakPtr())); + + exported_object_->ExportMethod( + ibus::panel::kServiceInterface, + ibus::panel::kStateChangedMethod, + base::Bind(&IBusPanelServiceImpl::NoOperation, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&IBusPanelServiceImpl::OnMethodExported, + weak_ptr_factory_.GetWeakPtr())); + // Request well known name to ibus-daemon. bus->RequestOwnership( ibus::panel::kServiceName, @@ -314,6 +338,17 @@ class IBusPanelServiceImpl : public IBusPanelService { response_sender.Run(response); } + // Handles FocusIn, FocusOut, StateChanged method calls from IBus, and ignores + // them. + void NoOperation(dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender) { + if (!property_handler_) + return; + + dbus::Response* response = dbus::Response::FromMethodCall(method_call); + response_sender.Run(response); + } + // Called when the method call is exported. void OnMethodExported(const std::string& interface_name, const std::string& method_name, diff --git a/chromeos/dbus/ibus/ibus_panel_service_unittest.cc b/chromeos/dbus/ibus/ibus_panel_service_unittest.cc index 6372dc7..85a59e9 100644 --- a/chromeos/dbus/ibus/ibus_panel_service_unittest.cc +++ b/chromeos/dbus/ibus/ibus_panel_service_unittest.cc @@ -267,6 +267,24 @@ class IBusPanelServiceTest : public testing::Test { .WillRepeatedly( Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + EXPECT_CALL(*mock_exported_object_, ExportMethod( + ibus::panel::kServiceInterface, + ibus::panel::kFocusInMethod, _, _)) + .WillRepeatedly( + Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_, ExportMethod( + ibus::panel::kServiceInterface, + ibus::panel::kFocusOutMethod, _, _)) + .WillRepeatedly( + Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_, ExportMethod( + ibus::panel::kServiceInterface, + ibus::panel::kStateChangedMethod, _, _)) + .WillRepeatedly( + Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + // Suppress uninteresting mock function call warning. EXPECT_CALL(*mock_bus_.get(), AssertOnOriginThread()) |