OLD | NEW |
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 #ifndef CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ |
6 #define CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ | 6 #define CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
14 #include "chromeos/dbus/dbus_client_implementation_type.h" | 14 #include "chromeos/dbus/dbus_client_implementation_type.h" |
15 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
16 | 16 |
17 namespace dbus { | 17 namespace dbus { |
18 class Bus; | 18 class Bus; |
19 } // namespace dbus | 19 } // namespace dbus |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 | 22 |
| 23 namespace ibus { |
| 24 class IBusComponent; |
| 25 } // namespace ibus |
| 26 |
23 class IBusInputContextClient; | 27 class IBusInputContextClient; |
24 | 28 |
25 // A class to make the actual DBus calls for IBusBus service. | 29 // A class to make the actual DBus calls for IBusBus service. |
26 // This class only makes calls, result/error handling should be done by | 30 // This class only makes calls, result/error handling should be done by |
27 // callbacks. | 31 // callbacks. |
28 class CHROMEOS_EXPORT IBusClient { | 32 class CHROMEOS_EXPORT IBusClient { |
29 public: | 33 public: |
30 typedef base::Callback<void(const dbus::ObjectPath&)> | 34 typedef base::Callback<void(const dbus::ObjectPath&)> |
31 CreateInputContextCallback; | 35 CreateInputContextCallback; |
| 36 typedef base::Callback<void()> RegisterComponentCallback; |
32 typedef base::Callback<void()> ErrorCallback; | 37 typedef base::Callback<void()> ErrorCallback; |
33 | 38 |
34 virtual ~IBusClient(); | 39 virtual ~IBusClient(); |
35 | 40 |
36 // Requests the ibus-daemon to create new input context. If succeeded, | 41 // Requests the ibus-daemon to create new input context. If succeeded, |
37 // |callback| will be called with an ObjectPath which is used in input context | 42 // |callback| will be called with an ObjectPath which is used in input context |
38 // handling. If failed, |error_callback| is called instead. | 43 // handling. If failed, |error_callback| is called instead. |
39 virtual void CreateInputContext( | 44 virtual void CreateInputContext( |
40 const std::string& client_name, | 45 const std::string& client_name, |
41 const CreateInputContextCallback& callback, | 46 const CreateInputContextCallback& callback, |
42 const ErrorCallback& error_callback) = 0; | 47 const ErrorCallback& error_callback) = 0; |
43 | 48 |
| 49 // Requests the ibus-daemon to register new engine object. If succeeded, |
| 50 // |callback| will be called. If failed, |error_callback| is called instead. |
| 51 virtual void RegisterComponent( |
| 52 const ibus::IBusComponent& ibus_component, |
| 53 const RegisterComponentCallback& callback, |
| 54 const ErrorCallback& error_callback) = 0; |
| 55 |
44 // Factory function, creates a new instance and returns ownership. | 56 // Factory function, creates a new instance and returns ownership. |
45 // For normal usage, access the singleton via DBusThreadManager::Get(). | 57 // For normal usage, access the singleton via DBusThreadManager::Get(). |
46 static CHROMEOS_EXPORT IBusClient* Create(DBusClientImplementationType type, | 58 static CHROMEOS_EXPORT IBusClient* Create(DBusClientImplementationType type, |
47 dbus::Bus* bus); | 59 dbus::Bus* bus); |
48 | 60 |
49 protected: | 61 protected: |
50 // Create() should be used instead. | 62 // Create() should be used instead. |
51 IBusClient(); | 63 IBusClient(); |
52 | 64 |
53 private: | 65 private: |
54 DISALLOW_COPY_AND_ASSIGN(IBusClient); | 66 DISALLOW_COPY_AND_ASSIGN(IBusClient); |
55 }; | 67 }; |
56 | 68 |
57 } // namespace chromeos | 69 } // namespace chromeos |
58 | 70 |
59 #endif // CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ | 71 #endif // CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ |
OLD | NEW |