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

Side by Side Diff: chrome/browser/ui/screen_capture_infobar_delegate.cc

Issue 12596011: Whitelist Google Hangouts origins to access Screen Capture API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_manager.cc » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/screen_capture_infobar_delegate.h" 5 #include "chrome/browser/ui/screen_capture_infobar_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/api/infobars/infobar_service.h" 9 #include "chrome/browser/api/infobars/infobar_service.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 13
14 namespace {
15
16 // This is a short-term solution to allow testing of the the Screen Capture API
17 // with Google Hangouts in M27.
18 // TODO(sergeyu): Remove this whitelist as soon as possible.
19 bool IsWhitelistedOrigin(const GURL& origin) {
20 return origin.spec() == "https://staging.talkgadget.google.com/" ||
jschuh 2013/03/15 14:24:50 Would it be reasonable to put this in an OFFICIAL_
Sergey Ulanov 2013/03/15 22:30:57 Done.
21 origin.spec() == "https://plus.google.com/";
22 }
23
24 } // namespace
25
14 // static 26 // static
15 void ScreenCaptureInfoBarDelegate::Create( 27 void ScreenCaptureInfoBarDelegate::Create(
16 content::WebContents* web_contents, 28 content::WebContents* web_contents,
17 const content::MediaStreamRequest& request, 29 const content::MediaStreamRequest& request,
18 const content::MediaResponseCallback& callback) { 30 const content::MediaResponseCallback& callback) {
19 bool screen_capture_enabled = CommandLine::ForCurrentProcess()->HasSwitch( 31 bool screen_capture_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
20 switches::kEnableUserMediaScreenCapturing); 32 switches::kEnableUserMediaScreenCapturing) ||
jschuh 2013/03/15 14:24:50 I thought we were going to require both the switch
33 IsWhitelistedOrigin(request.security_origin);
21 // Deny request automatically in the following cases: 34 // Deny request automatically in the following cases:
22 // 1. Screen capturing is not enabled via command line switch. 35 // 1. Screen capturing is not enabled via command line switch.
23 // 2. Audio capture was requested (it's not supported yet). 36 // 2. Audio capture was requested (it's not supported yet).
24 // 3. Request from a page that was not loaded from a secure origin. 37 // 3. Request from a page that was not loaded from a secure origin.
25 if (!screen_capture_enabled || 38 if (!screen_capture_enabled ||
26 request.audio_type != content::MEDIA_NO_SERVICE || 39 request.audio_type != content::MEDIA_NO_SERVICE ||
27 !request.security_origin.SchemeIsSecure()) { 40 !request.security_origin.SchemeIsSecure()) {
28 callback.Run(content::MediaStreamDevices()); 41 callback.Run(content::MediaStreamDevices());
29 return; 42 return;
30 } 43 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 106 }
94 107
95 bool ScreenCaptureInfoBarDelegate::Cancel() { 108 bool ScreenCaptureInfoBarDelegate::Cancel() {
96 Deny(); 109 Deny();
97 return true; 110 return true;
98 } 111 }
99 112
100 void ScreenCaptureInfoBarDelegate::Deny() { 113 void ScreenCaptureInfoBarDelegate::Deny() {
101 callback_.Run(content::MediaStreamDevices()); 114 callback_.Run(content::MediaStreamDevices());
102 } 115 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698