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_presentation.h" | 5 #include "chrome/browser/extensions/api/tab_capture/offscreen_presentation.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" | 10 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" |
11 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h" | |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/web_contents_sizer.h" | 13 #include "chrome/browser/ui/web_contents_sizer.h" |
13 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "extensions/browser/extension_host.h" | 16 #include "extensions/browser/extension_host.h" |
16 #include "extensions/browser/process_manager.h" | 17 #include "extensions/browser/process_manager.h" |
17 | 18 |
18 #if defined(USE_AURA) | 19 #if defined(USE_AURA) |
19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
20 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 #endif | 195 #endif |
195 | 196 |
196 // Set initial size, if specified. | 197 // Set initial size, if specified. |
197 if (!initial_size.IsEmpty()) | 198 if (!initial_size.IsEmpty()) |
198 ResizeWebContents(presentation_web_contents_.get(), initial_size); | 199 ResizeWebContents(presentation_web_contents_.get(), initial_size); |
199 | 200 |
200 // Mute audio output. When tab capture starts, the audio will be | 201 // Mute audio output. When tab capture starts, the audio will be |
201 // automatically unmuted, but will be captured into the MediaStream. | 202 // automatically unmuted, but will be captured into the MediaStream. |
202 presentation_web_contents_->SetAudioMuted(true); | 203 presentation_web_contents_->SetAudioMuted(true); |
203 | 204 |
204 // TODO(imcheng): If |presentation_id_| is not empty, register it with the | |
205 // PresentationRouter. http://crbug.com/513859 | |
206 if (!presentation_id_.empty()) { | 205 if (!presentation_id_.empty()) { |
207 NOTIMPLEMENTED() | 206 // Register the offscreen tab as the receiver of the offscreen presentation. |
208 << "Register with PresentationRouter, id=" << presentation_id_; | 207 media_router::ReceiverPresentationServiceDelegateImpl::CreateForWebContents( |
miu
2015/10/07 21:51:46
sanity-check: Do we need to make sure there isn't
imcheng
2015/10/10 04:39:43
We have a DCHECK for that in OffscreenPresentation
| |
208 presentation_web_contents_.get(), presentation_id_); | |
209 } | 209 } |
210 | 210 |
211 // Navigate to the initial URL of the presentation. | 211 // Navigate to the initial URL of the presentation. |
212 content::NavigationController::LoadURLParams load_params(start_url_); | 212 content::NavigationController::LoadURLParams load_params(start_url_); |
213 load_params.should_replace_current_entry = true; | 213 load_params.should_replace_current_entry = true; |
214 load_params.should_clear_history_list = true; | 214 load_params.should_clear_history_list = true; |
215 presentation_web_contents_->GetController().LoadURLWithParams(load_params); | 215 presentation_web_contents_->GetController().LoadURLWithParams(load_params); |
216 | 216 |
217 start_time_ = base::TimeTicks::Now(); | 217 start_time_ = base::TimeTicks::Now(); |
218 DieIfContentCaptureEnded(); | 218 DieIfContentCaptureEnded(); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 | 455 |
456 // Schedule the timer to check again in a second. | 456 // Schedule the timer to check again in a second. |
457 capture_poll_timer_.Start( | 457 capture_poll_timer_.Start( |
458 FROM_HERE, | 458 FROM_HERE, |
459 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), | 459 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), |
460 base::Bind(&OffscreenPresentation::DieIfContentCaptureEnded, | 460 base::Bind(&OffscreenPresentation::DieIfContentCaptureEnded, |
461 base::Unretained(this))); | 461 base::Unretained(this))); |
462 } | 462 } |
463 | 463 |
464 } // namespace extensions | 464 } // namespace extensions |
OLD | NEW |