Skelecton for interceptor APIs.
This commit is contained in:
parent
4bdd1b88ad
commit
04910b8391
2 changed files with 28 additions and 0 deletions
|
@ -25,6 +25,7 @@ namespace {
|
||||||
// Remember the protocol module object.
|
// Remember the protocol module object.
|
||||||
v8::Persistent<v8::Object> g_protocol_object;
|
v8::Persistent<v8::Object> g_protocol_object;
|
||||||
|
|
||||||
|
// Registered protocol handlers.
|
||||||
typedef std::map<std::string, v8::Persistent<v8::Function>> HandlersMap;
|
typedef std::map<std::string, v8::Persistent<v8::Function>> HandlersMap;
|
||||||
static HandlersMap g_handlers;
|
static HandlersMap g_handlers;
|
||||||
|
|
||||||
|
@ -331,6 +332,16 @@ v8::Handle<v8::Value> Protocol::IsHandledProtocol(const v8::Arguments& args) {
|
||||||
*v8::String::Utf8Value(args[0])));
|
*v8::String::Utf8Value(args[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
v8::Handle<v8::Value> Protocol::InterceptProtocol(const v8::Arguments& args) {
|
||||||
|
return v8::Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
v8::Handle<v8::Value> Protocol::UninterceptProtocol(const v8::Arguments& args) {
|
||||||
|
return v8::Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
// 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));
|
||||||
|
@ -357,6 +368,17 @@ void Protocol::UnregisterProtocolInIO(const std::string& scheme) {
|
||||||
scheme));
|
scheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void Protocol::InterceptProtocolInIO(const std::string& scheme) {
|
||||||
|
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
||||||
|
net::URLRequestJobFactoryImpl* job_factory(GetRequestJobFactory());
|
||||||
|
job_factory->SetProtocolHandler(scheme, new AdapterProtocolHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void Protocol::UninterceptProtocolInIO(const std::string& scheme) {
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void Protocol::Initialize(v8::Handle<v8::Object> target) {
|
void Protocol::Initialize(v8::Handle<v8::Object> target) {
|
||||||
g_protocol_object = v8::Persistent<v8::Object>::New(
|
g_protocol_object = v8::Persistent<v8::Object>::New(
|
||||||
|
|
|
@ -24,9 +24,15 @@ class Protocol {
|
||||||
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 v8::Handle<v8::Value> IsHandledProtocol(const v8::Arguments& args);
|
||||||
|
|
||||||
|
static v8::Handle<v8::Value> InterceptProtocol(const v8::Arguments& args);
|
||||||
|
static v8::Handle<v8::Value> UninterceptProtocol(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);
|
||||||
|
|
||||||
|
static void InterceptProtocolInIO(const std::string& scheme);
|
||||||
|
static void UninterceptProtocolInIO(const std::string& scheme);
|
||||||
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Protocol);
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Protocol);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue