Add docs, avoid side effects when not currently default

This commit is contained in:
Ben Gotow 2016-05-08 10:50:17 -07:00
parent 19d5d3b7d1
commit ac905e7080
2 changed files with 4 additions and 4 deletions

View file

@ -47,6 +47,9 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol) {
if (!identifier)
return false;
if (!Browser::IsDefaultProtocolClient(protocol))
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
CFStringRef protocol_cf = base::mac::NSToCFCast(protocol_ns);
CFArrayRef bundleList = LSCopyAllHandlersForURLScheme(protocol_cf);

View file

@ -393,16 +393,13 @@ Please refer to [Apple's documentation][CFBundleURLTypes] for details.
The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
### `app.removeAsDefaultProtocolClient(protocol)` _Windows_
### `app.removeAsDefaultProtocolClient(protocol)` _OS X_ _Windows_
* `protocol` String - The name of your protocol, without `://`.
This method checks if the current executable as the default handler for a protocol
(aka URI scheme). If so, it will remove the app as the default handler.
**Note:** On OS X, removing the app will automatically remove the app as the
default protocol handler.
### `app.isDefaultProtocolClient(protocol)` _OS X_ _Windows_
* `protocol` String - The name of your protocol, without `://`.