| 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 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 5 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // ProtectedMediaIdentifierPermissionContext may be destroyed on either | 41 // ProtectedMediaIdentifierPermissionContext may be destroyed on either |
| 42 // the UI thread or the IO thread, but the PermissionQueueController must have | 42 // the UI thread or the IO thread, but the PermissionQueueController must have |
| 43 // been destroyed on the UI thread. | 43 // been destroyed on the UI thread. |
| 44 DCHECK(!permission_queue_controller_.get()); | 44 DCHECK(!permission_queue_controller_.get()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ProtectedMediaIdentifierPermissionContext:: | 47 void ProtectedMediaIdentifierPermissionContext:: |
| 48 RequestProtectedMediaIdentifierPermission( | 48 RequestProtectedMediaIdentifierPermission( |
| 49 content::WebContents* web_contents, | 49 content::WebContents* web_contents, |
| 50 const GURL& origin, | 50 const GURL& origin, |
| 51 base::Callback<void(bool)> result_callback, | 51 base::Callback<void(bool)> result_callback) { |
| 52 base::Closure* cancel_callback) { | |
| 53 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 52 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 54 if (shutting_down_) | 53 if (shutting_down_) |
| 55 return; | 54 return; |
| 56 | 55 |
| 57 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); | 56 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
| 58 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); | 57 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 59 if (cancel_callback) { | |
| 60 *cancel_callback = base::Bind( | |
| 61 &ProtectedMediaIdentifierPermissionContext:: | |
| 62 CancelProtectedMediaIdentifierPermissionRequests, | |
| 63 this, render_process_id, render_view_id, origin); | |
| 64 } | |
| 65 | 58 |
| 66 const PermissionRequestID id( | 59 const PermissionRequestID id( |
| 67 render_process_id, render_view_id, 0, origin); | 60 render_process_id, render_view_id, 0, origin); |
| 68 | 61 |
| 69 #if defined(ENABLE_EXTENSIONS) | 62 #if defined(ENABLE_EXTENSIONS) |
| 70 if (extensions::GetViewType(web_contents) != | 63 if (extensions::GetViewType(web_contents) != |
| 71 extensions::VIEW_TYPE_TAB_CONTENTS) { | 64 extensions::VIEW_TYPE_TAB_CONTENTS) { |
| 72 // The tab may have gone away, or the request may not be from a tab at all. | 65 // The tab may have gone away, or the request may not be from a tab at all. |
| 73 LOG(WARNING) | 66 LOG(WARNING) |
| 74 << "Attempt to use protected media identifier in tabless renderer: " | 67 << "Attempt to use protected media identifier in tabless renderer: " |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 origin)); | 209 origin)); |
| 217 return; | 210 return; |
| 218 } | 211 } |
| 219 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 212 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 220 if (shutting_down_) | 213 if (shutting_down_) |
| 221 return; | 214 return; |
| 222 QueueController()->CancelInfoBarRequest( | 215 QueueController()->CancelInfoBarRequest( |
| 223 PermissionRequestID(render_process_id, render_view_id, 0, | 216 PermissionRequestID(render_process_id, render_view_id, 0, |
| 224 origin)); | 217 origin)); |
| 225 } | 218 } |
| OLD | NEW |