| 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/credentialmanager/CredentialsContainer.h" | 5 #include "modules/credentialmanager/CredentialsContainer.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 ScriptPromise CredentialsContainer::get( | 160 ScriptPromise CredentialsContainer::get( |
| 161 ScriptState* scriptState, | 161 ScriptState* scriptState, |
| 162 const CredentialRequestOptions& options) { | 162 const CredentialRequestOptions& options) { |
| 163 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 163 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 164 ScriptPromise promise = resolver->promise(); | 164 ScriptPromise promise = resolver->promise(); |
| 165 if (!checkBoilerplate(resolver)) | 165 if (!checkBoilerplate(resolver)) |
| 166 return promise; | 166 return promise; |
| 167 | 167 |
| 168 Vector<KURL> providers; | 168 Vector<KURL> providers; |
| 169 if (options.hasFederated() && options.federated().hasProviders()) { | 169 if (options.hasFederated() && options.federated().hasProviders()) { |
| 170 // TODO(mkwst): CredentialRequestOptions::federated() needs to return a refe
rence, not a value. | 170 // TODO(mkwst): CredentialRequestOptions::federated() needs to return a |
| 171 // Because it returns a temporary value now, a for loop that directly refere
nces the value | 171 // reference, not a value. Because it returns a temporary value now, a for |
| 172 // generates code that holds a reference to a value that no longer exists by
the time the loop | 172 // loop that directly references the value generates code that holds a |
| 173 // starts looping. In order to avoid this crazyness for the moment, we're ma
king a copy of the | 173 // reference to a value that no longer exists by the time the loop starts |
| 174 // vector. https://crbug.com/587088 | 174 // looping. In order to avoid this crazyness for the moment, we're making a |
| 175 // copy of the vector. https://crbug.com/587088 |
| 175 const Vector<String> providerStrings = options.federated().providers(); | 176 const Vector<String> providerStrings = options.federated().providers(); |
| 176 for (const auto& string : providerStrings) { | 177 for (const auto& string : providerStrings) { |
| 177 KURL url = KURL(KURL(), string); | 178 KURL url = KURL(KURL(), string); |
| 178 if (url.isValid()) | 179 if (url.isValid()) |
| 179 providers.append(url); | 180 providers.append(url); |
| 180 } | 181 } |
| 181 } | 182 } |
| 182 | 183 |
| 183 UseCounter::count(scriptState->getExecutionContext(), | 184 UseCounter::count(scriptState->getExecutionContext(), |
| 184 options.unmediated() | 185 options.unmediated() |
| (...skipping 26 matching lines...) Expand all Loading... |
| 211 ScriptPromise promise = resolver->promise(); | 212 ScriptPromise promise = resolver->promise(); |
| 212 if (!checkBoilerplate(resolver)) | 213 if (!checkBoilerplate(resolver)) |
| 213 return promise; | 214 return promise; |
| 214 | 215 |
| 215 CredentialManagerClient::from(scriptState->getExecutionContext()) | 216 CredentialManagerClient::from(scriptState->getExecutionContext()) |
| 216 ->dispatchRequireUserMediation(new NotificationCallbacks(resolver)); | 217 ->dispatchRequireUserMediation(new NotificationCallbacks(resolver)); |
| 217 return promise; | 218 return promise; |
| 218 } | 219 } |
| 219 | 220 |
| 220 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |