shortcut_mapping_pref_delegate.cc 823 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/base/shortcut_mapping_pref_delegate.h"
  5. #include "base/check.h"
  6. #include "base/check_op.h"
  7. namespace ui {
  8. // static
  9. ShortcutMappingPrefDelegate* ShortcutMappingPrefDelegate::instance_ = nullptr;
  10. // static
  11. ShortcutMappingPrefDelegate* ShortcutMappingPrefDelegate::GetInstance() {
  12. return instance_;
  13. }
  14. // static
  15. bool ShortcutMappingPrefDelegate::IsInitialized() {
  16. return instance_ != nullptr;
  17. }
  18. ShortcutMappingPrefDelegate::ShortcutMappingPrefDelegate() {
  19. DCHECK(!instance_);
  20. instance_ = this;
  21. }
  22. ShortcutMappingPrefDelegate::~ShortcutMappingPrefDelegate() {
  23. DCHECK_EQ(instance_, this);
  24. instance_ = nullptr;
  25. }
  26. } // namespace ui