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 REMOTING_HOST_HOST_CONFIG_H_
6 #define REMOTING_HOST_HOST_CONFIG_H_
10 #include "base/basictypes.h"
13 class DictionaryValue
;
18 // Following constants define names for configuration parameters.
20 // Status of the host, whether it is enabled or disabled.
21 extern const char kHostEnabledConfigPath
[];
22 // Google account of the owner of this host.
23 extern const char kHostOwnerConfigPath
[];
24 // Login used to authenticate in XMPP network.
25 extern const char kXmppLoginConfigPath
[];
26 // Auth token used to authenticate to XMPP network.
27 extern const char kXmppAuthTokenConfigPath
[];
28 // OAuth refresh token used to fetch an access token for the XMPP network.
29 extern const char kOAuthRefreshTokenConfigPath
[];
30 // Auth service used to authenticate to XMPP network.
31 extern const char kXmppAuthServiceConfigPath
[];
32 // Unique identifier of the host used to register the host in directory.
33 // Normally a random UUID.
34 extern const char kHostIdConfigPath
[];
35 // Readable host name.
36 extern const char kHostNameConfigPath
[];
37 // Hash of the host secret used for authentication.
38 extern const char kHostSecretHashConfigPath
[];
39 // Private keys used for host authentication.
40 extern const char kPrivateKeyConfigPath
[];
41 // Whether consent is given for usage stats reporting.
42 extern const char kUsageStatsConsentConfigPath
[];
44 // HostConfig interace provides read-only access to host configuration.
48 virtual ~HostConfig() {}
50 virtual bool GetString(const std::string
& path
,
51 std::string
* out_value
) const = 0;
52 virtual bool GetBoolean(const std::string
& path
, bool* out_value
) const = 0;
55 DISALLOW_COPY_AND_ASSIGN(HostConfig
);
58 // MutableHostConfig extends HostConfig for mutability.
59 class MutableHostConfig
: public HostConfig
{
61 MutableHostConfig() {}
63 // SetString() updates specified config value. Save() must be called to save
64 // the changes on the disk.
65 virtual void SetString(const std::string
& path
,
66 const std::string
& in_value
) = 0;
67 virtual void SetBoolean(const std::string
& path
, bool in_value
) = 0;
69 // Copy configuration from specified |dictionary|. Returns false if the
70 // |dictionary| contains some values that cannot be saved in the config. In
71 // that case, all other values are still copied.
72 virtual bool CopyFrom(const base::DictionaryValue
* dictionary
) = 0;
75 virtual bool Save() = 0;
77 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig
);
80 } // namespace remoting
82 #endif // REMOTING_HOST_HOST_CONFIG_H_