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

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

Issue 1464183002: media: Simplify MediaPermissionDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 4 years, 10 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 // A helper class to forward the calls to MediaPermissionDispatcherImpl on UI
6 // thread and have the permission status callback on the caller's original
7 // non-UI thread.
8
9 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_PROXY_H_
10 #define CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_PROXY_H_
11
12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/single_thread_task_runner.h"
15 #include "content/common/content_export.h"
16 #include "content/renderer/media/media_permission_dispatcher.h"
17 #include "media/base/media_permission.h"
18
19 namespace content {
20
21 class CONTENT_EXPORT MediaPermissionDispatcherProxy
22 : public MediaPermissionDispatcher {
23 public:
24 // |ui_task_runner| must be the UI thread. It will be used to call into the
25 // |media_permission| which is the MediaPermissionDispatcherImpl.
26 MediaPermissionDispatcherProxy(
27 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
28 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
29 base::WeakPtr<MediaPermissionDispatcher> media_permission);
30
31 ~MediaPermissionDispatcherProxy() override;
32
33 // MediaPermission implementation.
34 void HasPermission(Type type,
35 const GURL& security_origin,
36 const PermissionStatusCB& permission_status_cb) override;
37
38 void RequestPermission(
39 Type type,
40 const GURL& security_origin,
41 const PermissionStatusCB& permission_status_cb) override;
42
43 private:
44 class Core;
45
46 void ReportResult(bool result);
47
48 scoped_ptr<Core> core_;
49
50 base::WeakPtrFactory<MediaPermissionDispatcherProxy> weak_ptr_factory_;
51
52 DISALLOW_COPY_AND_ASSIGN(MediaPermissionDispatcherProxy);
53 };
54
55 } // namespace content
56
57 #endif // CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698