diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 03:00:50 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 03:00:50 +0000 |
commit | 76b90d310def447b7b5f10d92a69813308150778 (patch) | |
tree | 24c61fdccf94360913bfa8f7ac67c24a27bcfb38 | |
parent | 7f2a9dbe56bfa6189271af808c53ccaee193a961 (diff) | |
download | chromium_src-76b90d310def447b7b5f10d92a69813308150778.zip chromium_src-76b90d310def447b7b5f10d92a69813308150778.tar.gz chromium_src-76b90d310def447b7b5f10d92a69813308150778.tar.bz2 |
base: Rename EnvVarGetter to Environment.
Now EnvVarGetter do much more than getting environment variables.
Per suggestion from Pawel in http://codereview.chromium.org/3043018/.
BUG=None
TEST=trybots
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Review URL: http://codereview.chromium.org/3052034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54696 0039d316-1c4b-4281-b951-d872f2087c98
48 files changed, 192 insertions, 197 deletions
diff --git a/app/gtk_util.cc b/app/gtk_util.cc index 63fa96a..98e5d48 100644 --- a/app/gtk_util.cc +++ b/app/gtk_util.cc @@ -7,7 +7,7 @@ #include <gtk/gtk.h> #include "app/l10n_util.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/logging.h" #include "base/string_number_conversions.h" #include "base/xdg_util.h" @@ -77,7 +77,7 @@ void GetWidgetSizeFromCharacters( void ApplyMessageDialogQuirks(GtkWidget* dialog) { if (gtk_window_get_modal(GTK_WINDOW(dialog))) { // Work around a KDE 3 window manager bug. - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (base::DESKTOP_ENVIRONMENT_KDE3 == GetDesktopEnvironment(env.get())) gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE); } diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc index 58d0a98f..8d26b92 100644 --- a/app/l10n_util_unittest.cc +++ b/app/l10n_util_unittest.cc @@ -15,7 +15,7 @@ #include "app/test/data/resource.h" #endif #include "base/basictypes.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/stl_util-inl.h" @@ -139,7 +139,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { icu::Locale locale = icu::Locale::getDefault(); #if defined(OS_POSIX) && !defined(OS_CHROMEOS) - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); // Test the support of LANGUAGE environment variable. SetICUDefaultLocale("en-US"); diff --git a/base/base.gyp b/base/base.gyp index 77f8de1..213b5f3 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -1,4 +1,4 @@ -# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# 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. @@ -76,7 +76,7 @@ 'data_pack_unittest.cc', 'debug_util_unittest.cc', 'dir_reader_posix_unittest.cc', - 'env_var_unittest.cc', + 'environment_unittest.cc', 'event_trace_consumer_win_unittest.cc', 'event_trace_controller_win_unittest.cc', 'event_trace_provider_win_unittest.cc', diff --git a/base/base.gypi b/base/base.gypi index 75fcf5b..62b3de3 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -63,8 +63,8 @@ 'dir_reader_fallback.h', 'dir_reader_linux.h', 'dir_reader_posix.h', - 'env_var.cc', - 'env_var.h', + 'environment.cc', + 'environment.h', 'event_trace_consumer_win.h', 'event_trace_controller_win.cc', 'event_trace_controller_win.h', diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc index 710d799..8412009 100644 --- a/base/base_paths_posix.cc +++ b/base/base_paths_posix.cc @@ -12,7 +12,7 @@ #include <sys/sysctl.h> #endif -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" @@ -61,7 +61,7 @@ bool PathProviderPosix(int key, FilePath* result) { case base::DIR_SOURCE_ROOT: { // Allow passing this in the environment, for more flexibility in build // tree configurations (sub-project builds, gyp --output_dir, etc.) - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string cr_source_root; if (env->GetEnv("CR_SOURCE_ROOT", &cr_source_root)) { path = FilePath(cr_source_root); @@ -104,7 +104,7 @@ bool PathProviderPosix(int key, FilePath* result) { return false; } case base::DIR_USER_CACHE: - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", ".cache")); *result = cache_dir; diff --git a/base/env_var.cc b/base/environment.cc index 71d9c53..2ebdd43 100644 --- a/base/env_var.cc +++ b/base/environment.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" +#include "base/environment.h" #if defined(OS_POSIX) #include <stdlib.h> @@ -19,7 +19,7 @@ namespace { -class EnvVarGetterImpl : public base::EnvVarGetter { +class EnvironmentImpl : public base::Environment { public: virtual bool GetEnv(const char* variable_name, std::string* result) { if (GetEnvImpl(variable_name, result)) @@ -112,14 +112,14 @@ const char kHome[] = "HOME"; } // namespace env_vars -EnvVarGetter::~EnvVarGetter() {} +Environment::~Environment() {} // static -EnvVarGetter* EnvVarGetter::Create() { - return new EnvVarGetterImpl(); +Environment* Environment::Create() { + return new EnvironmentImpl(); } -bool EnvVarGetter::HasEnv(const char* variable_name) { +bool Environment::HasEnv(const char* variable_name) { return GetEnv(variable_name, NULL); } diff --git a/base/env_var.h b/base/environment.h index 43d3fd6..a586ae8 100644 --- a/base/env_var.h +++ b/base/environment.h @@ -2,8 +2,8 @@ // 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_ +#ifndef BASE_ENVIRONMENT_H_ +#define BASE_ENVIRONMENT_H_ #pragma once #include <string> @@ -20,13 +20,13 @@ extern const char kHome[]; } // namespace env_vars -class EnvVarGetter { +class Environment { public: - virtual ~EnvVarGetter(); + virtual ~Environment(); // Static factory method that returns the implementation that provide the // appropriate platform-specific instance. - static EnvVarGetter* Create(); + static Environment* Create(); // Gets an environment variable's value and stores it in |result|. // Returns false if the key is unset. @@ -45,4 +45,4 @@ class EnvVarGetter { } // namespace base -#endif // BASE_ENV_VAR_H_ +#endif // BASE_ENVIRONMENT_H_ diff --git a/base/env_var_unittest.cc b/base/environment_unittest.cc index f05a9b4..5b4ddc3 100644 --- a/base/env_var_unittest.cc +++ b/base/environment_unittest.cc @@ -2,29 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" +#include "base/environment.h" #include "base/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -typedef PlatformTest EnvVarTest; +typedef PlatformTest EnvironmentTest; -TEST_F(EnvVarTest, GetEnvVar) { +TEST_F(EnvironmentTest, GetEnvVar) { // Every setup should have non-empty PATH... - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string env_value; EXPECT_TRUE(env->GetEnv("PATH", &env_value)); EXPECT_NE(env_value, ""); } -TEST_F(EnvVarTest, HasEnvVar) { +TEST_F(EnvironmentTest, HasEnvVar) { // Every setup should have PATH... - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); EXPECT_TRUE(env->HasEnv("PATH")); } -TEST_F(EnvVarTest, SetEnvVar) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); +TEST_F(EnvironmentTest, SetEnvVar) { + scoped_ptr<base::Environment> env(base::Environment::Create()); const char kFooUpper[] = "FOO"; const char kFooLower[] = "foo"; @@ -38,8 +38,8 @@ TEST_F(EnvVarTest, SetEnvVar) { EXPECT_EQ(var_value, kFooLower); } -TEST_F(EnvVarTest, UnSetEnvVar) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); +TEST_F(EnvironmentTest, UnSetEnvVar) { + scoped_ptr<base::Environment> env(base::Environment::Create()); const char kFooUpper[] = "FOO"; const char kFooLower[] = "foo"; diff --git a/base/linux_util.cc b/base/linux_util.cc index dda6333..b8c78e4 100644 --- a/base/linux_util.cc +++ b/base/linux_util.cc @@ -17,7 +17,6 @@ #include <vector> #include "base/command_line.h" -#include "base/env_var.h" #include "base/file_util.h" #include "base/lock.h" #include "base/path_service.h" diff --git a/base/linux_util.h b/base/linux_util.h index 8216d40..45887db 100644 --- a/base/linux_util.h +++ b/base/linux_util.h @@ -15,8 +15,6 @@ class FilePath; namespace base { -class EnvVarGetter; - static const char kFindInodeSwitch[] = "--find-inode"; // Get the Linux Distro if we can, or return "Unknown", similar to diff --git a/base/nss_util.cc b/base/nss_util.cc index cc61bdf..0d7ec07 100644 --- a/base/nss_util.cc +++ b/base/nss_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2010 The Chromium Authors. All rights reserved. +// 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. @@ -28,7 +28,7 @@ // use NSS for crypto or certificate verification, and we don't use the NSS // certificate and key databases. #if defined(USE_NSS) -#include "base/env_var.h" +#include "base/environment.h" #include "base/lock.h" #include "base/scoped_ptr.h" #endif // defined(USE_NSS) @@ -80,7 +80,7 @@ void UseLocalCacheOfNSSDatabaseIfNFS(const FilePath& database_dir) { struct statfs buf; if (statfs(database_dir.value().c_str(), &buf) == 0) { if (buf.f_type == NFS_SUPER_MAGIC) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); const char* use_cache_env_var = "NSS_SDB_USE_CACHE"; if (!env->HasEnv(use_cache_env_var)) env->SetEnv(use_cache_env_var, "yes"); diff --git a/base/xdg_util.cc b/base/xdg_util.cc index 0ff6c47..426ef0e 100644 --- a/base/xdg_util.cc +++ b/base/xdg_util.cc @@ -4,14 +4,14 @@ #include "base/xdg_util.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h" namespace base { -FilePath GetXDGDirectory(EnvVarGetter* env, const char* env_name, +FilePath GetXDGDirectory(Environment* env, const char* env_name, const char* fallback_dir) { std::string env_value; if (env->GetEnv(env_name, &env_value) && !env_value.empty()) @@ -19,7 +19,7 @@ FilePath GetXDGDirectory(EnvVarGetter* env, const char* env_name, return file_util::GetHomeDir().Append(fallback_dir); } -FilePath GetXDGUserDirectory(EnvVarGetter* env, const char* dir_name, +FilePath GetXDGUserDirectory(Environment* env, const char* dir_name, const char* fallback_dir) { char* xdg_dir = xdg_user_dir_lookup(dir_name); if (xdg_dir) { @@ -30,7 +30,7 @@ FilePath GetXDGUserDirectory(EnvVarGetter* env, const char* dir_name, return file_util::GetHomeDir().Append(fallback_dir); } -DesktopEnvironment GetDesktopEnvironment(EnvVarGetter* env) { +DesktopEnvironment GetDesktopEnvironment(Environment* env) { std::string desktop_session; if (env->GetEnv("DESKTOP_SESSION", &desktop_session)) { if (desktop_session == "gnome") { @@ -76,7 +76,7 @@ const char* GetDesktopEnvironmentName(DesktopEnvironment env) { return NULL; } -const char* GetDesktopEnvironmentName(EnvVarGetter* env) { +const char* GetDesktopEnvironmentName(Environment* env) { return GetDesktopEnvironmentName(GetDesktopEnvironment(env)); } diff --git a/base/xdg_util.h b/base/xdg_util.h index 33d81d8..c0788c8e 100644 --- a/base/xdg_util.h +++ b/base/xdg_util.h @@ -14,20 +14,20 @@ class FilePath; namespace base { -class EnvVarGetter; +class Environment; // Utility function for getting XDG directories. // |env_name| is the name of an environment variable that we want to use to get // a directory path. |fallback_dir| is the directory relative to $HOME that we // use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL. // Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME. -FilePath GetXDGDirectory(EnvVarGetter* env, const char* env_name, +FilePath GetXDGDirectory(Environment* env, const char* env_name, const char* fallback_dir); // Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs // This looks up "well known" user directories like the desktop and music // folder. Examples of |dir_name| are DESKTOP and MUSIC. -FilePath GetXDGUserDirectory(EnvVarGetter* env, const char* dir_name, +FilePath GetXDGUserDirectory(Environment* env, const char* dir_name, const char* fallback_dir); enum DesktopEnvironment { @@ -44,13 +44,13 @@ enum DesktopEnvironment { // of which desktop environment we're using. We use this to know when // to attempt to use preferences from the desktop environment -- // proxy settings, password manager, etc. -DesktopEnvironment GetDesktopEnvironment(EnvVarGetter* env); +DesktopEnvironment GetDesktopEnvironment(Environment* env); // Return a string representation of the given desktop environment. // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER. const char* GetDesktopEnvironmentName(DesktopEnvironment env); // Convenience wrapper that calls GetDesktopEnvironment() first. -const char* GetDesktopEnvironmentName(EnvVarGetter* env); +const char* GetDesktopEnvironmentName(Environment* env); } // namespace base diff --git a/base/xdg_util_unittest.cc b/base/xdg_util_unittest.cc index 24671b1..c876466 100644 --- a/base/xdg_util_unittest.cc +++ b/base/xdg_util_unittest.cc @@ -4,7 +4,7 @@ #include "base/xdg_util.h" -#include "base/env_var.h" +#include "base/environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -15,7 +15,7 @@ using ::testing::StrEq; namespace { -class MockEnvVarGetter : public base::EnvVarGetter { +class MockEnvironment : public base::Environment { public: MOCK_METHOD2(GetEnv, bool(const char*, std::string* result)); MOCK_METHOD2(SetEnv, bool(const char*, const std::string& new_value)); @@ -30,7 +30,7 @@ const char* kXFCE = "xfce"; } // namespace TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { - MockEnvVarGetter getter; + MockEnvironment getter; EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kGnome), Return(true))); @@ -40,7 +40,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { } TEST(XDGUtilTest, GetDesktopEnvironmentKDE4) { - MockEnvVarGetter getter; + MockEnvironment getter; EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kKDE4), Return(true))); @@ -50,7 +50,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentKDE4) { } TEST(XDGUtilTest, GetDesktopEnvironmentKDE3) { - MockEnvVarGetter getter; + MockEnvironment getter; EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kKDE), Return(true))); @@ -60,7 +60,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentKDE3) { } TEST(XDGUtilTest, GetDesktopEnvironmentXFCE) { - MockEnvVarGetter getter; + MockEnvironment getter; EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kXFCE), Return(true))); diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 66c8b35..c5d8355 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -8,7 +8,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/event_recorder.h" #include "base/histogram.h" #include "base/path_service.h" @@ -312,7 +312,7 @@ LaunchMode GetLaunchShortcutKind() { // The windows quick launch path is not localized. if (shortcut.find(L"\\Quick Launch\\") != std::wstring::npos) return LM_SHORTCUT_QUICKLAUNCH; - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string appdata_path; env->GetEnv("USERPROFILE", &appdata_path); if (!appdata_path.empty() && diff --git a/chrome/browser/dom_ui/advanced_options_utils_gtk.cc b/chrome/browser/dom_ui/advanced_options_utils_gtk.cc index 6cbf8d6..95c4824 100644 --- a/chrome/browser/dom_ui/advanced_options_utils_gtk.cc +++ b/chrome/browser/dom_ui/advanced_options_utils_gtk.cc @@ -9,7 +9,7 @@ #include "app/gtk_signal.h" #include "app/gtk_util.h" #include "base/file_util.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/process_util.h" #include "base/string_tokenizer.h" #include "base/xdg_util.h" @@ -81,11 +81,11 @@ static void StartProxyConfigUtil(const ProxyConfigCommand& command) { void AdvancedOptionsUtilities::ShowNetworkProxySettings( TabContents* tab_contents) { - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); ProxyConfigCommand command; bool found_command = false; - switch (base::GetDesktopEnvironment(env_getter.get())) { + switch (base::GetDesktopEnvironment(env.get())) { case base::DESKTOP_ENVIRONMENT_GNOME: { size_t index; ProxyConfigCommand commands[2]; @@ -115,7 +115,7 @@ void AdvancedOptionsUtilities::ShowNetworkProxySettings( if (found_command) { StartProxyConfigUtil(command); } else { - const char* name = base::GetDesktopEnvironmentName(env_getter.get()); + const char* name = base::GetDesktopEnvironmentName(env.get()); if (name) LOG(ERROR) << "Could not find " << name << " network settings in $PATH"; tab_contents->OpenURL(GURL(kLinuxProxyConfigUrl), GURL(), diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc index 41eebda8..0d41355 100644 --- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc @@ -8,7 +8,7 @@ #include "app/gtk_util.h" #include "app/l10n_util.h" -#include "base/env_var.h" +#include "base/environment.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/gtk/gtk_util.h" #include "chrome/browser/shell_integration.h" @@ -187,10 +187,10 @@ void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string shortcut_template; - if (ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), + if (ShellIntegration::GetDesktopShortcutTemplate(env.get(), &shortcut_template)) { ShellIntegration::CreateDesktopShortcut(shortcut_info, shortcut_template); diff --git a/chrome/browser/gtk/gconf_titlebar_listener.cc b/chrome/browser/gtk/gconf_titlebar_listener.cc index 109ed996..b33ab17 100644 --- a/chrome/browser/gtk/gconf_titlebar_listener.cc +++ b/chrome/browser/gtk/gconf_titlebar_listener.cc @@ -7,7 +7,7 @@ #include <gtk/gtk.h> #include "base/scoped_ptr.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/xdg_util.h" #include "chrome/browser/gtk/browser_titlebar.h" @@ -45,8 +45,8 @@ void GConfTitlebarListener::RemoveObserver(BrowserTitlebar* titlebar) { // Private: GConfTitlebarListener::GConfTitlebarListener() : client_(NULL) { - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); - if (base::GetDesktopEnvironment(env_getter.get()) == + scoped_ptr<base::Environment> env(base::Environment::Create()); + if (base::GetDesktopEnvironment(env.get()) == base::DESKTOP_ENVIRONMENT_GNOME) { client_ = gconf_client_get_default(); // If we fail to get a context, that's OK, since we'll just fallback on diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 9a982d0..577c6d1 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -10,7 +10,7 @@ #include "app/gtk_signal_registrar.h" #include "app/resource_bundle.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/stl_util-inl.h" #include "base/xdg_util.h" #include "chrome/browser/metrics/user_metrics.h" @@ -563,9 +563,9 @@ GdkPixbuf* GtkThemeProvider::GetDefaultFavicon(bool native) { // static bool GtkThemeProvider::DefaultUsesSystemTheme() { - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); - switch (base::GetDesktopEnvironment(env_getter.get())) { + switch (base::GetDesktopEnvironment(env.get())) { case base::DESKTOP_ENVIRONMENT_GNOME: case base::DESKTOP_ENVIRONMENT_XFCE: return true; diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 1c12391..15650b2 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -14,7 +14,7 @@ #include "app/gtk_util.h" #include "app/l10n_util.h" #include "base/basictypes.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/process_util.h" @@ -421,11 +421,11 @@ void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button, section->UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"), NULL); - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); ProxyConfigCommand command; bool found_command = false; - switch (base::GetDesktopEnvironment(env_getter.get())) { + switch (base::GetDesktopEnvironment(env.get())) { case base::DESKTOP_ENVIRONMENT_GNOME: { size_t index; ProxyConfigCommand commands[2]; @@ -455,7 +455,7 @@ void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button, if (found_command) { StartProxyConfigUtil(command); } else { - const char* name = base::GetDesktopEnvironmentName(env_getter.get()); + const char* name = base::GetDesktopEnvironmentName(env.get()); if (name) LOG(ERROR) << "Could not find " << name << " network settings in $PATH"; BrowserList::GetLastActive()-> diff --git a/chrome/browser/locale_tests_uitest.cc b/chrome/browser/locale_tests_uitest.cc index d5cb994..94cefdb 100644 --- a/chrome/browser/locale_tests_uitest.cc +++ b/chrome/browser/locale_tests_uitest.cc @@ -4,7 +4,7 @@ #include "chrome/test/ui/ui_test.h" -#include "base/env_var.h" +#include "base/environment.h" #include "build/build_config.h" class LocaleTestsBase : public UITest { @@ -15,7 +15,7 @@ class LocaleTestsBase : public UITest { protected: void RestoreLcAllEnvironment() { #if defined(OS_LINUX) - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (old_lc_all_) { env->SetEnv("LC_ALL", old_lc_all_); } else { diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 92b69db..3aad8f2 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -6,7 +6,7 @@ #include <algorithm> -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index f2cd905..02ac436 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -6,7 +6,6 @@ #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/env_var.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc index 6c085f7..7e8f133 100644 --- a/chrome/browser/profile_impl.cc +++ b/chrome/browser/profile_impl.cc @@ -6,7 +6,7 @@ #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" @@ -863,8 +863,8 @@ void ProfileImpl::CreatePasswordStore() { } else if (store_type == L"gnome") { desktop_env = base::DESKTOP_ENVIRONMENT_GNOME; } else if (store_type == L"detect") { - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); - desktop_env = base::GetDesktopEnvironment(env_getter.get()); + scoped_ptr<base::Environment> env(base::Environment::Create()); + desktop_env = base::GetDesktopEnvironment(env.get()); LOG(INFO) << "Password storage detected desktop environment: " << base::GetDesktopEnvironmentName(desktop_env); } else { diff --git a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc index 0af6cd2..6a428d4 100644 --- a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc +++ b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" +#include "base/environment.h" #include "base/message_loop.h" #include "base/process_util.h" #include "base/scoped_ptr.h" @@ -29,7 +29,7 @@ static const int kRouteId = 200; static const int kStreamId = 50; static bool IsRunningHeadless() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv("CHROME_HEADLESS")) return true; return false; diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 3e9d5db..886c805 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -5,7 +5,7 @@ #include "chrome/browser/safe_browsing/protocol_manager.h" #include "base/base64.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_version_info.h" #include "base/histogram.h" #include "base/logging.h" @@ -418,7 +418,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url, void SafeBrowsingProtocolManager::Initialize() { // Don't want to hit the safe browsing servers on build/chrome bots. - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv(env_vars::kHeadless)) return; diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 1080c30..23d0701 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -18,7 +18,7 @@ class FilePath; #if defined(USE_X11) namespace base { -class EnvVarGetter; +class Environment; } #endif @@ -78,7 +78,7 @@ class ShellIntegration { const string16& extension_app_id); #if defined(USE_X11) - static bool GetDesktopShortcutTemplate(base::EnvVarGetter* env_getter, + static bool GetDesktopShortcutTemplate(base::Environment* env, std::string* output); // Returns filename for .desktop file based on |url|, sanitized for security. diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 95b3e85..27b5a9b 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -15,7 +15,7 @@ #include "base/command_line.h" #include "base/eintr_wrapper.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/i18n/file_util_icu.h" @@ -41,7 +41,7 @@ namespace { -std::string GetDesktopName(base::EnvVarGetter* env_getter) { +std::string GetDesktopName(base::Environment* env) { #if defined(GOOGLE_CHROME_BUILD) return "google-chrome.desktop"; #else // CHROMIUM_BUILD @@ -49,7 +49,7 @@ std::string GetDesktopName(base::EnvVarGetter* env_getter) { // versions can set themselves as the default without interfering with // non-official, packaged versions using the built-in value. std::string name; - if (env_getter->GetEnv("CHROME_DESKTOP", &name) && !name.empty()) + if (env->GetEnv("CHROME_DESKTOP", &name) && !name.empty()) return name; return "chromium-browser.desktop"; #endif @@ -201,13 +201,13 @@ void CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename, // static bool ShellIntegration::SetAsDefaultBrowser() { - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::vector<std::string> argv; argv.push_back("xdg-settings"); argv.push_back("set"); argv.push_back("default-web-browser"); - argv.push_back(GetDesktopName(env_getter.get())); + argv.push_back(GetDesktopName(env.get())); return LaunchXdgUtility(argv); } @@ -215,13 +215,13 @@ bool ShellIntegration::SetAsDefaultBrowser() { ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::vector<std::string> argv; argv.push_back("xdg-settings"); argv.push_back("check"); argv.push_back("default-web-browser"); - argv.push_back(GetDesktopName(env_getter.get())); + argv.push_back(GetDesktopName(env.get())); std::string reply; if (!base::GetAppOutput(CommandLine(argv), &reply)) { @@ -248,19 +248,19 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() { // static bool ShellIntegration::GetDesktopShortcutTemplate( - base::EnvVarGetter* env_getter, std::string* output) { + base::Environment* env, std::string* output) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); std::vector<FilePath> search_paths; std::string xdg_data_home; - if (env_getter->GetEnv("XDG_DATA_HOME", &xdg_data_home) && + if (env->GetEnv("XDG_DATA_HOME", &xdg_data_home) && !xdg_data_home.empty()) { search_paths.push_back(FilePath(xdg_data_home)); } std::string xdg_data_dirs; - if (env_getter->GetEnv("XDG_DATA_DIRS", &xdg_data_dirs) && + if (env->GetEnv("XDG_DATA_DIRS", &xdg_data_dirs) && !xdg_data_dirs.empty()) { StringTokenizer tokenizer(xdg_data_dirs, ":"); while (tokenizer.GetNext()) { @@ -275,7 +275,7 @@ bool ShellIntegration::GetDesktopShortcutTemplate( search_paths.push_back(FilePath("/usr/share/applications")); search_paths.push_back(FilePath("/usr/local/share/applications")); - std::string template_filename(GetDesktopName(env_getter)); + std::string template_filename(GetDesktopName(env)); for (std::vector<FilePath>::const_iterator i = search_paths.begin(); i != search_paths.end(); ++i) { FilePath path = (*i).Append(template_filename); diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index dbaa290..708bf3c 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -21,7 +21,7 @@ #if defined(OS_WIN) #include "chrome/installer/util/browser_distribution.h" #elif defined(OS_LINUX) -#include "base/env_var.h" +#include "base/environment.h" #endif // defined(OS_LINUX) #define FPL FILE_PATH_LITERAL @@ -30,9 +30,9 @@ namespace { // Provides mock environment variables values based on a stored map. -class MockEnvVarGetter : public base::EnvVarGetter { +class MockEnvironment : public base::Environment { public: - MockEnvVarGetter() {} + MockEnvironment() {} void Set(const std::string& name, const std::string& value) { variables_[name] = value; @@ -60,7 +60,7 @@ class MockEnvVarGetter : public base::EnvVarGetter { private: std::map<std::string, std::string> variables_; - DISALLOW_COPY_AND_ASSIGN(MockEnvVarGetter); + DISALLOW_COPY_AND_ASSIGN(MockEnvironment); }; } // namespace @@ -82,13 +82,13 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - MockEnvVarGetter env_getter; - env_getter.Set("XDG_DATA_HOME", temp_dir.path().value()); + MockEnvironment env; + env.Set("XDG_DATA_HOME", temp_dir.path().value()); ASSERT_TRUE(file_util::WriteFile( temp_dir.path().AppendASCII(kTemplateFilename), kTestData1, strlen(kTestData1))); std::string contents; - ASSERT_TRUE(ShellIntegration::GetDesktopShortcutTemplate(&env_getter, + ASSERT_TRUE(ShellIntegration::GetDesktopShortcutTemplate(&env, &contents)); EXPECT_EQ(kTestData1, contents); } @@ -97,8 +97,8 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - MockEnvVarGetter env_getter; - env_getter.Set("XDG_DATA_DIRS", temp_dir.path().value()); + MockEnvironment env; + env.Set("XDG_DATA_DIRS", temp_dir.path().value()); ASSERT_TRUE(file_util::CreateDirectory( temp_dir.path().AppendASCII("applications"))); ASSERT_TRUE(file_util::WriteFile( @@ -106,7 +106,7 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { .AppendASCII(kTemplateFilename), kTestData2, strlen(kTestData2))); std::string contents; - ASSERT_TRUE(ShellIntegration::GetDesktopShortcutTemplate(&env_getter, + ASSERT_TRUE(ShellIntegration::GetDesktopShortcutTemplate(&env, &contents)); EXPECT_EQ(kTestData2, contents); } @@ -115,8 +115,8 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - MockEnvVarGetter env_getter; - env_getter.Set("XDG_DATA_DIRS", temp_dir.path().value() + ":" + + MockEnvironment env; + env.Set("XDG_DATA_DIRS", temp_dir.path().value() + ":" + temp_dir.path().AppendASCII("applications").value()); ASSERT_TRUE(file_util::CreateDirectory( temp_dir.path().AppendASCII("applications"))); @@ -128,7 +128,7 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { .AppendASCII(kTemplateFilename), kTestData2, strlen(kTestData2))); std::string contents; - ASSERT_TRUE(ShellIntegration::GetDesktopShortcutTemplate(&env_getter, + ASSERT_TRUE(ShellIntegration::GetDesktopShortcutTemplate(&env, &contents)); EXPECT_EQ(kTestData1, contents); } diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index df01bd5..dea6f74 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -33,7 +33,7 @@ #include "webkit/glue/dom_operations.h" #if defined(OS_LINUX) -#include "base/env_var.h" +#include "base/environment.h" #endif // defined(OS_LINUX) #if defined(OS_WIN) @@ -259,10 +259,10 @@ bool CreateShortcutTask::CreateShortcut() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); #if defined(OS_LINUX) - scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string shortcut_template; - if (!ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), + if (!ShellIntegration::GetDesktopShortcutTemplate(env.get(), &shortcut_template)) { return false; } diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc index 4d9189f..4ede333 100644 --- a/chrome/browser/zygote_host_linux.cc +++ b/chrome/browser/zygote_host_linux.cc @@ -11,7 +11,7 @@ #include "base/command_line.h" #include "base/eintr_wrapper.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/linux_util.h" #include "base/logging.h" #include "base/path_service.h" @@ -40,7 +40,7 @@ static void SaveSUIDUnsafeEnvironmentVariables() { if (!saved_envvar) continue; - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string value; if (env->GetEnv(envvar, &value)) env->SetEnv(saved_envvar, value); diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc index 32a9925..f0ff3fb 100644 --- a/chrome/common/chrome_paths_linux.cc +++ b/chrome/common/chrome_paths_linux.cc @@ -4,7 +4,7 @@ #include "chrome/common/chrome_paths_internal.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/scoped_ptr.h" #include "base/xdg_util.h" @@ -17,7 +17,7 @@ namespace chrome { // ~/.config/google-chrome/ for official builds. // (This also helps us sidestep issues with other apps grabbing ~/.chromium .) bool GetDefaultUserDataDirectory(FilePath* result) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); FilePath config_dir( base::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config")); #if defined(GOOGLE_CHROME_BUILD) @@ -29,7 +29,7 @@ bool GetDefaultUserDataDirectory(FilePath* result) { } bool GetChromeFrameUserDataDirectory(FilePath* result) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); FilePath config_dir( base::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config")); #if defined(GOOGLE_CHROME_BUILD) @@ -41,7 +41,7 @@ bool GetChromeFrameUserDataDirectory(FilePath* result) { } bool GetUserDocumentsDirectory(FilePath* result) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); *result = base::GetXDGUserDirectory(env.get(), "DOCUMENTS", "Documents"); return true; } @@ -49,7 +49,7 @@ bool GetUserDocumentsDirectory(FilePath* result) { // We respect the user's preferred download location, unless it is // ~ or their desktop directory, in which case we default to ~/Downloads. bool GetUserDownloadsDirectory(FilePath* result) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); *result = base::GetXDGUserDirectory(env.get(), "DOWNLOAD", "Downloads"); FilePath home = file_util::GetHomeDir(); @@ -68,7 +68,7 @@ bool GetUserDownloadsDirectory(FilePath* result) { } bool GetUserDesktop(FilePath* result) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); *result = base::GetXDGUserDirectory(env.get(), "DESKTOP", "Desktop"); return true; } diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index b93ca60..301ec13 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -33,7 +33,7 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/debug_util.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" @@ -197,7 +197,7 @@ void InitChromeLogging(const CommandLine& command_line, // headless mode to be configured either by the Environment // Variable or by the Command Line Switch. This is for // automated test purposes. - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv(env_vars::kHeadless) || command_line.HasSwitch(switches::kNoErrorDialogs)) SuppressDialogs(); @@ -240,7 +240,7 @@ void CleanupChromeLogging() { FilePath GetLogFileName() { std::string filename; - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->GetEnv(env_vars::kLogFileName, &filename) && !filename.empty()) { #if defined(OS_WIN) return FilePath(UTF8ToWide(filename).c_str()); diff --git a/chrome/common/logging_chrome_uitest.cc b/chrome/common/logging_chrome_uitest.cc index f92525e..2a2e89b 100644 --- a/chrome/common/logging_chrome_uitest.cc +++ b/chrome/common/logging_chrome_uitest.cc @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "base/command_line.h" -#include "base/env_var.h" +#include "base/environment.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/env_vars.h" #include "chrome/common/logging_chrome.h" @@ -25,7 +25,7 @@ class ChromeLoggingTest : public testing::Test { // Stores the current value of the log file name environment // variable and sets the variable to new_value. void SaveEnvironmentVariable(std::string new_value) { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (!env->GetEnv(env_vars::kLogFileName, &environment_filename_)) environment_filename_ = ""; @@ -35,7 +35,7 @@ class ChromeLoggingTest : public testing::Test { // Restores the value of the log file nave environment variable // previously saved by SaveEnvironmentVariable(). void RestoreEnvironmentVariable() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); env->SetEnv(env_vars::kLogFileName, environment_filename_); } diff --git a/chrome/common/process_watcher_win.cc b/chrome/common/process_watcher_win.cc index ed99780..8f37d3f 100644 --- a/chrome/common/process_watcher_win.cc +++ b/chrome/common/process_watcher_win.cc @@ -5,7 +5,7 @@ #include "chrome/common/process_watcher.h" #include "base/scoped_ptr.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/message_loop.h" #include "base/object_watcher.h" #include "chrome/common/env_vars.h" @@ -49,7 +49,7 @@ class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate { private: void KillProcess() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv(env_vars::kHeadless)) { // If running the distributed tests, give the renderer a little time // to figure out that the channel is shutdown and unwind. diff --git a/chrome/plugin/plugin_main_mac.mm b/chrome/plugin/plugin_main_mac.mm index 119f986..7c7c879 100644 --- a/chrome/plugin/plugin_main_mac.mm +++ b/chrome/plugin/plugin_main_mac.mm @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/chrome_application_mac.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/scoped_ptr.h" #include "base/string_util.h" #include "chrome/common/plugin_carbon_interpose_constants_mac.h" @@ -11,7 +11,7 @@ #if !defined(__LP64__) void TrimInterposeEnvironment() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string interpose_list; if (!env->GetEnv(plugin_interpose_strings::kDYLDInsertLibrariesKey, diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index e7df26d..77726e0 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -7,7 +7,7 @@ #include <vector> #include "base/command_line.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/keyboard_codes.h" #include "base/logging.h" @@ -131,7 +131,7 @@ AutomatedUITest::AutomatedUITest() base::StringToInt(str, &post_action_delay_); } } - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv(env_vars::kHeadless)) logging::SetLogReportHandler(SilentRuntimeReportHandler); } diff --git a/chrome/test/startup/shutdown_test.cc b/chrome/test/startup/shutdown_test.cc index 78f82bd..db4422e 100644 --- a/chrome/test/startup/shutdown_test.cc +++ b/chrome/test/startup/shutdown_test.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/platform_thread.h" @@ -70,7 +70,7 @@ class ShutdownTest : public UITest { UITest::ShutdownType shutdown_type) { const int kNumCyclesMax = 20; int numCycles = kNumCyclesMax; - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string numCyclesEnv; if (env->GetEnv(env_vars::kStartupTestsNumCycles, &numCyclesEnv) && base::StringToInt(numCyclesEnv, &numCycles)) { diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index 366be92..8369e8a 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/platform_thread.h" @@ -106,7 +106,7 @@ class StartupTest : public UITest { const int kNumCyclesMax = 20; int numCycles = kNumCyclesMax; - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string numCyclesEnv; if (env->GetEnv(env_vars::kStartupTestsNumCycles, &numCyclesEnv) && base::StringToInt(numCyclesEnv, &numCycles)) { diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc index dbcc191..b74593d 100644 --- a/chrome/test/ui/ui_test_suite.cc +++ b/chrome/test/ui/ui_test_suite.cc @@ -6,7 +6,7 @@ #include <string> -#include "base/env_var.h" +#include "base/environment.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/string_number_conversions.h" @@ -114,7 +114,7 @@ void UITestSuite::SuppressErrorDialogs() { #if defined(OS_WIN) void UITestSuite::LoadCrashService() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv(env_vars::kHeadless)) return; diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc index 71bd65a..a83972f 100644 --- a/courgette/encoded_program.cc +++ b/courgette/encoded_program.cc @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "base/env_var.h" +#include "base/environment.h" #include "base/logging.h" #include "base/scoped_ptr.h" #include "base/string_util.h" @@ -266,7 +266,7 @@ enum FieldSelect { static FieldSelect GetFieldSelect() { #if 1 // TODO(sra): Use better configuration. - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); std::string s; env->GetEnv("A_FIELDS", &s); if (!s.empty()) { diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc index 5242398..dfa7736 100644 --- a/media/audio/audio_input_controller_unittest.cc +++ b/media/audio/audio_input_controller_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" #include "base/basictypes.h" #include "base/waitable_event.h" #include "media/audio/audio_input_controller.h" diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc index 7839ec1..e64a00f 100644 --- a/media/audio/audio_output_controller_unittest.cc +++ b/media/audio/audio_output_controller_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/env_var.h" +#include "base/environment.h" #include "base/basictypes.h" #include "base/waitable_event.h" #include "media/audio/audio_output_controller.h" @@ -62,7 +62,7 @@ static bool HasAudioOutputDevices() { } static bool IsRunningHeadless() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->HasEnv("CHROME_HEADLESS")) return true; return false; diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index e38083d..b001c11 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -15,7 +15,7 @@ #include <map> -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" @@ -422,7 +422,7 @@ class GConfSettingGetterImplKDE : public ProxyConfigServiceLinux::GConfSettingGetter, public base::MessagePumpLibevent::Watcher { public: - explicit GConfSettingGetterImplKDE(base::EnvVarGetter* env_var_getter) + explicit GConfSettingGetterImplKDE(base::Environment* env_var_getter) : inotify_fd_(-1), notify_delegate_(NULL), indirect_manual_(false), auto_no_pac_(false), reversed_bypass_list_(false), env_var_getter_(env_var_getter), file_loop_(NULL) { @@ -879,7 +879,7 @@ class GConfSettingGetterImplKDE // We don't own |env_var_getter_|. It's safe to hold a pointer to it, since // both it and us are owned by ProxyConfigServiceLinux::Delegate, and have the // same lifetime. - base::EnvVarGetter* env_var_getter_; + base::Environment* env_var_getter_; // We cache these settings whenever we re-read the kioslaverc file. string_map_type string_table_; @@ -1051,7 +1051,7 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromGConf( return true; } -ProxyConfigServiceLinux::Delegate::Delegate(base::EnvVarGetter* env_var_getter) +ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter) : env_var_getter_(env_var_getter), glib_default_loop_(NULL), io_loop_(NULL) { // Figure out which GConfSettingGetterImpl to use, if any. @@ -1069,7 +1069,7 @@ ProxyConfigServiceLinux::Delegate::Delegate(base::EnvVarGetter* env_var_getter) } } -ProxyConfigServiceLinux::Delegate::Delegate(base::EnvVarGetter* env_var_getter, +ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter, GConfSettingGetter* gconf_getter) : env_var_getter_(env_var_getter), gconf_getter_(gconf_getter), glib_default_loop_(NULL), io_loop_(NULL) { @@ -1224,16 +1224,16 @@ void ProxyConfigServiceLinux::Delegate::OnDestroy() { } ProxyConfigServiceLinux::ProxyConfigServiceLinux() - : delegate_(new Delegate(base::EnvVarGetter::Create())) { + : delegate_(new Delegate(base::Environment::Create())) { } ProxyConfigServiceLinux::ProxyConfigServiceLinux( - base::EnvVarGetter* env_var_getter) + base::Environment* env_var_getter) : delegate_(new Delegate(env_var_getter)) { } ProxyConfigServiceLinux::ProxyConfigServiceLinux( - base::EnvVarGetter* env_var_getter, + base::Environment* env_var_getter, GConfSettingGetter* gconf_getter) : delegate_(new Delegate(env_var_getter, gconf_getter)) { } diff --git a/net/proxy/proxy_config_service_linux.h b/net/proxy/proxy_config_service_linux.h index 071ab4c..f3082fb 100644 --- a/net/proxy/proxy_config_service_linux.h +++ b/net/proxy/proxy_config_service_linux.h @@ -10,7 +10,7 @@ #include <vector> #include "base/basictypes.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/message_loop.h" #include "base/observer_list.h" #include "base/ref_counted.h" @@ -117,10 +117,10 @@ class ProxyConfigServiceLinux : public ProxyConfigService { public: // Constructor receives env var getter implementation to use, and // takes ownership of it. This is the normal constructor. - explicit Delegate(base::EnvVarGetter* env_var_getter); + explicit Delegate(base::Environment* env_var_getter); // Constructor receives gconf and env var getter implementations // to use, and takes ownership of them. Used for testing. - Delegate(base::EnvVarGetter* env_var_getter, + Delegate(base::Environment* env_var_getter, GConfSettingGetter* gconf_getter); // Synchronously obtains the proxy configuration. If gconf is // used, also enables gconf notification for setting @@ -182,7 +182,7 @@ class ProxyConfigServiceLinux : public ProxyConfigService { // carry the new config information. void SetNewProxyConfig(const ProxyConfig& new_config); - scoped_ptr<base::EnvVarGetter> env_var_getter_; + scoped_ptr<base::Environment> env_var_getter_; scoped_ptr<GConfSettingGetter> gconf_getter_; // Cached proxy configuration, to be returned by @@ -219,8 +219,8 @@ class ProxyConfigServiceLinux : public ProxyConfigService { // Usual constructor ProxyConfigServiceLinux(); // For testing: take alternate gconf and env var getter implementations. - explicit ProxyConfigServiceLinux(base::EnvVarGetter* env_var_getter); - ProxyConfigServiceLinux(base::EnvVarGetter* env_var_getter, + explicit ProxyConfigServiceLinux(base::Environment* env_var_getter); + ProxyConfigServiceLinux(base::Environment* env_var_getter, GConfSettingGetter* gconf_getter); virtual ~ProxyConfigServiceLinux() { diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 30c3311..5a8f292 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc @@ -78,9 +78,9 @@ struct SettingsTable { map_type settings; }; -class MockEnvVarGetter : public base::EnvVarGetter { +class MockEnvironment : public base::Environment { public: - MockEnvVarGetter() { + MockEnvironment() { #define ENTRY(x) table.settings[#x] = &values.x ENTRY(DESKTOP_SESSION); ENTRY(HOME); @@ -605,10 +605,10 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicGConfTest) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, tests[i].description.c_str())); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; + MockEnvironment* env = new MockEnvironment; MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter; SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter, gconf_getter)); + new ProxyConfigServiceLinux(env, gconf_getter)); ProxyConfig config; gconf_getter->values = tests[i].values; sync_config_getter.SetupAndInitialFetch(); @@ -895,12 +895,12 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicEnvTest) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, tests[i].description.c_str())); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; + MockEnvironment* env = new MockEnvironment; MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter; SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter, gconf_getter)); + new ProxyConfigServiceLinux(env, gconf_getter)); ProxyConfig config; - env_getter->values = tests[i].values; + env->values = tests[i].values; sync_config_getter.SetupAndInitialFetch(); sync_config_getter.SyncGetLatestProxyConfig(&config); @@ -911,10 +911,10 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicEnvTest) { } TEST_F(ProxyConfigServiceLinuxTest, GconfNotification) { - MockEnvVarGetter* env_getter = new MockEnvVarGetter; + MockEnvironment* env = new MockEnvironment; MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter; ProxyConfigServiceLinux* service = - new ProxyConfigServiceLinux(env_getter, gconf_getter); + new ProxyConfigServiceLinux(env, gconf_getter); SynchConfigGetter sync_config_getter(service); ProxyConfig config; @@ -1292,13 +1292,13 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, tests[i].description.c_str())); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; - env_getter->values = tests[i].env_values; + MockEnvironment* env = new MockEnvironment; + env->values = tests[i].env_values; // Force the KDE getter to be used and tell it where the test is. - env_getter->values.DESKTOP_SESSION = "kde4"; - env_getter->values.KDEHOME = kde_home_.value().c_str(); + env->values.DESKTOP_SESSION = "kde4"; + env->values.KDEHOME = kde_home_.value().c_str(); SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter)); + new ProxyConfigServiceLinux(env)); ProxyConfig config; // Overwrite the kioslaverc file. file_util::WriteFile(kioslaverc_, tests[i].kioslaverc.c_str(), @@ -1328,11 +1328,11 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { CHECK(!file_util::DirectoryExists(kde4_home_)); { SCOPED_TRACE("KDE4, no .kde4 directory, verify fallback"); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; - env_getter->values.DESKTOP_SESSION = "kde4"; - env_getter->values.HOME = user_home_.value().c_str(); + MockEnvironment* env = new MockEnvironment; + env->values.DESKTOP_SESSION = "kde4"; + env->values.HOME = user_home_.value().c_str(); SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter)); + new ProxyConfigServiceLinux(env)); ProxyConfig config; sync_config_getter.SetupAndInitialFetch(); sync_config_getter.SyncGetLatestProxyConfig(&config); @@ -1347,11 +1347,11 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { CHECK(file_util::PathExists(kioslaverc4_)); { SCOPED_TRACE("KDE4, .kde4 directory present, use it"); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; - env_getter->values.DESKTOP_SESSION = "kde4"; - env_getter->values.HOME = user_home_.value().c_str(); + MockEnvironment* env = new MockEnvironment; + env->values.DESKTOP_SESSION = "kde4"; + env->values.HOME = user_home_.value().c_str(); SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter)); + new ProxyConfigServiceLinux(env)); ProxyConfig config; sync_config_getter.SetupAndInitialFetch(); sync_config_getter.SyncGetLatestProxyConfig(&config); @@ -1360,11 +1360,11 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { } { SCOPED_TRACE("KDE3, .kde4 directory present, ignore it"); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; - env_getter->values.DESKTOP_SESSION = "kde"; - env_getter->values.HOME = user_home_.value().c_str(); + MockEnvironment* env = new MockEnvironment; + env->values.DESKTOP_SESSION = "kde"; + env->values.HOME = user_home_.value().c_str(); SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter)); + new ProxyConfigServiceLinux(env)); ProxyConfig config; sync_config_getter.SetupAndInitialFetch(); sync_config_getter.SyncGetLatestProxyConfig(&config); @@ -1373,12 +1373,12 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { } { SCOPED_TRACE("KDE4, .kde4 directory present, KDEHOME set to .kde"); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; - env_getter->values.DESKTOP_SESSION = "kde4"; - env_getter->values.HOME = user_home_.value().c_str(); - env_getter->values.KDEHOME = kde_home_.value().c_str(); + MockEnvironment* env = new MockEnvironment; + env->values.DESKTOP_SESSION = "kde4"; + env->values.HOME = user_home_.value().c_str(); + env->values.KDEHOME = kde_home_.value().c_str(); SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter)); + new ProxyConfigServiceLinux(env)); ProxyConfig config; sync_config_getter.SetupAndInitialFetch(); sync_config_getter.SyncGetLatestProxyConfig(&config); @@ -1391,11 +1391,11 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { file_util::SetLastModifiedTime(kde4_config_, base::Time()); { SCOPED_TRACE("KDE4, very old .kde4 directory present, use .kde"); - MockEnvVarGetter* env_getter = new MockEnvVarGetter; - env_getter->values.DESKTOP_SESSION = "kde4"; - env_getter->values.HOME = user_home_.value().c_str(); + MockEnvironment* env = new MockEnvironment; + env->values.DESKTOP_SESSION = "kde4"; + env->values.HOME = user_home_.value().c_str(); SynchConfigGetter sync_config_getter( - new ProxyConfigServiceLinux(env_getter)); + new ProxyConfigServiceLinux(env)); ProxyConfig config; sync_config_getter.SetupAndInitialFetch(); sync_config_getter.SyncGetLatestProxyConfig(&config); diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index 7f0b6bd..4620f8f 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -20,7 +20,7 @@ #include "base/at_exit.h" #include "base/command_line.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/file_path.h" #include "base/logging.h" #include "base/nss_util.h" diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index e5bdb85..bbc55f3 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -5,7 +5,7 @@ #include "base/at_exit.h" #include "base/basictypes.h" #include "base/command_line.h" -#include "base/env_var.h" +#include "base/environment.h" #include "base/event_recorder.h" #include "base/file_path.h" #include "base/file_util.h" @@ -92,7 +92,7 @@ int main(int argc, char* argv[]) { // directly, its constructor sets up some necessary state. MessageLoopForUI main_message_loop; - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); + scoped_ptr<base::Environment> env(base::Environment::Create()); bool suppress_error_dialogs = ( env->HasEnv("CHROME_HEADLESS") || parsed_command_line.HasSwitch(test_shell::kNoErrorDialogs) || |