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 <string> | 9 #include <string> |
9 | 10 |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/content_settings/permission_queue_controller.h" | 12 #include "chrome/browser/content_settings/permission_queue_controller.h" |
12 | 13 |
13 class PermissionRequestID; | 14 class PermissionRequestID; |
14 class Profile; | 15 class Profile; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class RenderViewHost; | 18 class RenderViewHost; |
18 } | 19 } |
19 | 20 |
20 // Manages protected media identifier permissions flow, and delegates UI | 21 // Manages protected media identifier permissions flow, and delegates UI |
21 // handling via PermissionQueueController. | 22 // handling via PermissionQueueController. |
22 class ProtectedMediaIdentifierPermissionContext | 23 class ProtectedMediaIdentifierPermissionContext |
23 : public base::RefCountedThreadSafe< | 24 : public base::RefCountedThreadSafe< |
24 ProtectedMediaIdentifierPermissionContext> { | 25 ProtectedMediaIdentifierPermissionContext> { |
25 public: | 26 public: |
26 explicit ProtectedMediaIdentifierPermissionContext(Profile* profile); | 27 explicit ProtectedMediaIdentifierPermissionContext(Profile* profile); |
27 | 28 |
28 void RequestProtectedMediaIdentifierPermission( | 29 void RequestProtectedMediaIdentifierPermission( |
29 int render_process_id, | 30 int render_process_id, |
30 int render_view_id, | 31 int render_view_id, |
| 32 int bridge_id, |
| 33 int group_id, |
31 const GURL& requesting_frame, | 34 const GURL& requesting_frame, |
32 const base::Callback<void(bool)>& callback); | 35 const base::Callback<void(bool)>& callback); |
33 void CancelProtectedMediaIdentifierPermissionRequest( | 36 void CancelProtectedMediaIdentifierPermissionRequests( |
34 int render_process_id, | 37 int group_id); |
35 int render_view_id, | |
36 const GURL& requesting_frame); | |
37 | 38 |
38 // Called on the UI thread when the profile is about to be destroyed. | 39 // Called on the UI thread when the profile is about to be destroyed. |
39 void ShutdownOnUIThread(); | 40 void ShutdownOnUIThread(); |
40 | 41 |
41 private: | 42 private: |
42 friend class base::RefCountedThreadSafe< | 43 friend class base::RefCountedThreadSafe< |
43 ProtectedMediaIdentifierPermissionContext>; | 44 ProtectedMediaIdentifierPermissionContext>; |
44 ~ProtectedMediaIdentifierPermissionContext(); | 45 ~ProtectedMediaIdentifierPermissionContext(); |
45 | 46 |
46 Profile* profile() const { return profile_; } | 47 Profile* profile() const { return profile_; } |
(...skipping 27 matching lines...) Expand all Loading... |
74 void PermissionDecided(const PermissionRequestID& id, | 75 void PermissionDecided(const PermissionRequestID& id, |
75 const GURL& requesting_frame, | 76 const GURL& requesting_frame, |
76 const GURL& embedder, | 77 const GURL& embedder, |
77 const base::Callback<void(bool)>& callback, | 78 const base::Callback<void(bool)>& callback, |
78 bool allowed); | 79 bool allowed); |
79 | 80 |
80 // Create an PermissionQueueController. overridden in derived classes to | 81 // Create an PermissionQueueController. overridden in derived classes to |
81 // provide additional UI flow. Called on the UI thread. | 82 // provide additional UI flow. Called on the UI thread. |
82 PermissionQueueController* CreateQueueController(); | 83 PermissionQueueController* CreateQueueController(); |
83 | 84 |
84 // Removes any pending InfoBar request. | 85 // Removes pending InfoBar requests that match |group_id|. |
85 void CancelPendingInfoBarRequest(const PermissionRequestID& id); | 86 void CancelPendingInfobarRequests(int group_id); |
86 | 87 |
87 // These must only be accessed from the UI thread. | 88 // These must only be accessed from the UI thread. |
88 Profile* const profile_; | 89 Profile* const profile_; |
89 bool shutting_down_; | 90 bool shutting_down_; |
90 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 91 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
91 | 92 |
92 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); | 93 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); |
93 }; | 94 }; |
94 | 95 |
95 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ | 96 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ |
OLD | NEW |