remove chrome check and change protocol handler

This commit is contained in:
Shelley Vohr 2017-10-07 00:36:18 -04:00
parent a1347f67a1
commit 66827755e7
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -45,9 +45,6 @@ bool LaunchXdgUtility(const std::vector<std::string>& argv, int* exit_code) {
} }
bool SetDefaultWebClient(const std::string& protocol) { bool SetDefaultWebClient(const std::string& protocol) {
#if defined(OS_CHROMEOS)
return true;
#else
std::unique_ptr<base::Environment> env(base::Environment::Create()); std::unique_ptr<base::Environment> env(base::Environment::Create());
std::vector<std::string> argv; std::vector<std::string> argv;
@ -62,7 +59,6 @@ bool SetDefaultWebClient(const std::string& protocol) {
int exit_code; int exit_code;
bool ran_ok = LaunchXdgUtility(argv, &exit_code); bool ran_ok = LaunchXdgUtility(argv, &exit_code);
return ran_ok && exit_code == EXIT_SUCCESS; return ran_ok && exit_code == EXIT_SUCCESS;
#endif
} }
void Browser::Focus() { void Browser::Focus() {
@ -91,20 +87,16 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
bool Browser::IsDefaultProtocolClient(const std::string& protocol, bool Browser::IsDefaultProtocolClient(const std::string& protocol,
mate::Arguments* args) { mate::Arguments* args) {
#if defined(OS_CHROMEOS)
return UNKNOWN_DEFAULT;
#else
base::ThreadRestrictions::AssertIOAllowed(); base::ThreadRestrictions::AssertIOAllowed();
std::unique_ptr<base::Environment> env(base::Environment::Create()); std::unique_ptr<base::Environment> env(base::Environment::Create());
if (protocol.empty()) return false;
std::vector<std::string> argv; std::vector<std::string> argv;
argv.push_back(kXdgSettings); argv.push_back(kXdgSettings);
argv.push_back("check"); argv.push_back("check");
if (!protocol.empty()) {
argv.push_back(kXdgSettingsDefaultSchemeHandler); argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol); argv.push_back(protocol);
}
argv.push_back(libgtkui::GetDesktopName(env.get())); argv.push_back(libgtkui::GetDesktopName(env.get()));
std::string reply; std::string reply;
@ -118,7 +110,6 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
return base::StartsWith(reply, "yes", base::CompareCase::SENSITIVE) return base::StartsWith(reply, "yes", base::CompareCase::SENSITIVE)
? true ? true
: false; : false;
#endif
} }
// Todo implement // Todo implement