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

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: Rebase and apply comments. 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
48 // Resets object proxy. If you want to use InputContext again, should call
49 // Initialize function again.
50 virtual void ResetObjectProxy() = 0;
51
52 // Returns true if connected to target input context path, otherwise return
53 // false.
54 virtual bool IsConnected() const = 0;
55
56 // Signal handler accessors. Setting function can be called multiple times. If
57 // you call setting function multiple times, previous callback will be
58 // overwritten. Setting functions take null-callback.
59 // Sets CommitText signal handler.
60 virtual void SetCommitTextHandler(
61 const CommitTextHandler& commit_text_handler) = 0;
62 // Sets ForwardKeyEvent signal handler.
63 virtual void SetForwardKeyEventHandler(
64 const ForwardKeyEventHandler& forward_key_event_handler) = 0;
65 // Sets UpdatePreeditText signal handler.
66 virtual void SetUpdatePreeditTextHandler(
67 const UpdatePreeditTextHandler& update_preedit_text_handler) = 0;
68 // Sets ShowPreeditText signal handler.
69 virtual void SetShowPreeditTextHandler(
70 const ShowPreeditTextHandler& show_preedit_text_handler) = 0;
71 // Sets HidePreeditText signal handler.
72 virtual void SetHidePreeditTextHandler(
73 const HidePreeditTextHandler& hide_preedit_text_handler) = 0;
74 // Unsets CommitText signal handler.
75 virtual void UnsetCommitTextHandler() = 0;
76 // Unsets FowardKeyEvent signal handler.
77 virtual void UnsetForwardKeyEventHandler() = 0;
78 // Unsets UpdatePreeditText signal handler.
79 virtual void UnsetUpdatePreeditTextHandler() = 0;
80 // Unsets ShowPreeditText signal handler.
81 virtual void UnsetShowPreeditTextHandler() = 0;
82 // Unsets HidePreeditText signal handler.
83 virtual void UnsetHidePreeditTextHandler() = 0;
84
85 // Invokes SetCapabilities method call.
86 virtual void SetCapabilities(uint32 capability) = 0;
87 // Invokes FocusIn method call.
88 virtual void FocusIn() = 0;
89 // Invokes FocusOut method call.
90 virtual void FocusOut() = 0;
91 // Invokes Reset method call.
92 virtual void Reset() = 0;
93 // Invokes SetCursorLocation method call.
94 virtual void SetCursorLocation(int32 x, int32 y, int32 w, int32 h) = 0;
95 // Invokes ProcessKeyEvent method call. |callback| shold not be null-callback.
96 virtual void ProcessKeyEvent(uint32 keyval,
97 uint32 keycode,
98 uint32 state,
99 const ProcessKeyEventCallback& callback) = 0;
100
101 // Factory function, creates a new instance and returns ownership.
102 // For normal usage, access the singleton via DBusThreadManager::Get().
103 static CHROMEOS_EXPORT IBusInputContextClient* Create(
104 DBusClientImplementationType type);
105
106 protected:
107 // Create() should be used instead.
108 IBusInputContextClient();
109
110 private:
111 DISALLOW_COPY_AND_ASSIGN(IBusInputContextClient);
112 };
113
114 } // namespace chromeos
115
116 #endif // CHROMEOS_DBUS_IBUS_IBUS_INPUT_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698