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

Side by Side Diff: chromeos/dbus/ibus/ibus_input_context_client.h

Issue 10310090: Implement IBusInputContextClient (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed test build break. Created 8 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_INPUT_CONTEXT_CLIENT_H_
6 #define CHROMEOS_DBUS_IBUS_IBUS_INPUT_CONTEXT_CLIENT_H_
7 #pragma once
8
9 #include "base/bind.h"
10 #include "base/callback.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_client_implementation_type.h"
13 #include "dbus/object_path.h"
14
15 namespace dbus {
16 class Bus;
17 } // namespace dbus
18
19 namespace chromeos {
20
21 class IBusText;
22
23 // A class to make the actual DBus calls for IBusInputContext service.
24 // The ibus-daemon creates object paths on demand, so the target object path is
25 // not determined before calling CreateInputContext. It is good to initialize
26 // this class at the callback from CreateInputContext in IBusClient. This class
27 // is managed by DBusThreadManager as singleton instance, so we can handle only
28 // one input context but it is enough for ChromeOS.
29 class CHROMEOS_EXPORT IBusInputContextClient {
30 public:
31 typedef base::Callback<void(const IBusText& text)> CommitTextHandler;
32 typedef base::Callback<void(uint32 keyval, uint32 keycode, uint32 state)>
33 ForwardKeyEventHandler;
34 typedef base::Callback<void(const IBusText& text,
35 uint32 cursor_pos,
36 bool visible)>
37 UpdatePreeditTextHandler;
38 typedef base::Callback<void()> ShowPreeditTextHandler;
39 typedef base::Callback<void()> HidePreeditTextHandler;
40 typedef base::Callback<void(bool is_keyevent_used)> ProcessKeyEventCallback;
41
42 virtual ~IBusInputContextClient();
43
44 // Creates object proxy and connects signals.
45 virtual void Initialize(dbus::Bus* bus,
46 const dbus::ObjectPath& object_path) = 0;
47 // Resets object proxy.
satorux1 2012/05/10 21:40:53 ??? The function comment should match the function
Seigo Nonaka 2012/05/10 22:26:08 Done.
48 virtual void Shutdown() = 0;
49
50 // Returns true if connected to target input context path, otherwise return
51 // false.
52 virtual bool IsConnected() const = 0;
53
54 // Sets CommitText signal handler.
satorux1 2012/05/10 21:40:53 Can this function be called multiple times? or onl
Seigo Nonaka 2012/05/10 22:26:08 Done.
Seigo Nonaka 2012/05/10 22:26:08 Done.
55 virtual void SetCommitTextHandler(
56 const CommitTextHandler& commit_text_handler) = 0;
57 // Sets ForwardKeyEvent signal handler.
58 virtual void SetForwardKeyEventHandler(
59 const ForwardKeyEventHandler& forward_key_event_handler) = 0;
60 // Sets UpdatePreeditText signal handler.
61 virtual void SetUpdatePreeditTextHandler(
62 const UpdatePreeditTextHandler& update_preedit_text_handler) = 0;
63 // Sets ShowPreeditText signal handler.
64 virtual void SetShowPreeditTextHandler(
65 const ShowPreeditTextHandler& show_preedit_text_handler) = 0;
66 // Sets HidePreeditText signal handler.
67 virtual void SetHidePreeditTextHandler(
68 const HidePreeditTextHandler& hide_preedit_text_handler) = 0;
69 // Unsets CommitText signal handler.
70 virtual void UnsetCommitTextHandler() = 0;
71 // Unsets FowardKeyEvent signal handler.
72 virtual void UnsetForwardKeyEventHandler() = 0;
73 // Unsets UpdatePreeditText signal handler.
74 virtual void UnsetUpdatePreeditTextHandler() = 0;
75 // Unsets ShowPreeditText signal handler.
76 virtual void UnsetShowPreeditTextHandler() = 0;
77 // Unsets HidePreeditText signal handler.
78 virtual void UnsetHidePreeditTextHandler() = 0;
79
80 // Invokes SetCapabilities method call.
81 virtual void SetCapabilities(uint32 capability) = 0;
82 // Invokes FocusIn method call.
83 virtual void FocusIn() = 0;
84 // Invokes FocusOut method call.
85 virtual void FocusOut() = 0;
86 // Invokes Reset method call.
87 virtual void Reset() = 0;
88 // Invokes SetCursorLocation method call.
89 virtual void SetCursorLocation(int32 x, int32 y, int32 w, int32 h) = 0;
satorux1 2012/05/10 21:40:53 w, h -> width, height?
satorux1 2012/05/11 22:45:14 missed this comment?
90 // Invokes ProcessKeyEvent method call.
91 virtual void ProcessKeyEvent(uint32 keyval,
92 uint32 keycode,
93 uint32 state,
94 const ProcessKeyEventCallback& callback) = 0;
95
96 // Factory function, creates a new instance and returns ownership.
97 // For normal usage, access the singleton via DBusThreadManager::Get().
98 static CHROMEOS_EXPORT IBusInputContextClient* Create(
99 DBusClientImplementationType type);
100
101 protected:
102 // Create() should be used instead.
103 IBusInputContextClient();
104
105 private:
106 DISALLOW_COPY_AND_ASSIGN(IBusInputContextClient);
107 };
108
109 } // namespace chromeos
110
111 #endif // CHROMEOS_DBUS_IBUS_IBUS_INPUT_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698