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

Side by Side Diff: media/mojo/services/mojo_media_permission.h

Issue 1838903007: media: Add mojo MediaPermission service Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2016 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 MEDIA_MOJO_SERVICES_MOJO_MEDIA_PERMISSION_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_PERMISSION_H_
7
8 #include "base/macros.h"
9 #include "media/base/media_permission.h"
10 #include "media/mojo/interfaces/media_permission.mojom.h"
11 #include "url/gurl.h"
12
13 namespace mojo {
14 namespace shell {
15 namespace mojom {
16 class InterfaceProvider;
17 }
18 }
19 }
20
21 namespace media {
22
23 // A MediaPermission that proxies to a interfaces::MediaPermissionPtr.
24 // The connection is lazily initialized.
25 class MojoMediaPermission : public MediaPermission {
26 public:
27 explicit MojoMediaPermission(
28 mojo::shell::mojom::InterfaceProvider* interface_provider);
29 ~MojoMediaPermission() final;
30
31 // MediaPermission implementation:
32 void HasPermission(Type type,
33 const GURL& security_origin,
34 const PermissionStatusCB& permission_status_cb) final;
35
36 void RequestPermission(Type type,
37 const GURL& security_origin,
38 const PermissionStatusCB& permission_status_cb) final;
39
40 private:
41 interfaces::MediaPermission* GetMediaPermission();
42
43 // Callback for HasPermission() and RequestPermission();
44 void OnPermissionStatus(const base::Callback<void(bool)>& callback,
45 bool success);
46
47 mojo::shell::mojom::InterfaceProvider* interface_provider_;
48
49 // Lazily initialized.
50 interfaces::MediaPermissionPtr media_permission_ptr_;
51
52 DISALLOW_COPY_AND_ASSIGN(MojoMediaPermission);
53 };
54
55 } // namespace media
56
57 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_PERMISSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698