Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: remoting/host/host_config.h

Issue 10007048: Cleanup and simplify HostConfig and JsonHostConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 REMOTING_HOST_HOST_CONFIG_H_ 5 #ifndef REMOTING_HOST_HOST_CONFIG_H_
6 #define REMOTING_HOST_HOST_CONFIG_H_ 6 #define REMOTING_HOST_HOST_CONFIG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/basictypes.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 13
14 // Following constants define names for configuration parameters. 14 // Following constants define names for configuration parameters.
15 15
16 // Status of the host, whether it is enabled or disabled. 16 // Status of the host, whether it is enabled or disabled.
17 extern const char kHostEnabledConfigPath[]; 17 extern const char kHostEnabledConfigPath[];
18 // Login used to authenticate in XMPP network. 18 // Login used to authenticate in XMPP network.
19 extern const char kXmppLoginConfigPath[]; 19 extern const char kXmppLoginConfigPath[];
20 // Auth token used to authenticate to XMPP network. 20 // Auth token used to authenticate to XMPP network.
21 extern const char kXmppAuthTokenConfigPath[]; 21 extern const char kXmppAuthTokenConfigPath[];
22 // OAuth refresh token used to fetch an access token for the XMPP network. 22 // OAuth refresh token used to fetch an access token for the XMPP network.
23 extern const char kOAuthRefreshTokenConfigPath[]; 23 extern const char kOAuthRefreshTokenConfigPath[];
24 // Auth service used to authenticate to XMPP network. 24 // Auth service used to authenticate to XMPP network.
25 extern const char kXmppAuthServiceConfigPath[]; 25 extern const char kXmppAuthServiceConfigPath[];
26 // Unique identifier of the host used to register the host in directory. 26 // Unique identifier of the host used to register the host in directory.
27 // Normally a random UUID. 27 // Normally a random UUID.
28 extern const char kHostIdConfigPath[]; 28 extern const char kHostIdConfigPath[];
29 // Readable host name. 29 // Readable host name.
30 extern const char kHostNameConfigPath[]; 30 extern const char kHostNameConfigPath[];
31 // Hash of the host secret used for authentication. 31 // Hash of the host secret used for authentication.
32 extern const char kHostSecretHashConfigPath[]; 32 extern const char kHostSecretHashConfigPath[];
33 // Private keys used for host authentication. 33 // Private keys used for host authentication.
34 extern const char kPrivateKeyConfigPath[]; 34 extern const char kPrivateKeyConfigPath[];
35 35
36 // HostConfig interace provides read-only access to host configuration. 36 // HostConfig interace provides read-only access to host configuration.
37 class HostConfig : public base::RefCountedThreadSafe<HostConfig> { 37 class HostConfig {
38 public: 38 public:
39 HostConfig() {} 39 HostConfig() {}
40 virtual ~HostConfig() {} 40 virtual ~HostConfig() {}
41 41
42 virtual bool GetString(const std::string& path, std::string* out_value) = 0; 42 virtual bool GetString(const std::string& path,
43 virtual bool GetBoolean(const std::string& path, bool* out_value) = 0; 43 std::string* out_value) const = 0;
44 virtual bool GetBoolean(const std::string& path, bool* out_value) const = 0;
44 45
46 private:
45 DISALLOW_COPY_AND_ASSIGN(HostConfig); 47 DISALLOW_COPY_AND_ASSIGN(HostConfig);
46 }; 48 };
47 49
48 // MutableHostConfig extends HostConfig for mutability. 50 // MutableHostConfig extends HostConfig for mutability.
49 class MutableHostConfig : public HostConfig { 51 class MutableHostConfig : public HostConfig {
50 public: 52 public:
51 MutableHostConfig() {} 53 MutableHostConfig() {}
52 54
53 // SetString() updates specified config value. Save() must be called to save 55 // SetString() updates specified config value. Save() must be called to save
54 // the changes on the disk. 56 // the changes on the disk.
55 virtual void SetString(const std::string& path, 57 virtual void SetString(const std::string& path,
56 const std::string& in_value) = 0; 58 const std::string& in_value) = 0;
57 virtual void SetBoolean(const std::string& path, bool in_value) = 0; 59 virtual void SetBoolean(const std::string& path, bool in_value) = 0;
58 60
59 // Save's changes. 61 // Save's changes.
Lambros 2012/04/06 22:26:46 nit: "Save" or "Saves", no apostrophe.
Sergey Ulanov 2012/04/06 22:32:53 Done.
60 virtual void Save() = 0; 62 virtual bool Save() = 0;
61 63
62 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); 64 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig);
63 }; 65 };
64 66
65 } // namespace remoting 67 } // namespace remoting
66 68
67 #endif // REMOTING_HOST_HOST_CONFIG_H_ 69 #endif // REMOTING_HOST_HOST_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698