OLD | NEW |
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_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ |
6 #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // handling via PermissionQueueController. | 24 // handling via PermissionQueueController. |
25 class ProtectedMediaIdentifierPermissionContext | 25 class ProtectedMediaIdentifierPermissionContext |
26 : public base::RefCountedThreadSafe< | 26 : public base::RefCountedThreadSafe< |
27 ProtectedMediaIdentifierPermissionContext> { | 27 ProtectedMediaIdentifierPermissionContext> { |
28 public: | 28 public: |
29 explicit ProtectedMediaIdentifierPermissionContext(Profile* profile); | 29 explicit ProtectedMediaIdentifierPermissionContext(Profile* profile); |
30 | 30 |
31 void RequestProtectedMediaIdentifierPermission( | 31 void RequestProtectedMediaIdentifierPermission( |
32 content::WebContents* web_contents, | 32 content::WebContents* web_contents, |
33 const GURL& origin, | 33 const GURL& origin, |
34 base::Callback<void(bool)> result_callback, | 34 base::Callback<void(bool)> result_callback); |
35 base::Closure* cancel_callback); | 35 |
| 36 void CancelProtectedMediaIdentifierPermissionRequests(int render_process_id, |
| 37 int render_view_id, |
| 38 const GURL& origin); |
36 | 39 |
37 // Called on the UI thread when the profile is about to be destroyed. | 40 // Called on the UI thread when the profile is about to be destroyed. |
38 void ShutdownOnUIThread(); | 41 void ShutdownOnUIThread(); |
39 | 42 |
40 private: | 43 private: |
41 friend class base::RefCountedThreadSafe< | 44 friend class base::RefCountedThreadSafe< |
42 ProtectedMediaIdentifierPermissionContext>; | 45 ProtectedMediaIdentifierPermissionContext>; |
43 ~ProtectedMediaIdentifierPermissionContext(); | 46 ~ProtectedMediaIdentifierPermissionContext(); |
44 | 47 |
45 Profile* profile() const { return profile_; } | 48 Profile* profile() const { return profile_; } |
46 | 49 |
47 // Return an instance of the infobar queue controller, creating it | 50 // Return an instance of the infobar queue controller, creating it |
48 // if necessary. | 51 // if necessary. |
49 PermissionQueueController* QueueController(); | 52 PermissionQueueController* QueueController(); |
50 | 53 |
51 void CancelProtectedMediaIdentifierPermissionRequests( | |
52 int render_process_id, | |
53 int render_view_id, | |
54 const GURL& origin); | |
55 | |
56 // Notifies whether or not the corresponding bridge is allowed to use | 54 // Notifies whether or not the corresponding bridge is allowed to use |
57 // protected media identifier via | 55 // protected media identifier via |
58 // SetProtectedMediaIdentifierPermissionResponse(). Called on the UI thread. | 56 // SetProtectedMediaIdentifierPermissionResponse(). Called on the UI thread. |
59 void NotifyPermissionSet(const PermissionRequestID& id, | 57 void NotifyPermissionSet(const PermissionRequestID& id, |
60 const GURL& origin, | 58 const GURL& origin, |
61 const base::Callback<void(bool)>& callback, | 59 const base::Callback<void(bool)>& callback, |
62 bool allowed); | 60 bool allowed); |
63 | 61 |
64 // Decide whether the protected media identifier permission should be granted. | 62 // Decide whether the protected media identifier permission should be granted. |
65 // Calls PermissionDecided if permission can be decided non-interactively, | 63 // Calls PermissionDecided if permission can be decided non-interactively, |
(...skipping 27 matching lines...) Expand all Loading... |
93 | 91 |
94 // These must only be accessed from the UI thread. | 92 // These must only be accessed from the UI thread. |
95 Profile* const profile_; | 93 Profile* const profile_; |
96 bool shutting_down_; | 94 bool shutting_down_; |
97 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 95 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
98 | 96 |
99 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); | 97 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); |
100 }; | 98 }; |
101 | 99 |
102 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ | 100 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ |
OLD | NEW |