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

Unified Diff: chrome/browser/shell_integration_linux.cc

Issue 7972011: Fix checking default protocol client on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration_linux.cc
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index cb8b45b9495e93f66150b4b36d03e238531f0fac..ddd0cfb351ad64b7ccff3e64e56954085229abb4 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -224,6 +224,10 @@ const char* kDesktopEntry = "Desktop Entry";
const char* kXdgOpenShebang = "#!/usr/bin/env xdg-open";
+const char* kXdgSettings = "xdg-settings";
+const char* kXdgSettingsDefaultBrowser = "default-web-browser";
+const char* kXdgSettingsDefaultSchemeHandler = "default-url-scheme-handler";
Evan Martin 2011/09/20 14:45:51 Minor nit: can you make these const char[] instead
benwells 2011/09/20 23:09:03 Done.
+
} // namespace
// static
@@ -293,12 +297,12 @@ bool SetDefaultWebClient(const std::string& protocol) {
scoped_ptr<base::Environment> env(base::Environment::Create());
std::vector<std::string> argv;
- argv.push_back("xdg-settings");
+ argv.push_back(kXdgSettings);
argv.push_back("set");
if (protocol.empty()) {
- argv.push_back("default-web-browser");
+ argv.push_back(kXdgSettingsDefaultBrowser);
} else {
- argv.push_back("default-url-scheme-handler");
+ argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol);
}
argv.push_back(ShellIntegration::GetDesktopName(env.get()));
@@ -306,7 +310,7 @@ bool SetDefaultWebClient(const std::string& protocol) {
int exit_code;
bool ran_ok = LaunchXdgUtility(argv, &exit_code);
if (ran_ok && exit_code == EXIT_XDG_SETTINGS_SYNTAX_ERROR) {
- if (GetChromeVersionOfScript("xdg-settings", &argv[0])) {
+ if (GetChromeVersionOfScript(kXdgSettings, &argv[0])) {
ran_ok = LaunchXdgUtility(argv, &exit_code);
}
}
@@ -324,12 +328,12 @@ ShellIntegration::DefaultWebClientState GetIsDefaultWebClient(
scoped_ptr<base::Environment> env(base::Environment::Create());
std::vector<std::string> argv;
- argv.push_back("xdg-settings");
+ argv.push_back(kXdgSettings);
argv.push_back("check");
if (protocol.empty()) {
- argv.push_back("default-web-browser");
+ argv.push_back(kXdgSettingsDefaultBrowser);
} else {
- argv.push_back("default-url-scheme-handler");
+ argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol);
}
argv.push_back(ShellIntegration::GetDesktopName(env.get()));
@@ -339,7 +343,7 @@ ShellIntegration::DefaultWebClientState GetIsDefaultWebClient(
bool ran_ok = base::GetAppOutputWithExitCode(CommandLine(argv), &reply,
&success_code);
if (ran_ok && success_code == EXIT_XDG_SETTINGS_SYNTAX_ERROR) {
- if (GetChromeVersionOfScript("xdg_settings", &argv[0])) {
+ if (GetChromeVersionOfScript(kXdgSettings, &argv[0])) {
ran_ok = base::GetAppOutputWithExitCode(CommandLine(argv), &reply,
&success_code);
}
@@ -386,9 +390,9 @@ ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
// static
bool ShellIntegration::IsFirefoxDefaultBrowser() {
std::vector<std::string> argv;
- argv.push_back("xdg-settings");
+ argv.push_back(kXdgSettings);
argv.push_back("get");
- argv.push_back("default-web-browser");
+ argv.push_back(kXdgSettingsDefaultBrowser);
std::string browser;
// We don't care about the return value here.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698