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_CONFIG_CLIENT_H_ 6 #define CHROMEOS_DBUS_IBUS_IBUS_CONFIG_CLIENT_H_ 7 8 #include <string> 9 #include <vector> 10 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" 16 17 namespace dbus { 18 class Bus; 19 } // namespace dbus 20 21 namespace chromeos { 22 23 class IBusComponent; 24 class IBusInputContextClient; 25 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(); 32 33 // Initializes IBusConfig asynchronously. |on_ready| will be called if it is 34 // ready. 35 virtual void InitializeAsync(const OnIBusConfigReady& on_ready) = 0; 36 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; 42 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; 48 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; 54 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; 60 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); 66 67 protected: 68 // Create() should be used instead. 69 IBusConfigClient(); 70 71 private: 72 DISALLOW_COPY_AND_ASSIGN(IBusConfigClient); 73 }; 74 75 } // namespace chromeos 76 77 #endif // CHROMEOS_DBUS_IBUS_IBUS_CONFIG_CLIENT_H_ 78