Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chromeos/dbus/ibus/ibus_panel_service.cc

Issue 12017010: Introduce bypass logic for SetCursorLocation message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/ibus/ibus_panel_service.h" 5 #include "chromeos/dbus/ibus/ibus_panel_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "chromeos/dbus/ibus/ibus_constants.h" 10 #include "chromeos/dbus/ibus/ibus_constants.h"
11 #include "chromeos/dbus/ibus/ibus_input_context_client.h"
11 #include "chromeos/dbus/ibus/ibus_lookup_table.h" 12 #include "chromeos/dbus/ibus/ibus_lookup_table.h"
12 #include "chromeos/dbus/ibus/ibus_property.h" 13 #include "chromeos/dbus/ibus/ibus_property.h"
13 #include "chromeos/dbus/ibus/ibus_text.h" 14 #include "chromeos/dbus/ibus/ibus_text.h"
14 #include "dbus/bus.h" 15 #include "dbus/bus.h"
15 #include "dbus/exported_object.h" 16 #include "dbus/exported_object.h"
16 #include "dbus/message.h" 17 #include "dbus/message.h"
17 #include "dbus/object_path.h" 18 #include "dbus/object_path.h"
18 #include "dbus/object_proxy.h" 19 #include "dbus/object_proxy.h"
19 20
20 namespace chromeos { 21 namespace chromeos {
21 // TODO(nona): Remove ibus namespace after complete libibus removal. 22 // TODO(nona): Remove ibus namespace after complete libibus removal.
22 namespace ibus { 23 namespace ibus {
23 24
24 class IBusPanelServiceImpl : public IBusPanelService { 25 class IBusPanelServiceImpl : public IBusPanelService {
25 public: 26 public:
26 explicit IBusPanelServiceImpl(dbus::Bus* bus) 27 explicit IBusPanelServiceImpl(dbus::Bus* bus,
28 IBusInputContextClient* input_context)
27 : bus_(bus), 29 : bus_(bus),
28 candidate_window_handler_(NULL), 30 candidate_window_handler_(NULL),
29 property_handler_(NULL), 31 property_handler_(NULL),
30 weak_ptr_factory_(this) { 32 weak_ptr_factory_(this) {
31 exported_object_ = bus->GetExportedObject( 33 exported_object_ = bus->GetExportedObject(
32 dbus::ObjectPath(ibus::panel::kServicePath)); 34 dbus::ObjectPath(ibus::panel::kServicePath));
33 35
34 exported_object_->ExportMethod( 36 exported_object_->ExportMethod(
35 ibus::panel::kServiceInterface, 37 ibus::panel::kServiceInterface,
36 ibus::panel::kUpdateLookupTableMethod, 38 ibus::panel::kUpdateLookupTableMethod,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 base::Bind(&IBusPanelServiceImpl::NoOperation, 119 base::Bind(&IBusPanelServiceImpl::NoOperation,
118 weak_ptr_factory_.GetWeakPtr()), 120 weak_ptr_factory_.GetWeakPtr()),
119 base::Bind(&IBusPanelServiceImpl::OnMethodExported, 121 base::Bind(&IBusPanelServiceImpl::OnMethodExported,
120 weak_ptr_factory_.GetWeakPtr())); 122 weak_ptr_factory_.GetWeakPtr()));
121 123
122 // Request well known name to ibus-daemon. 124 // Request well known name to ibus-daemon.
123 bus->RequestOwnership( 125 bus->RequestOwnership(
124 ibus::panel::kServiceName, 126 ibus::panel::kServiceName,
125 base::Bind(&IBusPanelServiceImpl::OnRequestOwnership, 127 base::Bind(&IBusPanelServiceImpl::OnRequestOwnership,
126 weak_ptr_factory_.GetWeakPtr())); 128 weak_ptr_factory_.GetWeakPtr()));
129
130 input_context->SetSetCursorLocationHandler(
131 base::Bind(&IBusPanelServiceImpl::SetCursorLocation,
132 weak_ptr_factory_.GetWeakPtr()));
127 } 133 }
128 134
129 virtual ~IBusPanelServiceImpl() { 135 virtual ~IBusPanelServiceImpl() {
130 bus_->UnregisterExportedObject( 136 bus_->UnregisterExportedObject(
131 dbus::ObjectPath(ibus::panel::kServicePath)); 137 dbus::ObjectPath(ibus::panel::kServicePath));
132 } 138 }
133 139
134 // IBusPanelService override. 140 // IBusPanelService override.
135 virtual void SetUpCandidateWindowHandler( 141 virtual void SetUpCandidateWindowHandler(
136 IBusPanelCandidateWindowHandlerInterface* handler) { 142 IBusPanelCandidateWindowHandlerInterface* handler) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 DLOG(WARNING) << "RegisterProperties called with incorrect parameters:" 337 DLOG(WARNING) << "RegisterProperties called with incorrect parameters:"
332 << method_call->ToString(); 338 << method_call->ToString();
333 return; 339 return;
334 } 340 }
335 property_handler_->UpdateProperty(property); 341 property_handler_->UpdateProperty(property);
336 342
337 dbus::Response* response = dbus::Response::FromMethodCall(method_call); 343 dbus::Response* response = dbus::Response::FromMethodCall(method_call);
338 response_sender.Run(response); 344 response_sender.Run(response);
339 } 345 }
340 346
347 void SetCursorLocation(const ibus::Rect& cursor_location,
348 const ibus::Rect& composition_head) {
349 // TODO(nona): implement this function.
350 }
351
341 // Handles FocusIn, FocusOut, StateChanged method calls from IBus, and ignores 352 // Handles FocusIn, FocusOut, StateChanged method calls from IBus, and ignores
342 // them. 353 // them.
343 void NoOperation(dbus::MethodCall* method_call, 354 void NoOperation(dbus::MethodCall* method_call,
344 dbus::ExportedObject::ResponseSender response_sender) { 355 dbus::ExportedObject::ResponseSender response_sender) {
345 if (!property_handler_) 356 if (!property_handler_)
346 return; 357 return;
347 358
348 dbus::Response* response = dbus::Response::FromMethodCall(method_call); 359 dbus::Response* response = dbus::Response::FromMethodCall(method_call);
349 response_sender.Run(response); 360 response_sender.Run(response);
350 } 361 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 DISALLOW_COPY_AND_ASSIGN(IBusPanelServiceStubImpl); 410 DISALLOW_COPY_AND_ASSIGN(IBusPanelServiceStubImpl);
400 }; 411 };
401 412
402 IBusPanelService::IBusPanelService() { 413 IBusPanelService::IBusPanelService() {
403 } 414 }
404 415
405 IBusPanelService::~IBusPanelService() { 416 IBusPanelService::~IBusPanelService() {
406 } 417 }
407 418
408 // static 419 // static
409 IBusPanelService* IBusPanelService::Create(DBusClientImplementationType type, 420 IBusPanelService* IBusPanelService::Create(
410 dbus::Bus* bus) { 421 DBusClientImplementationType type,
422 dbus::Bus* bus,
423 IBusInputContextClient* input_context) {
411 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) { 424 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) {
412 return new IBusPanelServiceImpl(bus); 425 return new IBusPanelServiceImpl(bus, input_context);
413 } else { 426 } else {
414 return new IBusPanelServiceStubImpl(); 427 return new IBusPanelServiceStubImpl();
415 } 428 }
416 } 429 }
417 430
418 } // namespace ibus 431 } // namespace ibus
419 } // namespace chromeos 432 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_panel_service.h ('k') | chromeos/dbus/ibus/ibus_panel_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698