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 "ash/common/wm_shell.h" | 5 #include "ash/common/wm_shell.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/focus_cycler.h" | 9 #include "ash/common/focus_cycler.h" |
10 #include "ash/common/keyboard/keyboard_ui.h" | 10 #include "ash/common/keyboard/keyboard_ui.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // static | 35 // static |
36 void WmShell::Set(WmShell* instance) { | 36 void WmShell::Set(WmShell* instance) { |
37 instance_ = instance; | 37 instance_ = instance; |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 WmShell* WmShell::Get() { | 41 WmShell* WmShell::Get() { |
42 return instance_; | 42 return instance_; |
43 } | 43 } |
44 | 44 |
| 45 void WmShell::Initialize() { |
| 46 // Some delegates access WmShell during their construction. Create them here |
| 47 // instead of the WmShell constructor. |
| 48 media_delegate_.reset(delegate_->CreateMediaDelegate()); |
| 49 } |
| 50 |
45 void WmShell::OnMaximizeModeStarted() { | 51 void WmShell::OnMaximizeModeStarted() { |
46 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); | 52 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); |
47 } | 53 } |
48 | 54 |
49 void WmShell::OnMaximizeModeEnded() { | 55 void WmShell::OnMaximizeModeEnded() { |
50 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); | 56 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); |
51 } | 57 } |
52 | 58 |
53 void WmShell::NotifyPinnedStateChanged(WmWindow* pinned_window) { | 59 void WmShell::NotifyPinnedStateChanged(WmWindow* pinned_window) { |
54 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 60 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 104 } |
99 } | 105 } |
100 } | 106 } |
101 return false; | 107 return false; |
102 } | 108 } |
103 | 109 |
104 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) { | 110 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) { |
105 keyboard_ui_ = std::move(keyboard_ui); | 111 keyboard_ui_ = std::move(keyboard_ui); |
106 } | 112 } |
107 | 113 |
108 void WmShell::SetMediaDelegate(std::unique_ptr<MediaDelegate> delegate) { | |
109 media_delegate_ = std::move(delegate); | |
110 } | |
111 | |
112 void WmShell::SetSystemTrayDelegate( | 114 void WmShell::SetSystemTrayDelegate( |
113 std::unique_ptr<SystemTrayDelegate> delegate) { | 115 std::unique_ptr<SystemTrayDelegate> delegate) { |
114 DCHECK(delegate); | 116 DCHECK(delegate); |
115 DCHECK(!system_tray_delegate_); | 117 DCHECK(!system_tray_delegate_); |
116 // TODO(jamescook): Create via ShellDelegate once it moves to //ash/common. | 118 // TODO(jamescook): Create via ShellDelegate once it moves to //ash/common. |
117 system_tray_delegate_ = std::move(delegate); | 119 system_tray_delegate_ = std::move(delegate); |
118 system_tray_delegate_->Initialize(); | 120 system_tray_delegate_->Initialize(); |
119 #if defined(OS_CHROMEOS) | 121 #if defined(OS_CHROMEOS) |
120 logout_confirmation_controller_.reset(new LogoutConfirmationController( | 122 logout_confirmation_controller_.reset(new LogoutConfirmationController( |
121 base::Bind(&SystemTrayDelegate::SignOut, | 123 base::Bind(&SystemTrayDelegate::SignOut, |
(...skipping 23 matching lines...) Expand all Loading... |
145 | 147 |
146 void WmShell::CreateMruWindowTracker() { | 148 void WmShell::CreateMruWindowTracker() { |
147 mru_window_tracker_.reset(new MruWindowTracker); | 149 mru_window_tracker_.reset(new MruWindowTracker); |
148 } | 150 } |
149 | 151 |
150 void WmShell::DeleteMruWindowTracker() { | 152 void WmShell::DeleteMruWindowTracker() { |
151 mru_window_tracker_.reset(); | 153 mru_window_tracker_.reset(); |
152 } | 154 } |
153 | 155 |
154 } // namespace ash | 156 } // namespace ash |
OLD | NEW |