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

Side by Side Diff: content/renderer/media/media_permission_dispatcher.h

Issue 871663003: media: Add MediaPermission interface and MediaPermissionDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 11 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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/media_permission_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_H_
7
8 #include <map>
9
10 #include "base/threading/thread_checker.h"
11 #include "content/common/content_export.h"
12 #include "content/common/permission_service.mojom.h"
13 #include "content/public/renderer/render_frame_observer.h"
14 #include "media/base/media_permission.h"
15
16 namespace content {
17
18 // MediaPermission implementation in content. This class is not thread safe
19 // and should only be used on one thread.
20 class CONTENT_EXPORT MediaPermissionDispatcher : public media::MediaPermission,
21 public RenderFrameObserver {
22 public:
23 explicit MediaPermissionDispatcher(RenderFrame* render_frame);
24 ~MediaPermissionDispatcher() override;
25
26 // media::MediaPermission implementation.
27 void HasPermission(Type type,
28 const GURL& security_origin,
29 const PermissionStatusCB& permission_status_cb) override;
30 void RequestPermission(
31 Type type,
32 const GURL& security_origin,
33 const PermissionStatusCB& permission_status_cb) override;
34
35 private:
36 // Map of request IDs and pending PermissionStatusCBs.
37 typedef std::map<uint32_t, PermissionStatusCB> RequestMap;
38
39 // Callback for |permission_service_| calls.
40 void OnPermissionStatus(uint32_t request_id, PermissionStatus status);
41
42 uint32_t next_request_id_;
43 RequestMap requests_;
44 PermissionServicePtr permission_service_;
45
46 base::ThreadChecker thread_checker_;
47
48 DISALLOW_COPY_AND_ASSIGN(MediaPermissionDispatcher);
49 };
50
51 } // namespace content
52
53 #endif // CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/media_permission_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698