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 // Base JID of the host owner (may not equal the email for non-gmail users).
23 extern const char kHostOwnerConfigPath
[];
24 // Email of the owner of this host.
25 extern const char kHostOwnerEmailConfigPath
[];
26 // Login used to authenticate in XMPP network (could be a service account).
27 extern const char kXmppLoginConfigPath
[];
28 // Auth token used to authenticate to XMPP network.
29 extern const char kXmppAuthTokenConfigPath
[];
30 // OAuth refresh token used to fetch an access token for the XMPP network.
31 extern const char kOAuthRefreshTokenConfigPath
[];
32 // Auth service used to authenticate to XMPP network.
33 extern const char kXmppAuthServiceConfigPath
[];
34 // Unique identifier of the host used to register the host in directory.
35 // Normally a random UUID.
36 extern const char kHostIdConfigPath
[];
37 // Readable host name.
38 extern const char kHostNameConfigPath
[];
39 // Hash of the host secret used for authentication.
40 extern const char kHostSecretHashConfigPath
[];
41 // Private keys used for host authentication.
42 extern const char kPrivateKeyConfigPath
[];
43 // Whether consent is given for usage stats reporting.
44 extern const char kUsageStatsConsentConfigPath
[];
45 // Whether to offer VP9 encoding to clients.
46 extern const char kEnableVp9ConfigPath
[];
47 // Number of Kibibytes of frame data to allow each client to record.
48 extern const char kFrameRecorderBufferKbConfigPath
[];
50 // HostConfig interace provides read-only access to host configuration.
54 virtual ~HostConfig() {}
56 virtual bool GetString(const std::string
& path
,
57 std::string
* out_value
) const = 0;
58 virtual bool GetBoolean(const std::string
& path
, bool* out_value
) const = 0;
61 DISALLOW_COPY_AND_ASSIGN(HostConfig
);
64 // MutableHostConfig extends HostConfig for mutability.
65 class MutableHostConfig
: public HostConfig
{
67 MutableHostConfig() {}
69 // SetString() updates specified config value. Save() must be called to save
70 // the changes on the disk.
71 virtual void SetString(const std::string
& path
,
72 const std::string
& in_value
) = 0;
73 virtual void SetBoolean(const std::string
& path
, bool in_value
) = 0;
75 // Copy configuration from specified |dictionary|. Returns false if the
76 // |dictionary| contains some values that cannot be saved in the config. In
77 // that case, all other values are still copied.
78 virtual bool CopyFrom(const base::DictionaryValue
* dictionary
) = 0;
81 virtual bool Save() = 0;
83 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig
);
86 } // namespace remoting
88 #endif // REMOTING_HOST_HOST_CONFIG_H_