mirror of
https://github.com/electron/electron.git
synced 2026-02-15 17:45:33 -05:00
Add protocol.isHandledProtocol API.
This commit is contained in:
@@ -298,6 +298,12 @@ v8::Handle<v8::Value> Protocol::UnregisterProtocol(const v8::Arguments& args) {
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> Protocol::IsHandledProtocol(const v8::Arguments& args) {
|
||||
return v8::Boolean::New(net::URLRequest::IsHandledProtocol(
|
||||
*v8::String::Utf8Value(args[0])));
|
||||
}
|
||||
|
||||
// static
|
||||
void Protocol::RegisterProtocolInIO(const std::string& scheme) {
|
||||
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
||||
@@ -316,6 +322,7 @@ void Protocol::UnregisterProtocolInIO(const std::string& scheme) {
|
||||
void Protocol::Initialize(v8::Handle<v8::Object> target) {
|
||||
node::SetMethod(target, "registerProtocol", RegisterProtocol);
|
||||
node::SetMethod(target, "unregisterProtocol", UnregisterProtocol);
|
||||
node::SetMethod(target, "isHandledProtocol", IsHandledProtocol);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
@@ -22,6 +22,7 @@ class Protocol {
|
||||
private:
|
||||
static v8::Handle<v8::Value> RegisterProtocol(const v8::Arguments& args);
|
||||
static v8::Handle<v8::Value> UnregisterProtocol(const v8::Arguments& args);
|
||||
static v8::Handle<v8::Value> IsHandledProtocol(const v8::Arguments& args);
|
||||
|
||||
static void RegisterProtocolInIO(const std::string& scheme);
|
||||
static void UnregisterProtocolInIO(const std::string& scheme);
|
||||
|
||||
Reference in New Issue
Block a user