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

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

Issue 2555743008: [Presentation API] set presentation_receiver flag in offscreen tab (Closed)
Patch Set: Created 4 years 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 | no next file » | 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/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/web_contents_sizer.h" 14 #include "chrome/browser/ui/web_contents_sizer.h"
15 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/render_widget_host_view.h" 16 #include "content/public/browser/render_widget_host_view.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/web_preferences.h"
17 #include "extensions/browser/extension_host.h" 19 #include "extensions/browser/extension_host.h"
18 #include "extensions/browser/process_manager.h" 20 #include "extensions/browser/process_manager.h"
19 21
20 using content::WebContents; 22 using content::WebContents;
21 23
22 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::OffscreenTabsOwner); 24 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::OffscreenTabsOwner);
23 25
24 namespace { 26 namespace {
25 27
26 // Upper limit on the number of simultaneous off-screen tabs per extension 28 // Upper limit on the number of simultaneous off-screen tabs per extension
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 115
114 // Mute audio output. When tab capture starts, the audio will be 116 // Mute audio output. When tab capture starts, the audio will be
115 // automatically unmuted, but will be captured into the MediaStream. 117 // automatically unmuted, but will be captured into the MediaStream.
116 offscreen_tab_web_contents_->SetAudioMuted(true); 118 offscreen_tab_web_contents_->SetAudioMuted(true);
117 119
118 // TODO(imcheng): If |optional_presentation_id| is not empty, register it with 120 // TODO(imcheng): If |optional_presentation_id| is not empty, register it with
119 // the PresentationRouter. http://crbug.com/513859 121 // the PresentationRouter. http://crbug.com/513859
120 if (!optional_presentation_id.empty()) { 122 if (!optional_presentation_id.empty()) {
121 NOTIMPLEMENTED() 123 NOTIMPLEMENTED()
122 << "Register with PresentationRouter, id=" << optional_presentation_id; 124 << "Register with PresentationRouter, id=" << optional_presentation_id;
125
126 if (auto* render_view_host =
127 offscreen_tab_web_contents_->GetRenderViewHost()) {
128 auto web_prefs = render_view_host->GetWebkitPreferences();
129 web_prefs.presentation_receiver = true;
130 render_view_host->UpdateWebkitPreferences(web_prefs);
131 }
123 } 132 }
124 133
125 // Navigate to the initial URL. 134 // Navigate to the initial URL.
126 content::NavigationController::LoadURLParams load_params(start_url_); 135 content::NavigationController::LoadURLParams load_params(start_url_);
127 load_params.should_replace_current_entry = true; 136 load_params.should_replace_current_entry = true;
128 load_params.should_clear_history_list = true; 137 load_params.should_clear_history_list = true;
129 offscreen_tab_web_contents_->GetController().LoadURLWithParams(load_params); 138 offscreen_tab_web_contents_->GetController().LoadURLWithParams(load_params);
130 139
131 start_time_ = base::TimeTicks::Now(); 140 start_time_ = base::TimeTicks::Now();
132 DieIfContentCaptureEnded(); 141 DieIfContentCaptureEnded();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 373
365 // Schedule the timer to check again in a second. 374 // Schedule the timer to check again in a second.
366 capture_poll_timer_.Start( 375 capture_poll_timer_.Start(
367 FROM_HERE, 376 FROM_HERE,
368 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), 377 base::TimeDelta::FromSeconds(kPollIntervalInSeconds),
369 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, 378 base::Bind(&OffscreenTab::DieIfContentCaptureEnded,
370 base::Unretained(this))); 379 base::Unretained(this)));
371 } 380 }
372 381
373 } // namespace extensions 382 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698