OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/extensions/api/tab_capture/offscreen_tab.h" | 5 #include "chrome/browser/extensions/api/tab_capture/offscreen_tab.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 if (request.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) { | 382 if (request.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) { |
383 devices.push_back(content::MediaStreamDevice( | 383 devices.push_back(content::MediaStreamDevice( |
384 content::MEDIA_TAB_VIDEO_CAPTURE, std::string(), std::string())); | 384 content::MEDIA_TAB_VIDEO_CAPTURE, std::string(), std::string())); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 DVLOG(2) << "Allowing " << devices.size() | 388 DVLOG(2) << "Allowing " << devices.size() |
389 << " capture devices for OffscreenTab content."; | 389 << " capture devices for OffscreenTab content."; |
390 | 390 |
391 callback.Run( | 391 callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE |
392 devices, | 392 : content::MEDIA_DEVICE_OK, |
393 devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE : | 393 std::unique_ptr<content::MediaStreamUI>(nullptr)); |
394 content::MEDIA_DEVICE_OK, | |
395 scoped_ptr<content::MediaStreamUI>(nullptr)); | |
396 } | 394 } |
397 | 395 |
398 bool OffscreenTab::CheckMediaAccessPermission( | 396 bool OffscreenTab::CheckMediaAccessPermission( |
399 WebContents* contents, | 397 WebContents* contents, |
400 const GURL& security_origin, | 398 const GURL& security_origin, |
401 content::MediaStreamType type) { | 399 content::MediaStreamType type) { |
402 DCHECK_EQ(offscreen_tab_web_contents_.get(), contents); | 400 DCHECK_EQ(offscreen_tab_web_contents_.get(), contents); |
403 return type == content::MEDIA_TAB_AUDIO_CAPTURE || | 401 return type == content::MEDIA_TAB_AUDIO_CAPTURE || |
404 type == content::MEDIA_TAB_VIDEO_CAPTURE; | 402 type == content::MEDIA_TAB_VIDEO_CAPTURE; |
405 } | 403 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 443 |
446 // Schedule the timer to check again in a second. | 444 // Schedule the timer to check again in a second. |
447 capture_poll_timer_.Start( | 445 capture_poll_timer_.Start( |
448 FROM_HERE, | 446 FROM_HERE, |
449 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), | 447 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), |
450 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, | 448 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, |
451 base::Unretained(this))); | 449 base::Unretained(this))); |
452 } | 450 } |
453 | 451 |
454 } // namespace extensions | 452 } // namespace extensions |
OLD | NEW |