Fix NetworkService cache directory structure (see issue #2622).

To test: When running `cefclient --cache-path=c:\temp\cache` with NetworkService
enabled the the cache directory structure should be "C:\temp\cache\Cache"
instead of "C:\temp\cache\cache\Cache".
This commit is contained in:
Marshall Greenblatt 2019-05-02 14:50:59 -04:00
parent 4592cba19f
commit cef882616b
2 changed files with 27 additions and 2 deletions

View File

@ -418,6 +418,8 @@ patches = [
{
# Enhancements to NetworkService:
# - Add support for calling CookieMonster::SetCookieableSchemes.
# - Fix cache directory structure ("C:\temp\cache\cache\Cache" should be
# "C:\temp\cache\Cache").
# https://bitbucket.org/chromiumembedded/cef/issues/2622
'name': 'services_network_2622',
},

View File

@ -1,8 +1,16 @@
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
index 2b24d1ac1b5b..f2d97cd93fb1 100644
index 2b24d1ac1b5b..6577495d87a9 100644
--- chrome/browser/net/profile_network_context_service.cc
+++ chrome/browser/net/profile_network_context_service.cc
@@ -411,6 +411,8 @@ ProfileNetworkContextService::CreateNetworkContextParams(
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/post_task.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h"
@@ -411,16 +412,23 @@ ProfileNetworkContextService::CreateNetworkContextParams(
CONTENT_SETTINGS_TYPE_COOKIES, std::string(), &settings);
network_context_params->cookie_manager_params->settings = std::move(settings);
@ -11,6 +19,21 @@ index 2b24d1ac1b5b..f2d97cd93fb1 100644
// Configure on-disk storage for non-OTR profiles. OTR profiles just use
// default behavior (in memory storage, default sizes).
PrefService* prefs = profile_->GetPrefs();
if (!in_memory) {
// Configure the HTTP cache path and size.
base::FilePath base_cache_path;
+#if BUILDFLAG(ENABLE_CEF)
+ base_cache_path = prefs->GetFilePath(prefs::kDiskCacheDir);
+ DCHECK(!base_cache_path.empty());
+#else
chrome::GetUserCacheDirectory(path, &base_cache_path);
base::FilePath disk_cache_dir = prefs->GetFilePath(prefs::kDiskCacheDir);
if (!disk_cache_dir.empty())
base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName());
+#endif
network_context_params->http_cache_path =
base_cache_path.Append(chrome::kCacheDirname);
network_context_params->http_cache_max_size =
diff --git chrome/browser/profiles/profile.h chrome/browser/profiles/profile.h
index c70a4c0f48ac..8aaadf324a0e 100644
--- chrome/browser/profiles/profile.h