mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
- Restore FTP protocol support that was removed by a recent Chromium update.
- Register the net resource provider for render processes (issue #999). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1287 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
7e259aa9f2
commit
8c5a5c8ff1
2
cef.gyp
2
cef.gyp
@ -923,6 +923,8 @@
|
||||
'libcef/common/http_header_utils.h',
|
||||
'libcef/common/main_delegate.cc',
|
||||
'libcef/common/main_delegate.h',
|
||||
'libcef/common/net_resource_provider.cc',
|
||||
'libcef/common/net_resource_provider.h',
|
||||
'libcef/common/process_message_impl.cc',
|
||||
'libcef/common/process_message_impl.h',
|
||||
'libcef/common/request_impl.cc',
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_delegate.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
#include "libcef/common/net_resource_provider.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
@ -26,15 +26,6 @@
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace {
|
||||
|
||||
base::StringPiece ResourceProvider(int resource_id) {
|
||||
return CefContentClient::Get()->GetDataResource(resource_id,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserMainParts::CefBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters)
|
||||
: BrowserMainParts(),
|
||||
@ -61,7 +52,7 @@ void CefBrowserMainParts::PostMainMessageLoopStart() {
|
||||
|
||||
int CefBrowserMainParts::PreCreateThreads() {
|
||||
PlatformInitialize();
|
||||
net::NetModule::SetResourceProvider(&ResourceProvider);
|
||||
net::NetModule::SetResourceProvider(&NetResourceProvider);
|
||||
|
||||
// Initialize the GpuDataManager before IO access restrictions are applied and
|
||||
// before the IO thread is started.
|
||||
|
@ -13,17 +13,24 @@
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "net/url_request/data_protocol_handler.h"
|
||||
#include "net/url_request/file_protocol_handler.h"
|
||||
#include "net/url_request/ftp_protocol_handler.h"
|
||||
#include "net/url_request/url_request_job_factory_impl.h"
|
||||
|
||||
namespace scheme {
|
||||
|
||||
void InstallInternalProtectedHandlers(
|
||||
net::URLRequestJobFactoryImpl* job_factory,
|
||||
content::ProtocolHandlerMap* protocol_handlers) {
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
net::FtpTransactionFactory* ftp_transaction_factory) {
|
||||
protocol_handlers->insert(
|
||||
std::make_pair(chrome::kDataScheme, new net::DataProtocolHandler));
|
||||
protocol_handlers->insert(
|
||||
std::make_pair(chrome::kFileScheme, new net::FileProtocolHandler));
|
||||
#if !defined(DISABLE_FTP_SUPPORT)
|
||||
protocol_handlers->insert(
|
||||
std::make_pair(chrome::kFtpScheme,
|
||||
new net::FtpProtocolHandler(ftp_transaction_factory)));
|
||||
#endif
|
||||
|
||||
for (content::ProtocolHandlerMap::iterator it =
|
||||
protocol_handlers->begin();
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "googleurl/src/gurl.h"
|
||||
|
||||
namespace net {
|
||||
class FtpTransactionFactory;
|
||||
class URLRequestJobFactoryImpl;
|
||||
}
|
||||
|
||||
@ -21,7 +22,8 @@ namespace scheme {
|
||||
// overridden.
|
||||
void InstallInternalProtectedHandlers(
|
||||
net::URLRequestJobFactoryImpl* job_factory,
|
||||
content::ProtocolHandlerMap* protocol_handlers);
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
net::FtpTransactionFactory* ftp_transaction_factory);
|
||||
|
||||
// Register the internal scheme handlers that can be overridden.
|
||||
void RegisterInternalHandlers();
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "net/cert/cert_verifier.h"
|
||||
#include "net/cookies/cookie_monster.h"
|
||||
#include "net/dns/host_resolver.h"
|
||||
#include "net/ftp/ftp_network_layer.h"
|
||||
#include "net/http/http_auth_handler_factory.h"
|
||||
#include "net/http/http_cache.h"
|
||||
#include "net/http/http_server_properties_impl.h"
|
||||
@ -167,12 +168,18 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
main_backend);
|
||||
storage_->set_http_transaction_factory(main_cache);
|
||||
|
||||
#if !defined(DISABLE_FTP_SUPPORT)
|
||||
ftp_transaction_factory_.reset(
|
||||
new net::FtpNetworkLayer(network_session_params.host_resolver));
|
||||
#endif
|
||||
|
||||
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
||||
new net::URLRequestJobFactoryImpl());
|
||||
job_factory_impl_ = job_factory.get();
|
||||
|
||||
scheme::InstallInternalProtectedHandlers(job_factory.get(),
|
||||
&protocol_handlers_);
|
||||
&protocol_handlers_,
|
||||
ftp_transaction_factory_.get());
|
||||
protocol_handlers_.clear();
|
||||
|
||||
storage_->set_job_factory(job_factory.release());
|
||||
|
@ -23,6 +23,7 @@ class MessageLoop;
|
||||
}
|
||||
|
||||
namespace net {
|
||||
class FtpTransactionFactory;
|
||||
class HostResolver;
|
||||
class ProxyConfigService;
|
||||
class URLRequestContextStorage;
|
||||
@ -114,6 +115,7 @@ class CefURLRequestContextGetter : public net::URLRequestContextGetter {
|
||||
scoped_ptr<net::URLRequestContextStorage> storage_;
|
||||
scoped_ptr<net::URLRequestContext> url_request_context_;
|
||||
scoped_ptr<net::URLSecurityManager> url_security_manager_;
|
||||
scoped_ptr<net::FtpTransactionFactory> ftp_transaction_factory_;
|
||||
content::ProtocolHandlerMap protocol_handlers_;
|
||||
net::URLRequestJobFactoryImpl* job_factory_impl_;
|
||||
|
||||
|
10
libcef/common/net_resource_provider.cc
Normal file
10
libcef/common/net_resource_provider.cc
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/content_client.h"
|
||||
#include "libcef/common/net_resource_provider.h"
|
||||
|
||||
base::StringPiece NetResourceProvider(int key) {
|
||||
return CefContentClient::Get()->GetDataResource(key, ui::SCALE_FACTOR_NONE);
|
||||
}
|
14
libcef/common/net_resource_provider.h
Normal file
14
libcef/common/net_resource_provider.h
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_COMMON_NET_RESOURCE_PROVIDER_H_
|
||||
#define CEF_LIBCEF_COMMON_NET_RESOURCE_PROVIDER_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/strings/string_piece.h"
|
||||
|
||||
// This is called indirectly by the network layer to access resources.
|
||||
base::StringPiece NetResourceProvider(int key);
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_NET_RESOURCE_PROVIDER_H_
|
@ -51,6 +51,9 @@ bool IsInternalProtectedScheme(const std::string& scheme) {
|
||||
chrome::kDataScheme,
|
||||
chrome::kFileScheme,
|
||||
chrome::kFileSystemScheme,
|
||||
#if !defined(DISABLE_FTP_SUPPORT)
|
||||
chrome::kFtpScheme,
|
||||
#endif
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) {
|
||||
|
@ -5,13 +5,16 @@
|
||||
|
||||
#include "libcef/renderer/render_process_observer.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/net_resource_provider.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
|
||||
#include "net/base/net_module.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
|
||||
CefRenderProcessObserver::CefRenderProcessObserver() {
|
||||
net::NetModule::SetResourceProvider(NetResourceProvider);
|
||||
}
|
||||
|
||||
CefRenderProcessObserver::~CefRenderProcessObserver() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user