Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Make desktop name configurable from browser-laptop
Browse files Browse the repository at this point in the history
Auditors: @bsclifton, @bbondy
  • Loading branch information
darkdh authored and bridiver committed Oct 4, 2017
1 parent 78f973a commit 7f036a9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions atom/browser/browser_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
// otherwise it sets Brave as the default handler application for |protocol|.
bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
mate::Arguments* args) {
std::string desktop_name;
if (!args->GetNext(&desktop_name)) {
args->ThrowError("`desktop name` is a required field");
return false;
}

std::unique_ptr<base::Environment> env(base::Environment::Create());

std::vector<std::string> argv;
Expand All @@ -101,8 +107,7 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol);
}
// TODO(Anthony): Make it configurable
argv.push_back("brave.desktop");
argv.push_back(desktop_name.c_str());

int exit_code;
bool ran_ok = LaunchXdgUtility(argv, &exit_code);
Expand All @@ -118,6 +123,12 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
// |protocol|.
bool Browser::IsDefaultProtocolClient(const std::string& protocol,
mate::Arguments* args) {
std::string desktop_name;
if (!args->GetNext(&desktop_name)) {
args->ThrowError("`desktop name` is a required field");
return false;
}

base::ThreadRestrictions::AssertIOAllowed();

std::unique_ptr<base::Environment> env(base::Environment::Create());
Expand All @@ -131,8 +142,8 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol);
}
// TODO(Anthony): Make it configurable
argv.push_back("brave.desktop");

argv.push_back(desktop_name.c_str());

std::string reply;
int success_code;
Expand Down

0 comments on commit 7f036a9

Please sign in to comment.