Add asar:// protocol handler.
This commit is contained in:
parent
50ea0f0b45
commit
9b71117171
5 changed files with 81 additions and 0 deletions
33
atom/browser/net/asar/asar_protocol_handler.cc
Normal file
33
atom/browser/net/asar/asar_protocol_handler.cc
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/net/asar/asar_protocol_handler.h"
|
||||
|
||||
#include "net/base/filename_util.h"
|
||||
#include "net/url_request/url_request_file_job.h"
|
||||
|
||||
namespace asar {
|
||||
|
||||
AsarProtocolHandler::AsarProtocolHandler(
|
||||
const scoped_refptr<base::TaskRunner>& file_task_runner)
|
||||
: file_task_runner_(file_task_runner) {
|
||||
}
|
||||
|
||||
AsarProtocolHandler::~AsarProtocolHandler() {
|
||||
}
|
||||
|
||||
net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob(
|
||||
net::URLRequest* request,
|
||||
net::NetworkDelegate* network_delegate) const {
|
||||
base::FilePath file_path;
|
||||
net::FileURLToFilePath(request->url(), &file_path);
|
||||
return new net::URLRequestFileJob(request, network_delegate, file_path,
|
||||
file_task_runner_);
|
||||
}
|
||||
|
||||
bool AsarProtocolHandler::IsSafeRedirectTarget(const GURL& location) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace asar
|
Loading…
Add table
Add a link
Reference in a new issue