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

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

Issue 1095393004: Refactor: Make MediaCaptureDevicesDispatcher have pluggable handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tryjob error. Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_PERMISSION_BUBBLE_MEDIA_ACCESS_HANDLER_H_
6 #define CHROME_BROWSER_MEDIA_PERMISSION_BUBBLE_MEDIA_ACCESS_HANDLER_H_
7
8 #include <deque>
9 #include <map>
10
11 #include "chrome/browser/media/media_access_handler.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14
15 // MediaAccessHandler for permission bubble requests.
16 class PermissionBubbleMediaAccessHandler
17 : public MediaAccessHandler,
18 public content::NotificationObserver {
19 public:
20 PermissionBubbleMediaAccessHandler();
21 ~PermissionBubbleMediaAccessHandler() override;
22
23 // MediaAccessHandler implementation.
24 bool SupportsStreamType(const content::MediaStreamType type,
25 const extensions::Extension* extension) override;
26 bool CheckMediaAccessPermission(
27 content::WebContents* web_contents,
28 const GURL& security_origin,
29 content::MediaStreamType type,
30 const extensions::Extension* extension) override;
31 void HandleRequest(content::WebContents* web_contents,
32 const content::MediaStreamRequest& request,
33 const content::MediaResponseCallback& callback,
34 const extensions::Extension* extension) override;
35 void UpdateMediaRequestState(int render_process_id,
36 int render_frame_id,
37 int page_request_id,
38 content::MediaStreamType stream_type,
39 content::MediaRequestState state) override;
40
41 private:
42 struct PendingAccessRequest;
43 typedef std::deque<PendingAccessRequest> RequestsQueue;
44 typedef std::map<content::WebContents*, RequestsQueue> RequestsQueues;
45
46 void ProcessQueuedAccessRequest(content::WebContents* web_contents);
47 void OnAccessRequestResponse(content::WebContents* web_contents,
48 const content::MediaStreamDevices& devices,
49 content::MediaStreamRequestResult result,
50 scoped_ptr<content::MediaStreamUI> ui);
51
52 // content::NotificationObserver implementation.
53 void Observe(int type,
54 const content::NotificationSource& source,
55 const content::NotificationDetails& details) override;
56
57 RequestsQueues pending_requests_;
58 content::NotificationRegistrar notifications_registrar_;
59 };
60 #endif // CHROME_BROWSER_MEDIA_PERMISSION_BUBBLE_MEDIA_ACCESS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698