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