| 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 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WMHelper::AddCursorObserver(CursorObserver* observer) { | 49 void WMHelper::AddCursorObserver(CursorObserver* observer) { |
| 50 cursor_observers_.AddObserver(observer); | 50 cursor_observers_.AddObserver(observer); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void WMHelper::RemoveCursorObserver(CursorObserver* observer) { | 53 void WMHelper::RemoveCursorObserver(CursorObserver* observer) { |
| 54 cursor_observers_.RemoveObserver(observer); | 54 cursor_observers_.RemoveObserver(observer); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void WMHelper::AddMaximizeModeObserver(MaximizeModeObserver* observer) { | 57 void WMHelper::AddShellObserver(ShellObserver* observer) { |
| 58 maximize_mode_observers_.AddObserver(observer); | 58 shell_observers_.AddObserver(observer); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void WMHelper::RemoveMaximizeModeObserver(MaximizeModeObserver* observer) { | 61 void WMHelper::RemoveShellObserver(ShellObserver* observer) { |
| 62 maximize_mode_observers_.RemoveObserver(observer); | 62 shell_observers_.RemoveObserver(observer); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void WMHelper::AddAccessibilityObserver(AccessibilityObserver* observer) { | 65 void WMHelper::AddAccessibilityObserver(AccessibilityObserver* observer) { |
| 66 accessibility_observers_.AddObserver(observer); | 66 accessibility_observers_.AddObserver(observer); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void WMHelper::RemoveAccessibilityObserver(AccessibilityObserver* observer) { | 69 void WMHelper::RemoveAccessibilityObserver(AccessibilityObserver* observer) { |
| 70 accessibility_observers_.RemoveObserver(observer); | 70 accessibility_observers_.RemoveObserver(observer); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void WMHelper::NotifyWindowActivated(aura::Window* gained_active, | 73 void WMHelper::NotifyWindowActivated(aura::Window* gained_active, |
| 74 aura::Window* lost_active) { | 74 aura::Window* lost_active) { |
| 75 FOR_EACH_OBSERVER(ActivationObserver, activation_observers_, | 75 for (ActivationObserver& observer : activation_observers_) |
| 76 OnWindowActivated(gained_active, lost_active)); | 76 observer.OnWindowActivated(gained_active, lost_active); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void WMHelper::NotifyWindowFocused(aura::Window* gained_focus, | 79 void WMHelper::NotifyWindowFocused(aura::Window* gained_focus, |
| 80 aura::Window* lost_focus) { | 80 aura::Window* lost_focus) { |
| 81 FOR_EACH_OBSERVER(FocusObserver, focus_observers_, | 81 for (FocusObserver& observer : focus_observers_) |
| 82 OnWindowFocused(gained_focus, lost_focus)); | 82 observer.OnWindowFocused(gained_focus, lost_focus); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void WMHelper::NotifyCursorVisibilityChanged(bool is_visible) { | 85 void WMHelper::NotifyCursorVisibilityChanged(bool is_visible) { |
| 86 FOR_EACH_OBSERVER(CursorObserver, cursor_observers_, | 86 for (CursorObserver& observer : cursor_observers_) |
| 87 OnCursorVisibilityChanged(is_visible)); | 87 observer.OnCursorVisibilityChanged(is_visible); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void WMHelper::NotifyCursorSetChanged(ui::CursorSetType cursor_set) { | 90 void WMHelper::NotifyCursorSetChanged(ui::CursorSetType cursor_set) { |
| 91 FOR_EACH_OBSERVER(CursorObserver, cursor_observers_, | 91 for (CursorObserver& observer : cursor_observers_) |
| 92 OnCursorSetChanged(cursor_set)); | 92 observer.OnCursorSetChanged(cursor_set); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WMHelper::NotifyMaximizeModeStarted() { | 95 void WMHelper::NotifyMaximizeModeStarted() { |
| 96 FOR_EACH_OBSERVER(MaximizeModeObserver, maximize_mode_observers_, | 96 for (ShellObserver& observer : shell_observers_) |
| 97 OnMaximizeModeStarted()); | 97 observer.OnMaximizeModeStarted(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void WMHelper::NotifyMaximizeModeEnded() { | 100 void WMHelper::NotifyMaximizeModeEnded() { |
| 101 FOR_EACH_OBSERVER(MaximizeModeObserver, maximize_mode_observers_, | 101 for (ShellObserver& observer : shell_observers_) |
| 102 OnMaximizeModeEnded()); | 102 observer.OnMaximizeModeEnded(); |
| 103 } |
| 104 |
| 105 void WMHelper::NotifyOverviewModeStarted() { |
| 106 for (ShellObserver& observer : shell_observers_) |
| 107 observer.OnOverviewModeStarted(); |
| 108 } |
| 109 |
| 110 void WMHelper::NotifyOverviewModeEnded() { |
| 111 for (ShellObserver& observer : shell_observers_) |
| 112 observer.OnOverviewModeEnded(); |
| 103 } | 113 } |
| 104 | 114 |
| 105 void WMHelper::NotifyAccessibilityModeChanged() { | 115 void WMHelper::NotifyAccessibilityModeChanged() { |
| 106 FOR_EACH_OBSERVER(AccessibilityObserver, accessibility_observers_, | 116 for (AccessibilityObserver& observer : accessibility_observers_) |
| 107 OnAccessibilityModeChanged()); | 117 observer.OnAccessibilityModeChanged(); |
| 108 } | 118 } |
| 109 | 119 |
| 110 } // namespace exo | 120 } // namespace exo |
| OLD | NEW |