Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / chromeos / dbus / ibus / ibus_config_client.h
bloba7a384a12819663f4d47cfcc8b49fd0762e2389e
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.
5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_CONFIG_CLIENT_H_
6 #define CHROMEOS_DBUS_IBUS_IBUS_CONFIG_CLIENT_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client_implementation_type.h"
15 #include "dbus/object_path.h"
17 namespace dbus {
18 class Bus;
19 } // namespace dbus
21 namespace chromeos {
23 class IBusComponent;
24 class IBusInputContextClient;
26 // A class to make the actual DBus calls for IBusConfig service.
27 class CHROMEOS_EXPORT IBusConfigClient {
28 public:
29 typedef base::Callback<void()> ErrorCallback;
30 typedef base::Callback<void()> OnIBusConfigReady;
31 virtual ~IBusConfigClient();
33 // Initializes IBusConfig asynchronously. |on_ready| will be called if it is
34 // ready.
35 virtual void InitializeAsync(const OnIBusConfigReady& on_ready) = 0;
37 // Requests the IBusConfig to set a string value.
38 virtual void SetStringValue(const std::string& section,
39 const std::string& key,
40 const std::string& value,
41 const ErrorCallback& error_callback) = 0;
43 // Requests the IBusConfig to set a integer value.
44 virtual void SetIntValue(const std::string& section,
45 const std::string& key,
46 int value,
47 const ErrorCallback& error_callback) = 0;
49 // Requests the IBusConfig to set a boolean value.
50 virtual void SetBoolValue(const std::string& section,
51 const std::string& key,
52 bool value,
53 const ErrorCallback& error_callback) = 0;
55 // Requests the IBusConfig to set multiple string values.
56 virtual void SetStringListValue(const std::string& section,
57 const std::string& key,
58 const std::vector<std::string>& value,
59 const ErrorCallback& error_callback) = 0;
61 // Factory function, creates a new instance and returns ownership.
62 // For normal usage, access the singleton via DBusThreadManager::Get().
63 static CHROMEOS_EXPORT IBusConfigClient* Create(
64 DBusClientImplementationType type,
65 dbus::Bus* bus);
67 protected:
68 // Create() should be used instead.
69 IBusConfigClient();
71 private:
72 DISALLOW_COPY_AND_ASSIGN(IBusConfigClient);
75 } // namespace chromeos
77 #endif // CHROMEOS_DBUS_IBUS_IBUS_CONFIG_CLIENT_H_