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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 #include "chromeos/dbus/dbus_client_implementation_type.h" | 13 #include "chromeos/dbus/dbus_client_implementation_type.h" |
14 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
15 | 15 |
16 namespace dbus { | 16 namespace dbus { |
17 class Bus; | 17 class Bus; |
18 } // namespace dbus | 18 } // namespace dbus |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 namespace ibus { | |
23 class IBusComponent; | 22 class IBusComponent; |
24 } // namespace ibus | |
25 | |
26 class IBusInputContextClient; | 23 class IBusInputContextClient; |
27 | 24 |
28 // A class to make the actual DBus calls for IBusBus service. | 25 // A class to make the actual DBus calls for IBusBus service. |
29 // This class only makes calls, result/error handling should be done by | 26 // This class only makes calls, result/error handling should be done by |
30 // callbacks. | 27 // callbacks. |
31 class CHROMEOS_EXPORT IBusClient { | 28 class CHROMEOS_EXPORT IBusClient { |
32 public: | 29 public: |
33 enum ExitOption { | 30 enum ExitOption { |
34 RESTART_IBUS_DAEMON, | 31 RESTART_IBUS_DAEMON, |
35 SHUT_DOWN_IBUS_DAEMON | 32 SHUT_DOWN_IBUS_DAEMON |
36 }; | 33 }; |
37 typedef base::Callback<void(const dbus::ObjectPath&)> | 34 typedef base::Callback<void(const dbus::ObjectPath&)> |
38 CreateInputContextCallback; | 35 CreateInputContextCallback; |
39 typedef base::Callback<void()> RegisterComponentCallback; | 36 typedef base::Callback<void()> RegisterComponentCallback; |
40 typedef base::Callback<void()> ErrorCallback; | 37 typedef base::Callback<void()> ErrorCallback; |
41 | 38 |
42 virtual ~IBusClient(); | 39 virtual ~IBusClient(); |
43 | 40 |
44 // Requests the ibus-daemon to create new input context. If succeeded, | 41 // Requests the ibus-daemon to create new input context. If succeeded, |
45 // |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 |
46 // handling. If failed, |error_callback| is called instead. | 43 // handling. If failed, |error_callback| is called instead. |
47 virtual void CreateInputContext( | 44 virtual void CreateInputContext( |
48 const std::string& client_name, | 45 const std::string& client_name, |
49 const CreateInputContextCallback& callback, | 46 const CreateInputContextCallback& callback, |
50 const ErrorCallback& error_callback) = 0; | 47 const ErrorCallback& error_callback) = 0; |
51 | 48 |
52 // Requests the ibus-daemon to register new engine object. If succeeded, | 49 // Requests the ibus-daemon to register new engine object. If succeeded, |
53 // |callback| will be called. If failed, |error_callback| is called instead. | 50 // |callback| will be called. If failed, |error_callback| is called instead. |
54 virtual void RegisterComponent( | 51 virtual void RegisterComponent( |
55 const ibus::IBusComponent& ibus_component, | 52 const IBusComponent& ibus_component, |
56 const RegisterComponentCallback& callback, | 53 const RegisterComponentCallback& callback, |
57 const ErrorCallback& error_callback) = 0; | 54 const ErrorCallback& error_callback) = 0; |
58 | 55 |
59 // Requests the ibus-daemon to set global engine. If failed, |error_callback| | 56 // Requests the ibus-daemon to set global engine. If failed, |error_callback| |
60 // is called. | 57 // is called. |
61 virtual void SetGlobalEngine(const std::string& engine_name, | 58 virtual void SetGlobalEngine(const std::string& engine_name, |
62 const ErrorCallback& error_callback) = 0; | 59 const ErrorCallback& error_callback) = 0; |
63 | 60 |
64 // Requests the ibus-daemon to exit daemon process. If |option| is | 61 // Requests the ibus-daemon to exit daemon process. If |option| is |
65 // RESTART_IBUS_DAEMON, ibus-daemon will be relaunched. If |option| is | 62 // RESTART_IBUS_DAEMON, ibus-daemon will be relaunched. If |option| is |
(...skipping 10 matching lines...) Expand all Loading... |
76 // Create() should be used instead. | 73 // Create() should be used instead. |
77 IBusClient(); | 74 IBusClient(); |
78 | 75 |
79 private: | 76 private: |
80 DISALLOW_COPY_AND_ASSIGN(IBusClient); | 77 DISALLOW_COPY_AND_ASSIGN(IBusClient); |
81 }; | 78 }; |
82 | 79 |
83 } // namespace chromeos | 80 } // namespace chromeos |
84 | 81 |
85 #endif // CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ | 82 #endif // CHROMEOS_DBUS_IBUS_IBUS_CLIENT_H_ |
OLD | NEW |