mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
alloy: Remove CefSettings.user_data_path (fixes #3511)
This change replaces existing CefSettings.user_data_path usage with CefSettings.root_cache_path for better alignment with the Chrome runtime. All files should now be written inside the root_cache_path directory.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "chrome/browser/ui/color/chrome_color_mixers.h"
|
||||
#include "chrome/browser/ui/javascript_dialogs/chrome_javascript_app_modal_dialog_view_factory.h"
|
||||
#include "chrome/browser/ui/ui_features.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/constrained_window/constrained_window_views.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
@@ -58,6 +59,7 @@
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "base/enterprise_util.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "chrome/browser/win/parental_controls.h"
|
||||
#endif
|
||||
@@ -82,7 +84,6 @@
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/browser/themes/theme_service_aura_linux.h"
|
||||
#include "chrome/browser/ui/views/theme_profile_key.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/grit/chromium_strings.h"
|
||||
#include "components/os_crypt/sync/key_storage_config_linux.h"
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
@@ -241,6 +242,10 @@ void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
|
||||
DCHECK(!config->user_data_path.empty());
|
||||
OSCrypt::SetConfig(std::move(config));
|
||||
#endif // BUILDFLAG(IS_LINUX)
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
base::SetExtraNoExecuteAllowedPath(chrome::DIR_USER_DATA);
|
||||
#endif
|
||||
}
|
||||
|
||||
int AlloyBrowserMainParts::PreCreateThreads() {
|
||||
|
@@ -300,11 +300,11 @@ void BindNetworkHintsHandler(
|
||||
predictors::NetworkHintsHandlerImpl::Create(frame_host, std::move(receiver));
|
||||
}
|
||||
|
||||
base::FilePath GetRootCachePath() {
|
||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
||||
// cache_path values be either equal to or a child of root_cache_path.
|
||||
return base::FilePath(
|
||||
CefString(&CefContext::Get()->settings().root_cache_path));
|
||||
base::FilePath GetUserDataPath() {
|
||||
base::FilePath user_data_path;
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
DCHECK(!user_data_path.empty());
|
||||
return user_data_path;
|
||||
}
|
||||
|
||||
const extensions::Extension* GetEnabledExtensionFromSiteURL(
|
||||
@@ -1159,19 +1159,7 @@ bool AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
// directories that are not returned by this method.
|
||||
std::vector<base::FilePath>
|
||||
AlloyContentBrowserClient::GetNetworkContextsParentDirectory() {
|
||||
base::FilePath user_data_path;
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
DCHECK(!user_data_path.empty());
|
||||
|
||||
const auto& root_cache_path = GetRootCachePath();
|
||||
|
||||
// root_cache_path may sometimes be empty or a child of user_data_path, so
|
||||
// only return the one path in that case.
|
||||
if (root_cache_path.empty() || user_data_path.IsParent(root_cache_path)) {
|
||||
return {user_data_path};
|
||||
}
|
||||
|
||||
return {user_data_path, root_cache_path};
|
||||
return {GetUserDataPath()};
|
||||
}
|
||||
|
||||
bool AlloyContentBrowserClient::HandleExternalProtocol(
|
||||
@@ -1282,7 +1270,7 @@ void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForServiceWorker(
|
||||
|
||||
base::FilePath
|
||||
AlloyContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
|
||||
return GetRootCachePath();
|
||||
return GetUserDataPath();
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetProduct() {
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/permissions/chrome_permissions_client.h"
|
||||
@@ -24,6 +25,7 @@
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "chrome/browser/printing/print_preview_dialog_controller.h"
|
||||
#include "chrome/browser/ui/prefs/pref_watcher.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "components/component_updater/component_updater_service.h"
|
||||
#include "components/component_updater/timer_update_scheduler.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
@@ -186,16 +188,15 @@ ProfileManager* ChromeBrowserProcessAlloy::profile_manager() {
|
||||
PrefService* ChromeBrowserProcessAlloy::local_state() {
|
||||
DCHECK(initialized_);
|
||||
if (!local_state_) {
|
||||
// Use a location that is shared by all request contexts.
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings.root_cache_path));
|
||||
base::FilePath user_data_path;
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
DCHECK(!user_data_path.empty());
|
||||
|
||||
// Used for very early NetworkService initialization.
|
||||
// Always persist preferences for this PrefService if possible because it
|
||||
// contains the cookie encryption key on Windows.
|
||||
local_state_ =
|
||||
browser_prefs::CreatePrefService(nullptr /* profile */, root_cache_path,
|
||||
browser_prefs::CreatePrefService(nullptr /* profile */, user_data_path,
|
||||
true /* persist_user_preferences */);
|
||||
}
|
||||
return local_state_.get();
|
||||
|
@@ -462,7 +462,6 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
"browser_subprocess_path");
|
||||
NormalizePathAndSet(settings_.framework_dir_path, "framework_dir_path");
|
||||
NormalizePathAndSet(settings_.main_bundle_path, "main_bundle_path");
|
||||
NormalizePathAndSet(settings_.user_data_path, "user_data_path");
|
||||
NormalizePathAndSet(settings_.resources_dir_path, "resources_dir_path");
|
||||
NormalizePathAndSet(settings_.locales_dir_path, "locales_dir_path");
|
||||
|
||||
|
@@ -83,18 +83,12 @@ base::FilePath GetUserDataPath(CefSettings* settings,
|
||||
const base::CommandLine* command_line) {
|
||||
// |settings| will be non-nullptr in the main process only.
|
||||
if (settings) {
|
||||
// With the Chrome runtime Profile paths must always be relative to the
|
||||
// user data directory, so defaulting to |root_cache_path| first is
|
||||
// appropriate.
|
||||
CefString user_data_path;
|
||||
if (cef::IsChromeRuntimeEnabled() && settings->root_cache_path.length > 0) {
|
||||
user_data_path = CefString(&settings->root_cache_path);
|
||||
CefString root_cache_path;
|
||||
if (settings->root_cache_path.length > 0) {
|
||||
root_cache_path = CefString(&settings->root_cache_path);
|
||||
}
|
||||
if (user_data_path.empty() && settings->user_data_path.length > 0) {
|
||||
user_data_path = CefString(&settings->user_data_path);
|
||||
}
|
||||
if (!user_data_path.empty()) {
|
||||
return base::FilePath(user_data_path);
|
||||
if (!root_cache_path.empty()) {
|
||||
return base::FilePath(root_cache_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user