| 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 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 base::AutoLock lock(permissions_lock_); | 129 base::AutoLock lock(permissions_lock_); |
| 130 | 130 |
| 131 auto it = permissions_.find( | 131 auto it = permissions_.find( |
| 132 PermissionDescription(permission, requesting_origin, embedding_origin)); | 132 PermissionDescription(permission, requesting_origin, embedding_origin)); |
| 133 if (it == permissions_.end()) | 133 if (it == permissions_.end()) |
| 134 return blink::mojom::PermissionStatus::DENIED; | 134 return blink::mojom::PermissionStatus::DENIED; |
| 135 return it->second; | 135 return it->second; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void LayoutTestPermissionManager::RegisterPermissionUsage( | |
| 139 PermissionType permission, | |
| 140 const GURL& requesting_origin, | |
| 141 const GURL& embedding_origin) { | |
| 142 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 143 } | |
| 144 | |
| 145 int LayoutTestPermissionManager::SubscribePermissionStatusChange( | 138 int LayoutTestPermissionManager::SubscribePermissionStatusChange( |
| 146 PermissionType permission, | 139 PermissionType permission, |
| 147 const GURL& requesting_origin, | 140 const GURL& requesting_origin, |
| 148 const GURL& embedding_origin, | 141 const GURL& embedding_origin, |
| 149 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) { | 142 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) { |
| 150 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 151 | 144 |
| 152 auto subscription = base::MakeUnique<Subscription>(); | 145 auto subscription = base::MakeUnique<Subscription>(); |
| 153 subscription->permission = | 146 subscription->permission = |
| 154 PermissionDescription(permission, requesting_origin, embedding_origin); | 147 PermissionDescription(permission, requesting_origin, embedding_origin); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // Add the callback to |callbacks| which will be run after the loop to | 211 // Add the callback to |callbacks| which will be run after the loop to |
| 219 // prevent re-entrance issues. | 212 // prevent re-entrance issues. |
| 220 callbacks.push_back(base::Bind(subscription->callback, status)); | 213 callbacks.push_back(base::Bind(subscription->callback, status)); |
| 221 } | 214 } |
| 222 | 215 |
| 223 for (const auto& callback : callbacks) | 216 for (const auto& callback : callbacks) |
| 224 callback.Run(); | 217 callback.Run(); |
| 225 } | 218 } |
| 226 | 219 |
| 227 } // namespace content | 220 } // namespace content |
| OLD | NEW |