electron/shell/browser/pref_store_delegate.cc
2020-02-04 12:19:40 -08:00

30 lines
859 B
C++

// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/pref_store_delegate.h"
#include <utility>
#include "components/prefs/value_map_pref_store.h"
#include "shell/browser/electron_browser_context.h"
namespace electron {
PrefStoreDelegate::PrefStoreDelegate(
base::WeakPtr<ElectronBrowserContext> browser_context)
: 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));
}
} // namespace electron