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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 void VideoDetector::OnWindowInitialized(aura::Window* window) { | 113 void VideoDetector::OnWindowInitialized(aura::Window* window) { |
114 window_observer_manager_.Add(window); | 114 window_observer_manager_.Add(window); |
115 } | 115 } |
116 | 116 |
117 void VideoDetector::OnDelegatedFrameDamage( | 117 void VideoDetector::OnDelegatedFrameDamage( |
118 aura::Window* window, | 118 aura::Window* window, |
119 const gfx::Rect& damage_rect_in_dip) { | 119 const gfx::Rect& damage_rect_in_dip) { |
120 if (is_shutting_down_) | 120 if (is_shutting_down_) |
121 return; | 121 return; |
122 linked_ptr<WindowInfo>& info = window_infos_[window]; | 122 std::unique_ptr<WindowInfo>& info = window_infos_[window]; |
123 if (!info.get()) | 123 if (!info.get()) |
124 info.reset(new WindowInfo); | 124 info.reset(new WindowInfo); |
125 | 125 |
126 base::TimeTicks now = | 126 base::TimeTicks now = |
127 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); | 127 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); |
128 if (info->RecordUpdateAndCheckForVideo(damage_rect_in_dip, now)) | 128 if (info->RecordUpdateAndCheckForVideo(damage_rect_in_dip, now)) |
129 HandleVideoActivity(window, now); | 129 HandleVideoActivity(window, now); |
130 } | 130 } |
131 | 131 |
132 void VideoDetector::OnWindowDestroyed(aura::Window* window) { | 132 void VideoDetector::OnWindowDestroyed(aura::Window* window) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 if (state_ != new_state) { | 192 if (state_ != new_state) { |
193 state_ = new_state; | 193 state_ = new_state; |
194 for (auto& observer : observers_) | 194 for (auto& observer : observers_) |
195 observer.OnVideoStateChanged(state_); | 195 observer.OnVideoStateChanged(state_); |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 } // namespace ash | 199 } // namespace ash |
OLD | NEW |