From 66827755e7edac3f69d12da7c7c88b75257a3b42 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Sat, 7 Oct 2017 00:36:18 -0400 Subject: [PATCH] remove chrome check and change protocol handler --- atom/browser/browser_linux.cc | 49 ++++++++++++++--------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/atom/browser/browser_linux.cc b/atom/browser/browser_linux.cc index 5dd57bacf1f5..9e2b41194eea 100644 --- a/atom/browser/browser_linux.cc +++ b/atom/browser/browser_linux.cc @@ -40,14 +40,11 @@ bool LaunchXdgUtility(const std::vector& argv, int* exit_code) { base::Process process = base::LaunchProcess(argv, options); close(devnull); - if (!process.IsValid())return false; + if (!process.IsValid()) return false; return process.WaitForExit(exit_code); } bool SetDefaultWebClient(const std::string& protocol) { -#if defined(OS_CHROMEOS) - return true; -#else std::unique_ptr env(base::Environment::Create()); std::vector argv; @@ -62,7 +59,6 @@ bool SetDefaultWebClient(const std::string& protocol) { int exit_code; bool ran_ok = LaunchXdgUtility(argv, &exit_code); return ran_ok && exit_code == EXIT_SUCCESS; -#endif } void Browser::Focus() { @@ -90,35 +86,30 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, } bool Browser::IsDefaultProtocolClient(const std::string& protocol, - mate::Arguments* args) { - #if defined(OS_CHROMEOS) - return UNKNOWN_DEFAULT; - #else - base::ThreadRestrictions::AssertIOAllowed(); + mate::Arguments* args) { + base::ThreadRestrictions::AssertIOAllowed(); + std::unique_ptr env(base::Environment::Create()); - std::unique_ptr env(base::Environment::Create()); + if (protocol.empty()) return false; - std::vector argv; - argv.push_back(kXdgSettings); - argv.push_back("check"); - if (!protocol.empty()) { - argv.push_back(kXdgSettingsDefaultSchemeHandler); - argv.push_back(protocol); - } - argv.push_back(libgtkui::GetDesktopName(env.get())); + std::vector argv; + argv.push_back(kXdgSettings); + argv.push_back("check"); + argv.push_back(kXdgSettingsDefaultSchemeHandler); + argv.push_back(protocol); + argv.push_back(libgtkui::GetDesktopName(env.get())); - std::string reply; - int success_code; - bool ran_ok = base::GetAppOutputWithExitCode(base::CommandLine(argv), - &reply, &success_code); + std::string reply; + int success_code; + bool ran_ok = base::GetAppOutputWithExitCode(base::CommandLine(argv), + &reply, &success_code); - if (!ran_ok || success_code != EXIT_SUCCESS) return false; + if (!ran_ok || success_code != EXIT_SUCCESS) return false; - // Allow any reply that starts with "yes". - return base::StartsWith(reply, "yes", base::CompareCase::SENSITIVE) - ? true - : false; - #endif + // Allow any reply that starts with "yes". + return base::StartsWith(reply, "yes", base::CompareCase::SENSITIVE) + ? true + : false; } // Todo implement