diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc | 9 | ||||
-rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.cc | 7 | ||||
-rw-r--r-- | chrome/browser/gtk/options/advanced_contents_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/shell_integration.h | 16 | ||||
-rw-r--r-- | chrome/browser/shell_integration_linux.cc | 20 | ||||
-rw-r--r-- | chrome/browser/shell_integration_unittest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app.cc | 7 | ||||
-rw-r--r-- | chrome/common/chrome_paths_linux.cc | 18 |
8 files changed, 51 insertions, 51 deletions
diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc index 1391e64..3a54f09 100644 --- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc @@ -1,11 +1,13 @@ -// 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. #include "chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h" +#include <string> + #include "app/l10n_util.h" -#include "base/linux_util.h" +#include "base/env_var.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/gtk/gtk_util.h" #include "chrome/browser/shell_integration.h" @@ -124,8 +126,7 @@ void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); - scoped_ptr<base::EnvironmentVariableGetter> env_getter( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); std::string shortcut_template; if (ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 6494657..7fee05a6 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -6,7 +6,10 @@ #include <gtk/gtk.h> +#include <set> + #include "app/resource_bundle.h" +#include "base/env_var.h" #include "base/linux_util.h" #include "base/stl_util-inl.h" #include "chrome/browser/metrics/user_metrics.h" @@ -400,13 +403,11 @@ GdkPixbuf* GtkThemeProvider::GetDefaultFavicon(bool native) { static GdkPixbuf* default_bookmark_icon_ = rb.GetPixbufNamed( IDR_DEFAULT_FAVICON); return default_bookmark_icon_; - } // static bool GtkThemeProvider::DefaultUsesSystemTheme() { - scoped_ptr<base::EnvironmentVariableGetter> env_getter( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); switch (base::GetDesktopEnvironment(env_getter.get())) { case base::DESKTOP_ENVIRONMENT_GNOME: diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 356fa42..e3eaa79 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -7,10 +7,14 @@ #include <sys/types.h> #include <sys/wait.h> +#include <string> +#include <vector> + #include "app/gtk_signal.h" #include "app/gtk_util.h" #include "app/l10n_util.h" #include "base/basictypes.h" +#include "base/env_var.h" #include "base/file_util.h" #include "base/linux_util.h" #include "base/path_service.h" @@ -392,8 +396,7 @@ void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button, section->UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"), NULL); - scoped_ptr<base::EnvironmentVariableGetter> env_getter( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); ProxyConfigCommand command; bool found_command = false; diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 42adfd6..7465e11 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -1,9 +1,9 @@ -// Copyright (c) 2006-2008 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. -#ifndef CHROME_BROWSER_SHELL_INTEGRATION_H__ -#define CHROME_BROWSER_SHELL_INTEGRATION_H__ +#ifndef CHROME_BROWSER_SHELL_INTEGRATION_H_ +#define CHROME_BROWSER_SHELL_INTEGRATION_H_ #include <string> @@ -15,9 +15,11 @@ class FilePath; +#if defined(USE_X11) namespace base { -class EnvironmentVariableGetter; +class EnvVarGetter; } +#endif class ShellIntegration { public: @@ -73,8 +75,8 @@ class ShellIntegration { const string16& extension_app_id); #if defined(USE_X11) - static bool GetDesktopShortcutTemplate( - base::EnvironmentVariableGetter* env_getter, std::string* output); + static bool GetDesktopShortcutTemplate(base::EnvVarGetter* env_getter, + std::string* output); // Returns filename for .desktop file based on |url|, sanitized for security. static FilePath GetDesktopShortcutFilename(const GURL& url); @@ -169,4 +171,4 @@ class ShellIntegration { }; }; -#endif // CHROME_BROWSER_SHELL_INTEGRATION_H__ +#endif // CHROME_BROWSER_SHELL_INTEGRATION_H_ diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 2a03f75..19d1730 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-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. @@ -15,10 +15,10 @@ #include "base/command_line.h" #include "base/eintr_wrapper.h" +#include "base/env_var.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/i18n/file_util_icu.h" -#include "base/linux_util.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/process_util.h" @@ -38,7 +38,7 @@ namespace { -std::string GetDesktopName(base::EnvironmentVariableGetter* env_getter) { +std::string GetDesktopName(base::EnvVarGetter* env_getter) { #if defined(GOOGLE_CHROME_BUILD) return "google-chrome.desktop"; #else // CHROMIUM_BUILD @@ -46,7 +46,7 @@ std::string GetDesktopName(base::EnvironmentVariableGetter* 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_getter->GetEnv("CHROME_DESKTOP", &name) && !name.empty()) return name; return "chromium-browser.desktop"; #endif @@ -195,8 +195,7 @@ void CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename, // static bool ShellIntegration::SetAsDefaultBrowser() { - scoped_ptr<base::EnvironmentVariableGetter> env_getter( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); std::vector<std::string> argv; argv.push_back("xdg-settings"); @@ -208,8 +207,7 @@ bool ShellIntegration::SetAsDefaultBrowser() { // static ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { - scoped_ptr<base::EnvironmentVariableGetter> env_getter( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); std::vector<std::string> argv; argv.push_back("xdg-settings"); @@ -242,19 +240,19 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() { // static bool ShellIntegration::GetDesktopShortcutTemplate( - base::EnvironmentVariableGetter* env_getter, std::string* output) { + base::EnvVarGetter* env_getter, 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_getter->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_getter->GetEnv("XDG_DATA_DIRS", &xdg_data_dirs) && !xdg_data_dirs.empty()) { StringTokenizer tokenizer(xdg_data_dirs, ":"); while (tokenizer.GetNext()) { diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index bbda7fc..4776d8d 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -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. @@ -19,7 +19,7 @@ #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_LINUX) -#include "base/linux_util.h" +#include "base/env_var.h" #endif // defined(OS_LINUX) #define FPL FILE_PATH_LITERAL @@ -28,16 +28,16 @@ namespace { // Provides mock environment variables values based on a stored map. -class MockEnvironmentVariableGetter : public base::EnvironmentVariableGetter { +class MockEnvVarGetter : public base::EnvVarGetter { public: - MockEnvironmentVariableGetter() { + MockEnvVarGetter() { } void Set(const std::string& name, const std::string& value) { variables_[name] = value; } - virtual bool Getenv(const char* variable_name, std::string* result) { + virtual bool GetEnv(const char* variable_name, std::string* result) { if (ContainsKey(variables_, variable_name)) { *result = variables_[variable_name]; return true; @@ -49,7 +49,7 @@ class MockEnvironmentVariableGetter : public base::EnvironmentVariableGetter { private: std::map<std::string, std::string> variables_; - DISALLOW_COPY_AND_ASSIGN(MockEnvironmentVariableGetter); + DISALLOW_COPY_AND_ASSIGN(MockEnvVarGetter); }; } // namespace @@ -71,7 +71,7 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - MockEnvironmentVariableGetter env_getter; + MockEnvVarGetter env_getter; env_getter.Set("XDG_DATA_HOME", temp_dir.path().value()); ASSERT_TRUE(file_util::WriteFile( temp_dir.path().AppendASCII(kTemplateFilename), @@ -86,7 +86,7 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - MockEnvironmentVariableGetter env_getter; + MockEnvVarGetter env_getter; env_getter.Set("XDG_DATA_DIRS", temp_dir.path().value()); ASSERT_TRUE(file_util::CreateDirectory( temp_dir.path().AppendASCII("applications"))); @@ -104,7 +104,7 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - MockEnvironmentVariableGetter env_getter; + MockEnvVarGetter env_getter; env_getter.Set("XDG_DATA_DIRS", temp_dir.path().value() + ":" + temp_dir.path().AppendASCII("applications").value()); ASSERT_TRUE(file_util::CreateDirectory( diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index b5714b2..0674c0d 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -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. @@ -33,7 +33,7 @@ #include "webkit/glue/dom_operations.h" #if defined(OS_LINUX) -#include "base/linux_util.h" +#include "base/env_var.h" #endif // defined(OS_LINUX) #if defined(OS_WIN) @@ -261,8 +261,7 @@ bool CreateShortcutTask::CreateShortcut() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); #if defined(OS_LINUX) - scoped_ptr<base::EnvironmentVariableGetter> env_getter( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); std::string shortcut_template; if (!ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc index 5a880e1..7568179 100644 --- a/chrome/common/chrome_paths_linux.cc +++ b/chrome/common/chrome_paths_linux.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2006-2008 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. #include "chrome/common/chrome_paths_internal.h" +#include "base/env_var.h" #include "base/linux_util.h" #include "base/scoped_ptr.h" @@ -15,8 +16,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::EnvironmentVariableGetter> env( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); FilePath config_dir( base::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config")); #if defined(GOOGLE_CHROME_BUILD) @@ -28,8 +28,7 @@ bool GetDefaultUserDataDirectory(FilePath* result) { } bool GetChromeFrameUserDataDirectory(FilePath* result) { - scoped_ptr<base::EnvironmentVariableGetter> env( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); FilePath config_dir( base::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config")); #if defined(GOOGLE_CHROME_BUILD) @@ -41,8 +40,7 @@ bool GetChromeFrameUserDataDirectory(FilePath* result) { } bool GetUserDocumentsDirectory(FilePath* result) { - scoped_ptr<base::EnvironmentVariableGetter> env( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); *result = base::GetXDGUserDirectory(env.get(), "DOCUMENTS", "Documents"); return true; } @@ -50,8 +48,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::EnvironmentVariableGetter> env( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); *result = base::GetXDGUserDirectory(env.get(), "DOWNLOAD", "Downloads"); FilePath home = base::GetHomeDir(env.get()); @@ -70,8 +67,7 @@ bool GetUserDownloadsDirectory(FilePath* result) { } bool GetUserDesktop(FilePath* result) { - scoped_ptr<base::EnvironmentVariableGetter> env( - base::EnvironmentVariableGetter::Create()); + scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); *result = base::GetXDGUserDirectory(env.get(), "DESKTOP", "Desktop"); return true; } |