Add protocol.isHandledProtocol API.
This commit is contained in:
parent
799d9ada7d
commit
6915f020d9
2 changed files with 8 additions and 0 deletions
|
@ -298,6 +298,12 @@ v8::Handle<v8::Value> Protocol::UnregisterProtocol(const v8::Arguments& args) {
|
||||||
return v8::Undefined();
|
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
|
// static
|
||||||
void Protocol::RegisterProtocolInIO(const std::string& scheme) {
|
void Protocol::RegisterProtocolInIO(const std::string& scheme) {
|
||||||
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
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) {
|
void Protocol::Initialize(v8::Handle<v8::Object> target) {
|
||||||
node::SetMethod(target, "registerProtocol", RegisterProtocol);
|
node::SetMethod(target, "registerProtocol", RegisterProtocol);
|
||||||
node::SetMethod(target, "unregisterProtocol", UnregisterProtocol);
|
node::SetMethod(target, "unregisterProtocol", UnregisterProtocol);
|
||||||
|
node::SetMethod(target, "isHandledProtocol", IsHandledProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
|
@ -22,6 +22,7 @@ class Protocol {
|
||||||
private:
|
private:
|
||||||
static v8::Handle<v8::Value> RegisterProtocol(const v8::Arguments& args);
|
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> UnregisterProtocol(const v8::Arguments& args);
|
||||||
|
static v8::Handle<v8::Value> IsHandledProtocol(const v8::Arguments& args);
|
||||||
|
|
||||||
static void RegisterProtocolInIO(const std::string& scheme);
|
static void RegisterProtocolInIO(const std::string& scheme);
|
||||||
static void UnregisterProtocolInIO(const std::string& scheme);
|
static void UnregisterProtocolInIO(const std::string& scheme);
|
||||||
|
|
Loading…
Reference in a new issue