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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include "bindings/core/v8/Dictionary.h" | 9 #include "bindings/core/v8/Dictionary.h" |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 ExecutionContext* context = ExecutionContext::From(script_state); | 175 ExecutionContext* context = ExecutionContext::From(script_state); |
176 // Set the default mediation option if none is provided. | 176 // Set the default mediation option if none is provided. |
177 // If both 'unmediated' and 'mediation' are set log a warning if they are | 177 // If both 'unmediated' and 'mediation' are set log a warning if they are |
178 // contradicting. | 178 // contradicting. |
179 // Also sets 'mediation' appropriately when only 'unmediated' is set. | 179 // Also sets 'mediation' appropriately when only 'unmediated' is set. |
180 // TODO(http://crbug.com/715077): Remove this when 'unmediated' is removed. | 180 // TODO(http://crbug.com/715077): Remove this when 'unmediated' is removed. |
181 String mediation = "optional"; | 181 String mediation = "optional"; |
182 if (options.hasUnmediated() && !options.hasMediation()) { | 182 if (options.hasUnmediated() && !options.hasMediation()) { |
183 mediation = options.unmediated() ? "silent" : "optional"; | 183 mediation = options.unmediated() ? "silent" : "optional"; |
| 184 UseCounter::Count( |
| 185 context, |
| 186 UseCounter::kCredentialManagerCredentialRequestOptionsOnlyUnmediated); |
184 } else if (options.hasMediation()) { | 187 } else if (options.hasMediation()) { |
185 mediation = options.mediation(); | 188 mediation = options.mediation(); |
186 if (options.hasUnmediated() && | 189 if (options.hasUnmediated() && |
187 ((options.unmediated() && options.mediation() != "silent") || | 190 ((options.unmediated() && options.mediation() != "silent") || |
188 (!options.unmediated() && options.mediation() != "optional"))) { | 191 (!options.unmediated() && options.mediation() != "optional"))) { |
189 context->AddConsoleMessage(ConsoleMessage::Create( | 192 context->AddConsoleMessage(ConsoleMessage::Create( |
190 kJSMessageSource, kWarningMessageLevel, | 193 kJSMessageSource, kWarningMessageLevel, |
191 "mediation: '" + options.mediation() + "' overrides unmediated: " + | 194 "mediation: '" + options.mediation() + "' overrides unmediated: " + |
192 (options.unmediated() ? "true" : "false") + ".")); | 195 (options.unmediated() ? "true" : "false") + ".")); |
193 } | 196 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 ScriptPromise promise = resolver->Promise(); | 283 ScriptPromise promise = resolver->Promise(); |
281 if (!CheckBoilerplate(resolver)) | 284 if (!CheckBoilerplate(resolver)) |
282 return promise; | 285 return promise; |
283 | 286 |
284 CredentialManagerClient::From(ExecutionContext::From(script_state)) | 287 CredentialManagerClient::From(ExecutionContext::From(script_state)) |
285 ->DispatchRequireUserMediation(new NotificationCallbacks(resolver)); | 288 ->DispatchRequireUserMediation(new NotificationCallbacks(resolver)); |
286 return promise; | 289 return promise; |
287 } | 290 } |
288 | 291 |
289 } // namespace blink | 292 } // namespace blink |
OLD | NEW |