| 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/chromeos/attestation/platform_verification_impl.h" | 5 #include "chrome/browser/chromeos/attestation/platform_verification_impl.h" |
| 6 #include "content/public/browser/browser_thread.h" | 6 #include "content/public/browser/browser_thread.h" |
| 7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" | |
| 9 | 8 |
| 10 namespace chromeos { | 9 namespace chromeos { |
| 11 namespace attestation { | 10 namespace attestation { |
| 12 | 11 |
| 12 using media::interfaces::PlatformVerification; |
| 13 |
| 13 // static | 14 // static |
| 14 void PlatformVerificationImpl::Create( | 15 void PlatformVerificationImpl::Create( |
| 15 content::RenderFrameHost* render_frame_host, | 16 content::RenderFrameHost* render_frame_host, |
| 16 mojo::InterfaceRequest<media::interfaces::PlatformVerification> request) { | 17 mojo::InterfaceRequest<PlatformVerification> request) { |
| 17 DVLOG(2) << __FUNCTION__; | 18 DVLOG(2) << __FUNCTION__; |
| 18 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 19 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 19 DCHECK(render_frame_host); | 20 DCHECK(render_frame_host); |
| 20 | 21 |
| 21 // The created object is bound to (and owned by) the pipe. | 22 // The created object is strongly bound to (and owned by) the pipe. |
| 22 mojo::BindToRequest(new PlatformVerificationImpl(render_frame_host), | 23 new PlatformVerificationImpl(render_frame_host, request.Pass()); |
| 23 &request); | |
| 24 } | 24 } |
| 25 | 25 |
| 26 PlatformVerificationImpl::PlatformVerificationImpl( | 26 PlatformVerificationImpl::PlatformVerificationImpl( |
| 27 content::RenderFrameHost* render_frame_host) | 27 content::RenderFrameHost* render_frame_host, |
| 28 : render_frame_host_(render_frame_host), weak_factory_(this) { | 28 mojo::InterfaceRequest<PlatformVerification> request) |
| 29 : binding_(this, request.Pass()), |
| 30 render_frame_host_(render_frame_host), |
| 31 weak_factory_(this) { |
| 29 DCHECK(render_frame_host); | 32 DCHECK(render_frame_host); |
| 30 } | 33 } |
| 31 | 34 |
| 32 PlatformVerificationImpl::~PlatformVerificationImpl() { | 35 PlatformVerificationImpl::~PlatformVerificationImpl() { |
| 33 } | 36 } |
| 34 | 37 |
| 35 void PlatformVerificationImpl::ChallengePlatform( | 38 void PlatformVerificationImpl::ChallengePlatform( |
| 36 const mojo::String& service_id, | 39 const mojo::String& service_id, |
| 37 const mojo::String& challenge, | 40 const mojo::String& challenge, |
| 38 const ChallengePlatformCallback& callback) { | 41 const ChallengePlatformCallback& callback) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 } | 70 } |
| 68 | 71 |
| 69 DCHECK(!signed_data.empty()); | 72 DCHECK(!signed_data.empty()); |
| 70 DCHECK(!signature.empty()); | 73 DCHECK(!signature.empty()); |
| 71 DCHECK(!platform_key_certificate.empty()); | 74 DCHECK(!platform_key_certificate.empty()); |
| 72 callback.Run(true, signed_data, signature, platform_key_certificate); | 75 callback.Run(true, signed_data, signature, platform_key_certificate); |
| 73 } | 76 } |
| 74 | 77 |
| 75 } // namespace attestation | 78 } // namespace attestation |
| 76 } // namespace chromeos | 79 } // namespace chromeos |
| OLD | NEW |