Log the freshness of the Variations seed in a histogram.
[chromium-blink-merge.git] / base / environment.h
blob5160ff2469f974786d089af4cc0dc07caa494b20
1 // Copyright (c) 2011 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 BASE_ENVIRONMENT_H_
6 #define BASE_ENVIRONMENT_H_
8 #include <string>
10 #include "base/base_export.h"
11 #include "build/build_config.h"
13 namespace base {
15 namespace env_vars {
17 #if defined(OS_POSIX)
18 BASE_EXPORT extern const char kHome[];
19 #endif
21 } // namespace env_vars
23 class BASE_EXPORT Environment {
24 public:
25 virtual ~Environment();
27 // Static factory method that returns the implementation that provide the
28 // appropriate platform-specific instance.
29 static Environment* Create();
31 // Gets an environment variable's value and stores it in |result|.
32 // Returns false if the key is unset.
33 virtual bool GetVar(const char* variable_name, std::string* result) = 0;
35 // Syntactic sugar for GetVar(variable_name, NULL);
36 virtual bool HasVar(const char* variable_name);
38 // Returns true on success, otherwise returns false.
39 virtual bool SetVar(const char* variable_name,
40 const std::string& new_value) = 0;
42 // Returns true on success, otherwise returns false.
43 virtual bool UnSetVar(const char* variable_name) = 0;
46 } // namespace base
48 #endif // BASE_ENVIRONMENT_H_