pref_store_delegate.cc 952 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) 2018 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "shell/browser/pref_store_delegate.h"
  5. #include <utility>
  6. #include "components/prefs/persistent_pref_store.h"
  7. #include "components/prefs/pref_store.h"
  8. #include "components/prefs/value_map_pref_store.h"
  9. #include "shell/browser/electron_browser_context.h"
  10. namespace electron {
  11. PrefStoreDelegate::PrefStoreDelegate(
  12. base::WeakPtr<ElectronBrowserContext> browser_context)
  13. : browser_context_(std::move(browser_context)) {}
  14. PrefStoreDelegate::~PrefStoreDelegate() {
  15. if (browser_context_)
  16. browser_context_->set_in_memory_pref_store(nullptr);
  17. }
  18. void PrefStoreDelegate::UpdateCommandLinePrefStore(
  19. PrefStore* command_line_prefs) {
  20. if (browser_context_)
  21. browser_context_->set_in_memory_pref_store(
  22. static_cast<ValueMapPrefStore*>(command_line_prefs));
  23. }
  24. } // namespace electron