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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 void VideoDetector::RemoveObserver(VideoDetectorObserver* observer) { | 79 void VideoDetector::RemoveObserver(VideoDetectorObserver* observer) { |
80 observers_.RemoveObserver(observer); | 80 observers_.RemoveObserver(observer); |
81 } | 81 } |
82 | 82 |
83 void VideoDetector::OnWindowInitialized(aura::Window* window) { | 83 void VideoDetector::OnWindowInitialized(aura::Window* window) { |
84 observer_manager_.Add(window); | 84 observer_manager_.Add(window); |
85 } | 85 } |
86 | 86 |
87 void VideoDetector::OnWindowPaintScheduled(aura::Window* window, | 87 void VideoDetector::OnDelegatedFrameDamage( |
88 const gfx::Rect& region) { | 88 aura::Window* window, |
| 89 const gfx::Rect& damage_rect_in_dip) { |
89 if (is_shutting_down_) | 90 if (is_shutting_down_) |
90 return; | 91 return; |
91 linked_ptr<WindowInfo>& info = window_infos_[window]; | 92 linked_ptr<WindowInfo>& info = window_infos_[window]; |
92 if (!info.get()) | 93 if (!info.get()) |
93 info.reset(new WindowInfo); | 94 info.reset(new WindowInfo); |
94 | 95 |
95 base::TimeTicks now = | 96 base::TimeTicks now = |
96 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); | 97 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); |
97 if (info->RecordUpdateAndCheckForVideo(region, now)) | 98 if (info->RecordUpdateAndCheckForVideo(damage_rect_in_dip, now)) |
98 MaybeNotifyObservers(window, now); | 99 MaybeNotifyObservers(window, now); |
99 } | 100 } |
100 | 101 |
101 void VideoDetector::OnWindowDestroyed(aura::Window* window) { | 102 void VideoDetector::OnWindowDestroyed(aura::Window* window) { |
102 window_infos_.erase(window); | 103 window_infos_.erase(window); |
103 observer_manager_.Remove(window); | 104 observer_manager_.Remove(window); |
104 } | 105 } |
105 | 106 |
106 void VideoDetector::OnAppTerminating() { | 107 void VideoDetector::OnAppTerminating() { |
107 // Stop checking video activity once the shutdown | 108 // Stop checking video activity once the shutdown |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 146 } |
146 } | 147 } |
147 | 148 |
148 FOR_EACH_OBSERVER(VideoDetectorObserver, | 149 FOR_EACH_OBSERVER(VideoDetectorObserver, |
149 observers_, | 150 observers_, |
150 OnVideoDetected(fullscreen_window_exists)); | 151 OnVideoDetected(fullscreen_window_exists)); |
151 last_observer_notification_time_ = now; | 152 last_observer_notification_time_ = now; |
152 } | 153 } |
153 | 154 |
154 } // namespace ash | 155 } // namespace ash |
OLD | NEW |