Repository navigation
add setAsDefaultProtocolClient for Linux - #10670
Conversation
| } | ||
|
|
||
| bool SetDefaultWebClient(const std::string& protocol) { | ||
| #if defined(OS_CHROMEOS) |
There was a problem hiding this comment.
We can probably not care about the CHROMEOS check
| bool Browser::IsDefaultProtocolClient(const std::string& protocol, | ||
| mate::Arguments* args) { | ||
| mate::Arguments* args) { | ||
| #if defined(OS_CHROMEOS) |
| base::Process process = base::LaunchProcess(argv, options); | ||
| close(devnull); | ||
|
|
||
| if (!process.IsValid())return false; |
There was a problem hiding this comment.
This spacing stood out for some reason, and now I can't unsee it 😆
| std::vector<std::string> argv; | ||
| argv.push_back(kXdgSettings); | ||
| argv.push_back("set"); | ||
| if (!protocol.empty()) { |
There was a problem hiding this comment.
If the protocol is empty do we still want to continue? If they didn't provide a protocol should we just stop trying?
There was a problem hiding this comment.
hrm yeah i suppose we can immediately return false if there's no protocol, otherwise continue
| #endif | ||
| } | ||
|
|
||
| // Todo implement |
There was a problem hiding this comment.
i'm not currently sure if it's possible to remove using xdg-settings sadly...docs don't reference anything about it and chromium doesn't implement any form of protocol removal
| namespace atom { | ||
|
|
||
| const char kXdgSettings[] = "xdg-settings"; | ||
| const char kXdgSettingsDefaultBrowser[] = "default-web-browser"; |
There was a problem hiding this comment.
This doesn't appear to be used
|
|
||
| bool Browser::IsDefaultProtocolClient(const std::string& protocol, | ||
| mate::Arguments* args) { | ||
| base::ThreadRestrictions::AssertIOAllowed(); |
There was a problem hiding this comment.
This check is dummy, since DCHECKS are disabled currently. But it is not good to do IO operations on the UI thread. I suggest moving these to the FILE thread instead. Currently we have not started using the new task scheduler api of chromium, which would make scenarios like this easier to deal with. You can look at how the previous version of {set/check}DefaultProtocolClient was implemented in chromium using FILE thread https://codereview.chromium.org/2888693003 .
|
Per @deepak1556's comment above, i'm planning to migrate implementations of |
Tracking progress for implementation of #6440
Todo:
GetChromeVersionOfScriptinSetAsDefaultProtocolClientandIsDefaultProtocolClientappropriately