Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: chrome/browser/extensions/api/tab_capture/offscreen_tab.cc

Issue 2471573005: [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: merge with master Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/media/router/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" 12 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
13 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/web_contents_sizer.h" 15 #include "chrome/browser/ui/web_contents_sizer.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/render_widget_host_view.h" 17 #include "content/public/browser/render_widget_host_view.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/web_preferences.h" 19 #include "content/public/common/web_preferences.h"
19 #include "extensions/browser/extension_host.h" 20 #include "extensions/browser/extension_host.h"
20 #include "extensions/browser/process_manager.h" 21 #include "extensions/browser/process_manager.h"
21 22
22 using content::WebContents; 23 using content::WebContents;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 // Set initial size, if specified. 112 // Set initial size, if specified.
112 if (!initial_size.IsEmpty()) 113 if (!initial_size.IsEmpty())
113 ResizeWebContents(offscreen_tab_web_contents_.get(), 114 ResizeWebContents(offscreen_tab_web_contents_.get(),
114 gfx::Rect(initial_size)); 115 gfx::Rect(initial_size));
115 116
116 // Mute audio output. When tab capture starts, the audio will be 117 // Mute audio output. When tab capture starts, the audio will be
117 // automatically unmuted, but will be captured into the MediaStream. 118 // automatically unmuted, but will be captured into the MediaStream.
118 offscreen_tab_web_contents_->SetAudioMuted(true); 119 offscreen_tab_web_contents_->SetAudioMuted(true);
119 120
120 // TODO(imcheng): If |optional_presentation_id| is not empty, register it with
121 // the PresentationRouter. http://crbug.com/513859
122 if (!optional_presentation_id.empty()) { 121 if (!optional_presentation_id.empty()) {
123 NOTIMPLEMENTED() 122 DVLOG(1) << " Register with ReceiverPresentationServiceDelegateImpl, "
124 << "Register with PresentationRouter, id=" << optional_presentation_id; 123 << "[presentation_id]: " << optional_presentation_id;
124 // Create a ReceiverPSDImpl associated with the offscreen tab's WebContents.
125 // The new instance will set up the necessary infrastructure to allow
126 // controlling peers the ability to connect to the offscreen tab.
127 media_router::ReceiverPresentationServiceDelegateImpl::CreateForWebContents(
128 offscreen_tab_web_contents_.get(), optional_presentation_id);
125 129
126 if (auto* render_view_host = 130 if (auto* render_view_host =
127 offscreen_tab_web_contents_->GetRenderViewHost()) { 131 offscreen_tab_web_contents_->GetRenderViewHost()) {
128 auto web_prefs = render_view_host->GetWebkitPreferences(); 132 auto web_prefs = render_view_host->GetWebkitPreferences();
129 web_prefs.presentation_receiver = true; 133 web_prefs.presentation_receiver = true;
130 render_view_host->UpdateWebkitPreferences(web_prefs); 134 render_view_host->UpdateWebkitPreferences(web_prefs);
131 } 135 }
132 } 136 }
133 137
134 // Navigate to the initial URL. 138 // Navigate to the initial URL.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 377
374 // Schedule the timer to check again in a second. 378 // Schedule the timer to check again in a second.
375 capture_poll_timer_.Start( 379 capture_poll_timer_.Start(
376 FROM_HERE, 380 FROM_HERE,
377 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), 381 base::TimeDelta::FromSeconds(kPollIntervalInSeconds),
378 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, 382 base::Bind(&OffscreenTab::DieIfContentCaptureEnded,
379 base::Unretained(this))); 383 base::Unretained(this)));
380 } 384 }
381 385
382 } // namespace extensions 386 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/router/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698