OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/exo/wm_helper.h" | 5 #include "components/exo/wm_helper.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 | 8 |
9 namespace exo { | 9 namespace exo { |
10 namespace { | 10 namespace { |
11 WMHelper* g_instance = nullptr; | 11 WMHelper* g_instance = nullptr; |
12 } | 12 } |
13 | 13 |
14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
15 // WMHelper, public: | 15 // WMHelper, public: |
16 | 16 |
17 WMHelper::WMHelper() {} | 17 WMHelper::WMHelper() {} |
18 | 18 |
19 WMHelper::~WMHelper() {} | 19 WMHelper::~WMHelper() {} |
20 | 20 |
21 // static | 21 // static |
22 void WMHelper::SetInstance(WMHelper* helper) { | 22 void WMHelper::SetInstance(WMHelper* helper) { |
23 DCHECK_NE(!!helper, !!g_instance); | 23 DCHECK_NE(!!helper, !!g_instance); |
24 g_instance = helper; | 24 g_instance = helper; |
25 } | 25 } |
26 | 26 |
27 // static | 27 // static |
28 WMHelper* WMHelper::GetInstance() { | 28 WMHelper* WMHelper::GetInstance() { |
29 DCHECK(g_instance); | |
reveman
2017/05/11 13:01:35
Should we be calling WMHelper::SetInstance in the
David Tseng
2017/05/11 17:20:47
Thanks, that's a better way to do it.
| |
30 return g_instance; | 29 return g_instance; |
31 } | 30 } |
32 | 31 |
33 void WMHelper::AddActivationObserver(ActivationObserver* observer) { | 32 void WMHelper::AddActivationObserver(ActivationObserver* observer) { |
34 activation_observers_.AddObserver(observer); | 33 activation_observers_.AddObserver(observer); |
35 } | 34 } |
36 | 35 |
37 void WMHelper::RemoveActivationObserver(ActivationObserver* observer) { | 36 void WMHelper::RemoveActivationObserver(ActivationObserver* observer) { |
38 activation_observers_.RemoveObserver(observer); | 37 activation_observers_.RemoveObserver(observer); |
39 } | 38 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 for (InputDeviceEventObserver& observer : input_device_event_observers_) | 134 for (InputDeviceEventObserver& observer : input_device_event_observers_) |
136 observer.OnKeyboardDeviceConfigurationChanged(); | 135 observer.OnKeyboardDeviceConfigurationChanged(); |
137 } | 136 } |
138 | 137 |
139 void WMHelper::NotifyDisplayConfigurationChanged() { | 138 void WMHelper::NotifyDisplayConfigurationChanged() { |
140 for (DisplayConfigurationObserver& observer : display_config_observers_) | 139 for (DisplayConfigurationObserver& observer : display_config_observers_) |
141 observer.OnDisplayConfigurationChanged(); | 140 observer.OnDisplayConfigurationChanged(); |
142 } | 141 } |
143 | 142 |
144 } // namespace exo | 143 } // namespace exo |
OLD | NEW |