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

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: resolve code review comments from Derek 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
miu 2017/02/02 21:17:34 Please include 513859 on the BUG= line in this cha
zhaobin 2017/02/03 03:22:54 Done.
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 // Register the offscreen tab as the receiver of the offscreen presentation.
miu 2017/02/02 21:17:34 I think a more-accurate comment here would be some
zhaobin 2017/02/03 03:22:54 Done.
125 media_router::ReceiverPresentationServiceDelegateImpl::CreateForWebContents(
miu 2017/02/02 21:17:35 I dove into the call points from here, and I wonde
zhaobin 2017/02/03 03:22:54 reconnect() for 1-ua has not been implemented yet.
126 offscreen_tab_web_contents_.get(), optional_presentation_id);
125 127
126 if (auto* render_view_host = 128 if (auto* render_view_host =
127 offscreen_tab_web_contents_->GetRenderViewHost()) { 129 offscreen_tab_web_contents_->GetRenderViewHost()) {
128 auto web_prefs = render_view_host->GetWebkitPreferences(); 130 auto web_prefs = render_view_host->GetWebkitPreferences();
129 web_prefs.presentation_receiver = true; 131 web_prefs.presentation_receiver = true;
130 render_view_host->UpdateWebkitPreferences(web_prefs); 132 render_view_host->UpdateWebkitPreferences(web_prefs);
131 } 133 }
132 } 134 }
133 135
134 // Navigate to the initial URL. 136 // Navigate to the initial URL.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 375
374 // Schedule the timer to check again in a second. 376 // Schedule the timer to check again in a second.
375 capture_poll_timer_.Start( 377 capture_poll_timer_.Start(
376 FROM_HERE, 378 FROM_HERE,
377 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), 379 base::TimeDelta::FromSeconds(kPollIntervalInSeconds),
378 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, 380 base::Bind(&OffscreenTab::DieIfContentCaptureEnded,
379 base::Unretained(this))); 381 base::Unretained(this)));
380 } 382 }
381 383
382 } // namespace extensions 384 } // 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