15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef REMOTING_HOST_HOST_CONFIG_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define REMOTING_HOST_HOST_CONFIG_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace base { 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DictionaryValue; 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace base 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace remoting { 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Following constants define names for configuration parameters. 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Status of the host, whether it is enabled or disabled. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kHostEnabledConfigPath[]; 221675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch// Base JID of the host owner (may not equal the email for non-gmail users). 233551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)extern const char kHostOwnerConfigPath[]; 241675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch// Email of the owner of this host. 251675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdochextern const char kHostOwnerEmailConfigPath[]; 261675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch// Login used to authenticate in XMPP network (could be a service account). 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kXmppLoginConfigPath[]; 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Auth token used to authenticate to XMPP network. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kXmppAuthTokenConfigPath[]; 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// OAuth refresh token used to fetch an access token for the XMPP network. 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kOAuthRefreshTokenConfigPath[]; 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Auth service used to authenticate to XMPP network. 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kXmppAuthServiceConfigPath[]; 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Unique identifier of the host used to register the host in directory. 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Normally a random UUID. 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kHostIdConfigPath[]; 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Readable host name. 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kHostNameConfigPath[]; 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Hash of the host secret used for authentication. 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kHostSecretHashConfigPath[]; 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Private keys used for host authentication. 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char kPrivateKeyConfigPath[]; 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Whether consent is given for usage stats reporting. 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)extern const char kUsageStatsConsentConfigPath[]; 45f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// Whether to offer VP9 encoding to clients. 46f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)extern const char kEnableVp9ConfigPath[]; 475f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Number of Kibibytes of frame data to allow each client to record. 485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)extern const char kFrameRecorderBufferKbConfigPath[]; 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// HostConfig interace provides read-only access to host configuration. 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HostConfig { 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) HostConfig() {} 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~HostConfig() {} 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool GetString(const std::string& path, 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::string* out_value) const = 0; 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool GetBoolean(const std::string& path, bool* out_value) const = 0; 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(HostConfig); 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// MutableHostConfig extends HostConfig for mutability. 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MutableHostConfig : public HostConfig { 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MutableHostConfig() {} 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // SetString() updates specified config value. Save() must be called to save 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the changes on the disk. 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetString(const std::string& path, 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& in_value) = 0; 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetBoolean(const std::string& path, bool in_value) = 0; 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Copy configuration from specified |dictionary|. Returns false if the 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |dictionary| contains some values that cannot be saved in the config. In 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // that case, all other values are still copied. 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool CopyFrom(const base::DictionaryValue* dictionary) = 0; 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Saves changes. 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool Save() = 0; 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace remoting 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // REMOTING_HOST_HOST_CONFIG_H_ 89