summaryrefslogtreecommitdiffstats
path: root/base/env_var.h
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-03 01:05:39 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-03 01:05:39 +0000
commit9bc8cff2f20eb98d86cfa77f5e75b5b3efc80ced (patch)
tree969fefb9d6c5d42d974fccd4d640861dc880a73d /base/env_var.h
parentd5c8101d795d43c265d81277305958d38160ab19 (diff)
downloadchromium_src-9bc8cff2f20eb98d86cfa77f5e75b5b3efc80ced.zip
chromium_src-9bc8cff2f20eb98d86cfa77f5e75b5b3efc80ced.tar.gz
chromium_src-9bc8cff2f20eb98d86cfa77f5e75b5b3efc80ced.tar.bz2
Move EnvironmentVariableGetter from base/linux_util.h to base/env_var.h and rename it EnvVarGetter. Label base::SysInfo::{Get,Has}EnvVar as deprecated.
BUG=none TEST=none Review URL: http://codereview.chromium.org/1606007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/env_var.h')
-rw-r--r--base/env_var.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/base/env_var.h b/base/env_var.h
new file mode 100644
index 0000000..af1ec79
--- /dev/null
+++ b/base/env_var.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ENV_VAR_H_
+#define BASE_ENV_VAR_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+
+namespace base {
+
+// These are used to derive mocks for unittests.
+class EnvVarGetter {
+ public:
+ virtual ~EnvVarGetter() {}
+ // Gets an environment variable's value and stores it in |result|.
+ // Returns false if the key is unset.
+ virtual bool GetEnv(const char* variable_name, std::string* result) = 0;
+
+ // Syntactic sugar for GetEnv(variable_name, NULL);
+ virtual bool HasEnv(const char* variable_name) {
+ return GetEnv(variable_name, NULL);
+ }
+
+ // Create an instance of EnvVarGetter
+ static EnvVarGetter* Create();
+};
+
+} // namespace base
+
+#endif // BASE_ENV_VAR_H_