Skip to content

Commit

Permalink
ibus: Implement a noop callback for FocusIn, FocusOut, StateChange me…
Browse files Browse the repository at this point in the history
…thod 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
  • Loading branch information
haruki@chromium.org committed Dec 14, 2012
1 parent 1683a0d commit c4db977
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chromeos/dbus/ibus/ibus_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
35 changes: 35 additions & 0 deletions chromeos/dbus/ibus/ibus_panel_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 18 additions & 0 deletions chromeos/dbus/ibus/ibus_panel_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit c4db977

Please sign in to comment.