Merge pull request #2298 from deepak1556/default_protocol_handler_patch
protocol: fix adapter request job for default handlers
This commit is contained in:
commit
5a980497e8
3 changed files with 28 additions and 13 deletions
|
@ -80,16 +80,13 @@ class CustomProtocolRequestJob : public AdapterRequestJob {
|
|||
registry_(registry) {
|
||||
}
|
||||
|
||||
// AdapterRequestJob:
|
||||
void GetJobTypeInUI() override {
|
||||
void GetJobTypeInUI(const Protocol::JsProtocolHandler& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
v8::Locker locker(registry_->isolate());
|
||||
v8::HandleScope handle_scope(registry_->isolate());
|
||||
|
||||
// Call the JS handler.
|
||||
Protocol::JsProtocolHandler callback =
|
||||
registry_->GetProtocolHandler(request()->url().scheme());
|
||||
v8::Local<v8::Value> result = callback.Run(request());
|
||||
|
||||
// Determine the type of the job we are going to create.
|
||||
|
@ -172,6 +169,14 @@ class CustomProtocolRequestJob : public AdapterRequestJob {
|
|||
GetWeakPtr(), net::ERR_NOT_IMPLEMENTED));
|
||||
}
|
||||
|
||||
// AdapterRequestJob:
|
||||
void GetJobType() override {
|
||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&CustomProtocolRequestJob::GetJobTypeInUI,
|
||||
base::Unretained(this),
|
||||
registry_->GetProtocolHandler(request()->url().scheme())));
|
||||
}
|
||||
|
||||
private:
|
||||
Protocol* registry_; // Weak, the Protocol class is expected to live forever.
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue