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 "chrome/browser/extensions/api/platform_keys/platform_keys_api.h" | 5 #include "chrome/browser/extensions/api/platform_keys/platform_keys_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" | 15 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" |
16 #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" | 16 #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" |
17 #include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h" | 17 #include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h" |
18 #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h" | 18 #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Ensure that this function is called in a context that allows opening | 222 // Ensure that this function is called in a context that allows opening |
223 // dialogs. | 223 // dialogs. |
224 if (!web_contents || | 224 if (!web_contents || |
225 !web_modal::WebContentsModalDialogManager::FromWebContents( | 225 !web_modal::WebContentsModalDialogManager::FromWebContents( |
226 web_contents)) { | 226 web_contents)) { |
227 return RespondNow(Error(kErrorInteractiveCallFromBackground)); | 227 return RespondNow(Error(kErrorInteractiveCallFromBackground)); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 service->SelectClientCertificates( | 231 service->SelectClientCertificates( |
232 request, client_certs.Pass(), params->details.interactive, extension_id(), | 232 request, std::move(client_certs), params->details.interactive, |
| 233 extension_id(), |
233 base::Bind(&PlatformKeysInternalSelectClientCertificatesFunction:: | 234 base::Bind(&PlatformKeysInternalSelectClientCertificatesFunction:: |
234 OnSelectedCertificates, | 235 OnSelectedCertificates, |
235 this), | 236 this), |
236 web_contents); | 237 web_contents); |
237 return RespondLater(); | 238 return RespondLater(); |
238 } | 239 } |
239 | 240 |
240 void PlatformKeysInternalSelectClientCertificatesFunction:: | 241 void PlatformKeysInternalSelectClientCertificatesFunction:: |
241 OnSelectedCertificates(scoped_ptr<net::CertificateList> matches, | 242 OnSelectedCertificates(scoped_ptr<net::CertificateList> matches, |
242 const std::string& error_message) { | 243 const std::string& error_message) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 ExtensionFunction::ResponseAction | 347 ExtensionFunction::ResponseAction |
347 PlatformKeysVerifyTLSServerCertificateFunction::Run() { | 348 PlatformKeysVerifyTLSServerCertificateFunction::Run() { |
348 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 349 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
349 | 350 |
350 scoped_ptr<api_pk::VerifyTLSServerCertificate::Params> params( | 351 scoped_ptr<api_pk::VerifyTLSServerCertificate::Params> params( |
351 api_pk::VerifyTLSServerCertificate::Params::Create(*args_)); | 352 api_pk::VerifyTLSServerCertificate::Params::Create(*args_)); |
352 EXTENSION_FUNCTION_VALIDATE(params.get()); | 353 EXTENSION_FUNCTION_VALIDATE(params.get()); |
353 | 354 |
354 VerifyTrustAPI::GetFactoryInstance() | 355 VerifyTrustAPI::GetFactoryInstance() |
355 ->Get(browser_context()) | 356 ->Get(browser_context()) |
356 ->Verify(params.Pass(), extension_id(), | 357 ->Verify(std::move(params), extension_id(), |
357 base::Bind(&PlatformKeysVerifyTLSServerCertificateFunction:: | 358 base::Bind(&PlatformKeysVerifyTLSServerCertificateFunction:: |
358 FinishedVerification, | 359 FinishedVerification, |
359 this)); | 360 this)); |
360 | 361 |
361 return RespondLater(); | 362 return RespondLater(); |
362 } | 363 } |
363 | 364 |
364 void PlatformKeysVerifyTLSServerCertificateFunction::FinishedVerification( | 365 void PlatformKeysVerifyTLSServerCertificateFunction::FinishedVerification( |
365 const std::string& error, | 366 const std::string& error, |
366 int verify_result, | 367 int verify_result, |
(...skipping 16 matching lines...) Expand all Loading... |
383 result.debug_errors.push_back(kCertStatusErrors[i].name); | 384 result.debug_errors.push_back(kCertStatusErrors[i].name); |
384 } | 385 } |
385 } | 386 } |
386 } | 387 } |
387 | 388 |
388 Respond(ArgumentList( | 389 Respond(ArgumentList( |
389 api_pk::VerifyTLSServerCertificate::Results::Create(result))); | 390 api_pk::VerifyTLSServerCertificate::Results::Create(result))); |
390 } | 391 } |
391 | 392 |
392 } // namespace extensions | 393 } // namespace extensions |
OLD | NEW |