Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Jimmy Gong | 64d2c63 | 2021-11-03 10:41:44 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "ui/base/shortcut_mapping_pref_delegate.h" |
| 6 | |
| 7 | #include "base/check.h" |
| 8 | #include "base/check_op.h" |
| 9 | |
| 10 | namespace ui { |
| 11 | |
| 12 | // static |
| 13 | ShortcutMappingPrefDelegate* ShortcutMappingPrefDelegate::instance_ = nullptr; |
| 14 | |
| 15 | // static |
| 16 | ShortcutMappingPrefDelegate* ShortcutMappingPrefDelegate::GetInstance() { |
| 17 | return instance_; |
| 18 | } |
| 19 | |
| 20 | // static |
| 21 | bool ShortcutMappingPrefDelegate::IsInitialized() { |
| 22 | return instance_ != nullptr; |
| 23 | } |
| 24 | |
| 25 | ShortcutMappingPrefDelegate::ShortcutMappingPrefDelegate() { |
| 26 | DCHECK(!instance_); |
| 27 | instance_ = this; |
| 28 | } |
| 29 | |
| 30 | ShortcutMappingPrefDelegate::~ShortcutMappingPrefDelegate() { |
| 31 | DCHECK_EQ(instance_, this); |
| 32 | instance_ = nullptr; |
| 33 | } |
| 34 | |
| 35 | } // namespace ui |