|
@@ -17,6 +17,9 @@
|
|
|
#include "base/strings/string_number_conversions.h"
|
|
|
#include "base/strings/utf_string_conversions.h"
|
|
|
#include "chrome/browser/icon_manager.h"
|
|
|
+#include "chrome/common/chrome_paths.h"
|
|
|
+#include "chrome/common/chrome_switches.h"
|
|
|
+#include "components/os_crypt/key_storage_config_linux.h"
|
|
|
#include "components/os_crypt/os_crypt.h"
|
|
|
#include "content/browser/browser_main_loop.h" // nogncheck
|
|
|
#include "content/public/browser/browser_thread.h"
|
|
@@ -466,6 +469,26 @@ void ElectronBrowserMainParts::PostCreateMainMessageLoop() {
|
|
|
ui::OzonePlatform::GetInstance()->PostCreateMainMessageLoop(
|
|
|
std::move(shutdown_cb));
|
|
|
bluez::DBusBluezManagerWrapperLinux::Initialize();
|
|
|
+
|
|
|
+ // Set up crypt config. This needs to be done before anything starts the
|
|
|
+ // network service, as the raw encryption key needs to be shared with the
|
|
|
+ // network service for encrypted cookie storage.
|
|
|
+ std::string app_name = electron::Browser::Get()->GetName();
|
|
|
+ const base::CommandLine& command_line =
|
|
|
+ *base::CommandLine::ForCurrentProcess();
|
|
|
+ std::unique_ptr<os_crypt::Config> config =
|
|
|
+ std::make_unique<os_crypt::Config>();
|
|
|
+ // Forward to os_crypt the flag to use a specific password store.
|
|
|
+ config->store = command_line.GetSwitchValueASCII(::switches::kPasswordStore);
|
|
|
+ config->product_name = app_name;
|
|
|
+ config->application_name = app_name;
|
|
|
+ config->main_thread_runner = base::ThreadTaskRunnerHandle::Get();
|
|
|
+ // c.f.
|
|
|
+ // https://source.chromium.org/chromium/chromium/src/+/master:chrome/common/chrome_switches.cc;l=689;drc=9d82515060b9b75fa941986f5db7390299669ef1
|
|
|
+ config->should_use_preference =
|
|
|
+ command_line.HasSwitch(::switches::kEnableEncryptionSelection);
|
|
|
+ base::PathService::Get(chrome::DIR_USER_DATA, &config->user_data_path);
|
|
|
+ OSCrypt::SetConfig(std::move(config));
|
|
|
#endif
|
|
|
#if defined(OS_POSIX)
|
|
|
// Exit in response to SIGINT, SIGTERM, etc.
|