OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/video_detector.h" | 5 #include "ash/wm/video_detector.h" |
6 | 6 |
7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(WindowInfo); | 78 DISALLOW_COPY_AND_ASSIGN(WindowInfo); |
79 }; | 79 }; |
80 | 80 |
81 VideoDetector::VideoDetector() | 81 VideoDetector::VideoDetector() |
82 : state_(State::NOT_PLAYING), | 82 : state_(State::NOT_PLAYING), |
83 video_is_playing_(false), | 83 video_is_playing_(false), |
84 window_observer_manager_(this), | 84 window_observer_manager_(this), |
85 is_shutting_down_(false) { | 85 is_shutting_down_(false) { |
86 aura::Env::GetInstance()->AddObserver(this); | 86 aura::Env::GetInstance()->AddObserver(this); |
87 WmShell::Get()->AddShellObserver(this); | 87 Shell::GetInstance()->AddShellObserver(this); |
88 } | 88 } |
89 | 89 |
90 VideoDetector::~VideoDetector() { | 90 VideoDetector::~VideoDetector() { |
91 WmShell::Get()->RemoveShellObserver(this); | 91 Shell::GetInstance()->RemoveShellObserver(this); |
92 aura::Env::GetInstance()->RemoveObserver(this); | 92 aura::Env::GetInstance()->RemoveObserver(this); |
93 } | 93 } |
94 | 94 |
95 void VideoDetector::AddObserver(Observer* observer) { | 95 void VideoDetector::AddObserver(Observer* observer) { |
96 observers_.AddObserver(observer); | 96 observers_.AddObserver(observer); |
97 } | 97 } |
98 | 98 |
99 void VideoDetector::RemoveObserver(Observer* observer) { | 99 void VideoDetector::RemoveObserver(Observer* observer) { |
100 observers_.RemoveObserver(observer); | 100 observers_.RemoveObserver(observer); |
101 } | 101 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 | 192 |
193 if (state_ != new_state) { | 193 if (state_ != new_state) { |
194 state_ = new_state; | 194 state_ = new_state; |
195 for (auto& observer : observers_) | 195 for (auto& observer : observers_) |
196 observer.OnVideoStateChanged(state_); | 196 observer.OnVideoStateChanged(state_); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 } // namespace ash | 200 } // namespace ash |
OLD | NEW |