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

Side by Side Diff: chrome/browser/media/desktop_streams_registry.cc

Issue 1503563004: Desktop chrome tab capture-chooseDesktopMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/media/desktop_streams_registry.h" 5 #include "chrome/browser/media/desktop_streams_registry.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 21 matching lines...) Expand all
32 32
33 std::string DesktopStreamsRegistry::RegisterStream( 33 std::string DesktopStreamsRegistry::RegisterStream(
34 int render_process_id, 34 int render_process_id,
35 int render_frame_id, 35 int render_frame_id,
36 const GURL& origin, 36 const GURL& origin,
37 const content::DesktopMediaID& source, 37 const content::DesktopMediaID& source,
38 const std::string& extension_name) { 38 const std::string& extension_name) {
39 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 39 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
40 40
41 std::string id = GenerateRandomStreamId(); 41 std::string id = GenerateRandomStreamId();
42
43 // Give the ability of identify tab type from id.
44 if (source.type == content::DesktopMediaID::TYPE_TAB)
45 id = source.ToString();
miu 2015/12/08 01:54:38 This is a security violation. If you need this in
GeorgeZ 2015/12/09 19:36:37 I will remove this one. I remembered this change i
46
42 DCHECK(approved_streams_.find(id) == approved_streams_.end()); 47 DCHECK(approved_streams_.find(id) == approved_streams_.end());
43 ApprovedDesktopMediaStream& stream = approved_streams_[id]; 48 ApprovedDesktopMediaStream& stream = approved_streams_[id];
44 stream.render_process_id = render_process_id; 49 stream.render_process_id = render_process_id;
45 stream.render_frame_id = render_frame_id; 50 stream.render_frame_id = render_frame_id;
46 stream.origin = origin; 51 stream.origin = origin;
47 stream.source = source; 52 stream.source = source;
48 stream.extension_name = extension_name; 53 stream.extension_name = extension_name;
49 54
50 content::BrowserThread::PostDelayedTask( 55 content::BrowserThread::PostDelayedTask(
51 content::BrowserThread::UI, FROM_HERE, 56 content::BrowserThread::UI, FROM_HERE,
(...skipping 29 matching lines...) Expand all
81 return result; 86 return result;
82 } 87 }
83 88
84 void DesktopStreamsRegistry::CleanupStream(const std::string& id) { 89 void DesktopStreamsRegistry::CleanupStream(const std::string& id) {
85 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 90 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
86 approved_streams_.erase(id); 91 approved_streams_.erase(id);
87 } 92 }
88 93
89 DesktopStreamsRegistry::ApprovedDesktopMediaStream::ApprovedDesktopMediaStream() 94 DesktopStreamsRegistry::ApprovedDesktopMediaStream::ApprovedDesktopMediaStream()
90 : render_process_id(-1), render_frame_id(-1) {} 95 : render_process_id(-1), render_frame_id(-1) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698