| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/permissions/Permissions.h" | 5 #include "modules/permissions/Permissions.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
| 8 #include "bindings/core/v8/Nullable.h" | 8 #include "bindings/core/v8/Nullable.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 UserGestureIndicator::processingUserGestureThreadSafe(), | 250 UserGestureIndicator::processingUserGestureThreadSafe(), |
| 251 convertToBaseCallback( | 251 convertToBaseCallback( |
| 252 WTF::bind(&Permissions::batchTaskComplete, wrapPersistent(this), | 252 WTF::bind(&Permissions::batchTaskComplete, wrapPersistent(this), |
| 253 wrapPersistent(resolver), | 253 wrapPersistent(resolver), |
| 254 WTF::passed(std::move(internalPermissionsCopy)), | 254 WTF::passed(std::move(internalPermissionsCopy)), |
| 255 WTF::passed(std::move(callerIndexToInternalIndex))))); | 255 WTF::passed(std::move(callerIndexToInternalIndex))))); |
| 256 return promise; | 256 return promise; |
| 257 } | 257 } |
| 258 | 258 |
| 259 PermissionService* Permissions::getService(ExecutionContext* executionContext) { | 259 PermissionService* Permissions::getService(ExecutionContext* executionContext) { |
| 260 if (!m_service && | 260 if (!m_service && connectToPermissionService(executionContext, |
| 261 connectToPermissionService(executionContext, mojo::GetProxy(&m_service))) | 261 mojo::MakeRequest(&m_service))) |
| 262 m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( | 262 m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( |
| 263 &Permissions::serviceConnectionError, wrapWeakPersistent(this)))); | 263 &Permissions::serviceConnectionError, wrapWeakPersistent(this)))); |
| 264 return m_service.get(); | 264 return m_service.get(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void Permissions::serviceConnectionError() { | 267 void Permissions::serviceConnectionError() { |
| 268 if (!Platform::current()) { | 268 if (!Platform::current()) { |
| 269 // TODO(rockot): Remove this hack once renderer shutdown sequence is fixed. | 269 // TODO(rockot): Remove this hack once renderer shutdown sequence is fixed. |
| 270 // Note that reaching this code indicates that the MessageLoop has already | 270 // Note that reaching this code indicates that the MessageLoop has already |
| 271 // been torn down, so it's impossible for any pending reply callbacks on | 271 // been torn down, so it's impossible for any pending reply callbacks on |
| (...skipping 29 matching lines...) Expand all Loading... |
| 301 result.reserveInitialCapacity(callerIndexToInternalIndex.size()); | 301 result.reserveInitialCapacity(callerIndexToInternalIndex.size()); |
| 302 for (int internalIndex : callerIndexToInternalIndex) { | 302 for (int internalIndex : callerIndexToInternalIndex) { |
| 303 result.append(PermissionStatus::createAndListen( | 303 result.append(PermissionStatus::createAndListen( |
| 304 resolver->getExecutionContext(), results[internalIndex], | 304 resolver->getExecutionContext(), results[internalIndex], |
| 305 descriptors[internalIndex]->Clone())); | 305 descriptors[internalIndex]->Clone())); |
| 306 } | 306 } |
| 307 resolver->resolve(result); | 307 resolver->resolve(result); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |