2018-10-04 18:08:56 +00:00
|
|
|
// Copyright (c) 2018 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/pref_store_delegate.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "components/prefs/value_map_pref_store.h"
|
2020-02-04 20:19:40 +00:00
|
|
|
#include "shell/browser/electron_browser_context.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2018-10-04 18:08:56 +00:00
|
|
|
|
|
|
|
PrefStoreDelegate::PrefStoreDelegate(
|
2020-02-04 20:19:40 +00:00
|
|
|
base::WeakPtr<ElectronBrowserContext> browser_context)
|
2018-10-04 18:08:56 +00:00
|
|
|
: browser_context_(std::move(browser_context)) {}
|
|
|
|
|
|
|
|
PrefStoreDelegate::~PrefStoreDelegate() {
|
|
|
|
if (browser_context_)
|
|
|
|
browser_context_->set_in_memory_pref_store(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrefStoreDelegate::UpdateCommandLinePrefStore(
|
|
|
|
PrefStore* command_line_prefs) {
|
|
|
|
if (browser_context_)
|
|
|
|
browser_context_->set_in_memory_pref_store(
|
|
|
|
static_cast<ValueMapPrefStore*>(command_line_prefs));
|
|
|
|
}
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|