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

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

Issue 186133005: Adds extension name to the screencast notification bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_STREAMS_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_STREAMS_REGISTRY_H_
6 #define CHROME_BROWSER_MEDIA_DESKTOP_STREAMS_REGISTRY_H_ 6 #define CHROME_BROWSER_MEDIA_DESKTOP_STREAMS_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/media/desktop_media_list.h" 11 #include "chrome/browser/media/desktop_media_list.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 // DesktopStreamsRegistry is used to store accepted desktop media streams for 14 // DesktopStreamsRegistry is used to store accepted desktop media streams for
15 // Desktop Capture API. Single instance of this class is created per browser in 15 // Desktop Capture API. Single instance of this class is created per browser in
16 // MediaCaptureDevicesDispatcher. 16 // MediaCaptureDevicesDispatcher.
17 class DesktopStreamsRegistry { 17 class DesktopStreamsRegistry {
18 public: 18 public:
19 DesktopStreamsRegistry(); 19 DesktopStreamsRegistry();
20 ~DesktopStreamsRegistry(); 20 ~DesktopStreamsRegistry();
21 21
22 // Adds new stream to the registry. Called by the implementation of 22 // Adds new stream to the registry. Called by the implementation of
23 // desktopCapture.chooseDesktopMedia() API after user has approved access to 23 // desktopCapture.chooseDesktopMedia() API after user has approved access to
24 // |source| for the |origin|. Returns identifier of the new stream. 24 // |source| for the |origin|. Returns identifier of the new stream.
25 std::string RegisterStream(int render_process_id, 25 std::string RegisterStream(int render_process_id,
26 int render_view_id, 26 int render_view_id,
27 const GURL& origin, 27 const GURL& origin,
28 const content::DesktopMediaID& source); 28 const content::DesktopMediaID& source,
29 const std::string& extension_name);
29 30
30 // Validates stream identifier specified in getUserMedia(). Returns null 31 // Validates stream identifier specified in getUserMedia(). Returns null
31 // DesktopMediaID if the specified |id| is invalid, i.e. wasn't generated 32 // DesktopMediaID if the specified |id| is invalid, i.e. wasn't generated
32 // using RegisterStream() or if it was generated for a different origin. 33 // using RegisterStream() or if it was generated for a different origin.
33 // Otherwise returns ID of the source and removes it from the registry. 34 // Otherwise returns ID of the source and removes it from the registry.
34 content::DesktopMediaID RequestMediaForStreamId(const std::string& id, 35 content::DesktopMediaID RequestMediaForStreamId(const std::string& id,
35 int render_process_id, 36 int render_process_id,
36 int render_view_id, 37 int render_view_id,
37 const GURL& origin); 38 const GURL& origin,
39 std::string* extension_name);
38 40
39 private: 41 private:
40 // Type used to store list of accepted desktop media streams. 42 // Type used to store list of accepted desktop media streams.
41 struct ApprovedDesktopMediaStream { 43 struct ApprovedDesktopMediaStream {
44 ApprovedDesktopMediaStream();
45
42 int render_process_id; 46 int render_process_id;
43 int render_view_id; 47 int render_view_id;
44 GURL origin; 48 GURL origin;
45 content::DesktopMediaID source; 49 content::DesktopMediaID source;
50 std::string extension_name;
46 }; 51 };
47 typedef std::map<std::string, ApprovedDesktopMediaStream> StreamsMap; 52 typedef std::map<std::string, ApprovedDesktopMediaStream> StreamsMap;
48 53
49 // Helper function that removes an expired stream from the registry. 54 // Helper function that removes an expired stream from the registry.
50 void CleanupStream(const std::string& id); 55 void CleanupStream(const std::string& id);
51 56
52 StreamsMap approved_streams_; 57 StreamsMap approved_streams_;
53 58
54 DISALLOW_COPY_AND_ASSIGN(DesktopStreamsRegistry); 59 DISALLOW_COPY_AND_ASSIGN(DesktopStreamsRegistry);
55 }; 60 };
56 61
57 #endif // CHROME_BROWSER_MEDIA_DESKTOP_STREAMS_REGISTRY_H_ 62 #endif // CHROME_BROWSER_MEDIA_DESKTOP_STREAMS_REGISTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/desktop_media_picker.h ('k') | chrome/browser/media/desktop_streams_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698