diff options
author | Xiao Zhang <xiaozhang1@blackberry.com> | 2013-12-10 15:16:40 +0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-10 09:26:01 +0100 |
commit | 84fc0e2476ddfc7a5eb2750f3c9b8679a01f948c (patch) | |
tree | 84388a0f1c7e67d439f5fe51b00ac6cfebaa29e3 /src/core | |
parent | ae600d6b0fdb4bf9b5589df7bac162b1b112c7dd (diff) |
Add ftp protocol handler.
Change-Id: Ib5ec11a23d609414f609969dbb2933d83eb6e3bd
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 13 | ||||
-rw-r--r-- | src/core/content_main_delegate_qt.cpp | 11 | ||||
-rw-r--r-- | src/core/resource_bundle_qt.cpp | 4 | ||||
-rw-r--r-- | src/core/url_request_context_getter_qt.cpp | 4 |
4 files changed, 15 insertions, 17 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 9bc9bfe5e..24b478268 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -47,9 +47,6 @@ #include "content/public/common/main_function_params.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/common/url_constants.h" -#include "grit/net_resources.h" -#include "net/base/net_module.h" -#include "ui/base/resource/resource_bundle.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_share_group.h" @@ -161,14 +158,6 @@ base::MessagePump* messagePumpFactory() } // namespace -static base::StringPiece PlatformResourceProvider(int key) { - if (key == IDR_DIR_HEADER_HTML) { - base::StringPiece html_data = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_DIR_HEADER_HTML); - return html_data; - } - return base::StringPiece(); -} - class BrowserMainPartsQt : public content::BrowserMainParts { public: @@ -178,8 +167,6 @@ public: void PreMainMessageLoopStart() Q_DECL_OVERRIDE { - net::NetModule::SetResourceProvider(PlatformResourceProvider); - ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); base::MessageLoop::InitMessagePumpForUIFactory(::messagePumpFactory); } diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index c8367fe37..8fe2f3378 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -45,15 +45,26 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_paths.h" #include "ui/base/resource/resource_bundle.h" +#include "grit/net_resources.h" +#include "net/base/net_module.h" #include "content_client_qt.h" #include "web_engine_library_info.h" +static base::StringPiece PlatformResourceProvider(int key) { + if (key == IDR_DIR_HEADER_HTML) { + base::StringPiece html_data = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_DIR_HEADER_HTML); + return html_data; + } + return base::StringPiece(); +} + void ContentMainDelegateQt::PreSandboxStartup() { PathService::Override(base::FILE_EXE, WebEngineLibraryInfo::subProcessPath()); PathService::Override(ui::DIR_LOCALES, WebEngineLibraryInfo::localesPath()); + net::NetModule::SetResourceProvider(PlatformResourceProvider); ui::ResourceBundle::InitSharedInstanceWithLocale(l10n_util::GetApplicationLocale(std::string("en-US")), 0); } diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp index 05c168101..951f4af21 100644 --- a/src/core/resource_bundle_qt.cpp +++ b/src/core/resource_bundle_qt.cpp @@ -48,10 +48,6 @@ namespace ui { void ResourceBundle::LoadCommonResources() { - // Loading these resources probably only makes sense for the browser process - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) - return; - // We repacked the resources we need and installed them. now let chromium mmap that file. AddDataPackFromPath(WebEngineLibraryInfo::repackedResourcesPath(), SCALE_FACTOR_100P); } diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 933df845c..90219be4e 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -61,6 +61,8 @@ #include "net/url_request/url_request_context.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/ftp/ftp_network_layer.h" #include "network_delegate_qt.h" #include "qrc_protocol_handler_qt.h" @@ -163,6 +165,8 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() m_jobFactory->SetProtocolHandler(chrome::kDataScheme, new net::DataProtocolHandler()); m_jobFactory->SetProtocolHandler(chrome::kFileScheme, new net::FileProtocolHandler()); m_jobFactory->SetProtocolHandler(kQrcSchemeQt, new QrcProtocolHandlerQt()); + m_jobFactory->SetProtocolHandler(chrome::kFtpScheme, new net::FtpProtocolHandler( + new net::FtpNetworkLayer(m_urlRequestContext->host_resolver()))); m_urlRequestContext->set_job_factory(m_jobFactory.get()); } |