summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/content_main_delegate_qt.cpp5
-rw-r--r--src/core/resource_bundle_qt.cpp2
-rw-r--r--src/core/web_engine_context.cpp7
-rw-r--r--src/core/web_engine_library_info.cpp28
-rw-r--r--src/core/web_engine_library_info.h6
5 files changed, 21 insertions, 27 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 43cca7ef9..f75204ada 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -63,8 +63,9 @@ static base::StringPiece PlatformResourceProvider(int key) {
void ContentMainDelegateQt::PreSandboxStartup()
{
- // Register the Qt path provider which handles necessary paths for base, ui and content.
- PathService::RegisterProvider(WebEngineLibraryInfo::pathProviderQt, base::PATH_START, content::PATH_END);
+ PathService::Override(base::FILE_EXE, WebEngineLibraryInfo::getPath(base::FILE_EXE));
+ PathService::Override(content::DIR_MEDIA_LIBS, WebEngineLibraryInfo::getPath(content::DIR_MEDIA_LIBS));
+ PathService::Override(ui::DIR_LOCALES, WebEngineLibraryInfo::getPath(ui::DIR_LOCALES));
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 951f4af21..5865cc5ba 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -49,7 +49,7 @@ namespace ui {
void ResourceBundle::LoadCommonResources()
{
// We repacked the resources we need and installed them. now let chromium mmap that file.
- AddDataPackFromPath(WebEngineLibraryInfo::repackedResourcesPath(), SCALE_FACTOR_100P);
+ AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_100P);
}
// As GetLocaleFilePath is excluded for Mac in resource_bundle.cc,
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 193179ea1..3b0862128 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -45,7 +45,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/app/content_main_runner.h"
@@ -131,11 +130,7 @@ WebEngineContext::WebEngineContext(WebContentsAdapterClient::RenderingMode rende
CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess();
parsedCommandLine->AppendSwitchASCII(switches::kUserAgent, webkit_glue::BuildUserAgentFromProduct("QtWebEngine/0.1"));
-
- base::FilePath subprocessPath;
- PathService::Get(content::CHILD_PROCESS_EXE, &subprocessPath);
- parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, subprocessPath);
-
+ parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE));
parsedCommandLine->AppendSwitch(switches::kNoSandbox);
parsedCommandLine->AppendSwitch(switches::kDisablePlugins);
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 40cd7a1b7..67a466c90 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -138,31 +138,30 @@ namespace base {
// PathService registers PathProviderAndroid by default on Android.
bool PathProviderAndroid(int key, FilePath* result)
{
- return WebEngineLibraryInfo::pathProviderQt(key, result);
+ *result = WebEngineLibraryInfo::getPath(key);
+ return !(result->empty());
}
}
#endif // defined(OS_ANDROID)
-base::FilePath WebEngineLibraryInfo::repackedResourcesPath()
-{
- return toFilePath(location(QLibraryInfo::DataPath) % QStringLiteral("/qtwebengine_resources.pak"));
-}
-
-bool WebEngineLibraryInfo::pathProviderQt(int key, base::FilePath* result)
+base::FilePath WebEngineLibraryInfo::getPath(int key)
{
QString directory;
switch (key) {
+ case QT_RESOURCES_PAK:
+ return toFilePath(location(QLibraryInfo::DataPath) % QStringLiteral("/qtwebengine_resources.pak"));
case base::FILE_EXE:
case content::CHILD_PROCESS_EXE:
- *result = toFilePath(subProcessPath());
- return true;
+ return toFilePath(subProcessPath());
+#if defined(OS_POSIX)
case base::DIR_CACHE:
directory = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
break;
case base::DIR_HOME:
directory = QDir::homePath();
break;
+#endif
case base::DIR_USER_DESKTOP:
directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
break;
@@ -174,18 +173,15 @@ bool WebEngineLibraryInfo::pathProviderQt(int key, base::FilePath* result)
break;
#endif
case content::DIR_MEDIA_LIBS:
- *result = toFilePath(pluginsPath());
- return true;
+ return toFilePath(pluginsPath());
case ui::DIR_LOCALES:
- *result = toFilePath(localesPath());
- return true;
+ return toFilePath(localesPath());
default:
// Note: the path system expects this function to override the default
// behavior. So no need to log an error if we don't support a given
// path. The system will just use the default.
- return false;
+ return base::FilePath();
}
- *result = toFilePath(directory.isEmpty() ? fallbackDir() : directory);
- return true;
+ return toFilePath(directory.isEmpty() ? fallbackDir() : directory);
}
diff --git a/src/core/web_engine_library_info.h b/src/core/web_engine_library_info.h
index 644f85003..84fee12af 100644
--- a/src/core/web_engine_library_info.h
+++ b/src/core/web_engine_library_info.h
@@ -43,11 +43,13 @@
#define WEB_ENGINE_LIBRARY_INFO_H
#include "base/files/file_path.h"
+enum {
+ QT_RESOURCES_PAK = 5000
+};
class WebEngineLibraryInfo {
public:
- static base::FilePath repackedResourcesPath();
- static bool pathProviderQt(int key, base::FilePath* result);
+ static base::FilePath getPath(int key);
};