| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "content/shell/browser/layout_test/layout_test_permission_manager.h" | 5 #include "content/shell/browser/layout_test/layout_test_permission_manager.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 LayoutTestPermissionManager::LayoutTestPermissionManager() | 57 LayoutTestPermissionManager::LayoutTestPermissionManager() |
| 58 : PermissionManager() { | 58 : PermissionManager() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 LayoutTestPermissionManager::~LayoutTestPermissionManager() { | 61 LayoutTestPermissionManager::~LayoutTestPermissionManager() { |
| 62 } | 62 } |
| 63 | 63 |
| 64 void LayoutTestPermissionManager::RequestPermission( | 64 void LayoutTestPermissionManager::RequestPermission( |
| 65 PermissionType permission, | 65 PermissionType permission, |
| 66 WebContents* web_contents, | 66 RenderFrameHost* render_frame_host, |
| 67 int request_id, | 67 int request_id, |
| 68 const GURL& requesting_origin, | 68 const GURL& requesting_origin, |
| 69 bool user_gesture, | 69 bool user_gesture, |
| 70 const base::Callback<void(PermissionStatus)>& callback) { | 70 const base::Callback<void(PermissionStatus)>& callback) { |
| 71 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 71 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 72 | 72 |
| 73 callback.Run(GetPermissionStatus( | 73 callback.Run(GetPermissionStatus( |
| 74 permission, requesting_origin, | 74 permission, requesting_origin, |
| 75 web_contents->GetLastCommittedURL().GetOrigin())); | 75 WebContents::FromRenderFrameHost(render_frame_host) |
| 76 ->GetLastCommittedURL().GetOrigin())); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void LayoutTestPermissionManager::CancelPermissionRequest( | 79 void LayoutTestPermissionManager::CancelPermissionRequest( |
| 79 PermissionType permission, | 80 PermissionType permission, |
| 80 WebContents* web_contents, | 81 RenderFrameHost* render_frame_host, |
| 81 int request_id, | 82 int request_id, |
| 82 const GURL& requesting_origin) { | 83 const GURL& requesting_origin) { |
| 83 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 84 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void LayoutTestPermissionManager::ResetPermission( | 87 void LayoutTestPermissionManager::ResetPermission( |
| 87 PermissionType permission, | 88 PermissionType permission, |
| 88 const GURL& requesting_origin, | 89 const GURL& requesting_origin, |
| 89 const GURL& embedding_origin) { | 90 const GURL& embedding_origin) { |
| 90 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 91 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Add the callback to |callbacks| which will be run after the loop to | 196 // Add the callback to |callbacks| which will be run after the loop to |
| 196 // prevent re-entrance issues. | 197 // prevent re-entrance issues. |
| 197 callbacks.push_back(base::Bind(subscription->callback, status)); | 198 callbacks.push_back(base::Bind(subscription->callback, status)); |
| 198 } | 199 } |
| 199 | 200 |
| 200 for (const auto& callback : callbacks) | 201 for (const auto& callback : callbacks) |
| 201 callback.Run(); | 202 callback.Run(); |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace content | 205 } // namespace content |
| OLD | NEW |