Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: chrome/browser/shell_integration_linux.cc

Issue 3052034: base: Rename EnvVarGetter to Environment. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: review Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/shell_integration_linux.cc
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 95b3e859d7aa0dbd012967d0d66e6cd77e929b30..27b5a9bb8270c72a02b9bc8c8ebfe0524579d515 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);

Powered by Google App Engine
This is Rietveld 408576698