| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 CGWindowID original_window) { | 150 CGWindowID original_window) { |
| 151 if (!IsChromeWindow(original_window) || !IsWindowMinimized(original_window)) | 151 if (!IsChromeWindow(original_window) || !IsWindowMinimized(original_window)) |
| 152 return kCGNullWindowID; | 152 return kCGNullWindowID; |
| 153 | 153 |
| 154 CGWindowID full_screen_window_id = | 154 CGWindowID full_screen_window_id = |
| 155 FindFullScreenWindowWithSamePidAndTitle(original_window); | 155 FindFullScreenWindowWithSamePidAndTitle(original_window); |
| 156 | 156 |
| 157 if (full_screen_window_id == kCGNullWindowID) | 157 if (full_screen_window_id == kCGNullWindowID) |
| 158 return kCGNullWindowID; | 158 return kCGNullWindowID; |
| 159 | 159 |
| 160 for (WindowCapturer::WindowList::iterator it = previous_window_list_.begin(); | 160 for (const auto& window : previous_window_list_) { |
| 161 it != previous_window_list_.end(); ++it) { | 161 if (static_cast<CGWindowID>(window.id) != full_screen_window_id) |
| 162 if (static_cast<CGWindowID>(it->id) != full_screen_window_id) | |
| 163 continue; | 162 continue; |
| 164 | 163 |
| 165 LOG(LS_WARNING) << "The full-screen window exists in the list."; | 164 LOG(LS_WARNING) << "The full-screen window exists in the list."; |
| 166 return kCGNullWindowID; | 165 return kCGNullWindowID; |
| 167 } | 166 } |
| 168 | 167 |
| 169 return full_screen_window_id; | 168 return full_screen_window_id; |
| 170 } | 169 } |
| 171 | 170 |
| 172 void FullScreenChromeWindowDetector::UpdateWindowListIfNeeded( | 171 void FullScreenChromeWindowDetector::UpdateWindowListIfNeeded( |
| 173 CGWindowID original_window) { | 172 CGWindowID original_window) { |
| 174 if (IsChromeWindow(original_window) && | 173 if (IsChromeWindow(original_window) && |
| 175 (rtc::TimeNanos() - last_update_time_ns_) / rtc::kNumNanosecsPerMillisec | 174 (rtc::TimeNanos() - last_update_time_ns_) / rtc::kNumNanosecsPerMillisec |
| 176 > kUpdateIntervalMs) { | 175 > kUpdateIntervalMs) { |
| 177 previous_window_list_.clear(); | 176 previous_window_list_.clear(); |
| 178 previous_window_list_.swap(current_window_list_); | 177 previous_window_list_.swap(current_window_list_); |
| 179 | 178 |
| 180 // No need to update the window list when the window is minimized. | 179 // No need to update the window list when the window is minimized. |
| 181 if (IsWindowMinimized(original_window)) { | 180 if (IsWindowMinimized(original_window)) { |
| 182 previous_window_list_.clear(); | 181 previous_window_list_.clear(); |
| 183 return; | 182 return; |
| 184 } | 183 } |
| 185 | 184 |
| 186 GetWindowList(¤t_window_list_); | 185 GetWindowList(¤t_window_list_, false); |
| 187 last_update_time_ns_ = rtc::TimeNanos(); | 186 last_update_time_ns_ = rtc::TimeNanos(); |
| 188 } | 187 } |
| 189 } | 188 } |
| 190 | 189 |
| 191 } // namespace webrtc | 190 } // namespace webrtc |
| OLD | NEW |