| 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 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 13 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 15 #include "media/mojo/interfaces/platform_verification.mojom.h" | 15 #include "media/mojo/interfaces/platform_verification.mojom.h" |
| 16 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" | 16 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 namespace attestation { | 19 namespace attestation { |
| 20 | 20 |
| 21 // Implements media::interfaces::PlatformVerification on ChromeOS using | 21 // Implements media::interfaces::PlatformVerification on ChromeOS using |
| 22 // PlatformVerificationFlow. Can only be used on the UI thread because | 22 // PlatformVerificationFlow. Can only be used on the UI thread because |
| 23 // PlatformVerificationFlow lives on the UI thread. | 23 // PlatformVerificationFlow lives on the UI thread. |
| 24 class PlatformVerificationImpl | 24 class PlatformVerificationImpl |
| 25 : public mojo::InterfaceImpl<media::interfaces::PlatformVerification> { | 25 : public media::interfaces::PlatformVerification { |
| 26 public: | 26 public: |
| 27 static void Create( | 27 static void Create( |
| 28 content::RenderFrameHost* render_frame_host, | 28 content::RenderFrameHost* render_frame_host, |
| 29 mojo::InterfaceRequest<media::interfaces::PlatformVerification> request); | 29 mojo::InterfaceRequest<media::interfaces::PlatformVerification> request); |
| 30 | 30 |
| 31 explicit PlatformVerificationImpl( | 31 PlatformVerificationImpl( |
| 32 content::RenderFrameHost* render_frame_host); | 32 content::RenderFrameHost* render_frame_host, |
| 33 mojo::InterfaceRequest<PlatformVerification> request); |
| 33 ~PlatformVerificationImpl() override; | 34 ~PlatformVerificationImpl() override; |
| 34 | 35 |
| 35 // mojo::InterfaceImpl<PlatformVerification> implementation. | 36 // mojo::InterfaceImpl<PlatformVerification> implementation. |
| 36 void ChallengePlatform(const mojo::String& service_id, | 37 void ChallengePlatform(const mojo::String& service_id, |
| 37 const mojo::String& challenge, | 38 const mojo::String& challenge, |
| 38 const ChallengePlatformCallback& callback) override; | 39 const ChallengePlatformCallback& callback) override; |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 using Result = PlatformVerificationFlow::Result; | 42 using Result = PlatformVerificationFlow::Result; |
| 42 | 43 |
| 43 void OnPlatformChallenged(const ChallengePlatformCallback& callback, | 44 void OnPlatformChallenged(const ChallengePlatformCallback& callback, |
| 44 Result result, | 45 Result result, |
| 45 const std::string& signed_data, | 46 const std::string& signed_data, |
| 46 const std::string& signature, | 47 const std::string& signature, |
| 47 const std::string& platform_key_certificate); | 48 const std::string& platform_key_certificate); |
| 48 | 49 |
| 50 mojo::StrongBinding<media::interfaces::PlatformVerification> binding_; |
| 51 |
| 49 content::RenderFrameHost* const render_frame_host_; | 52 content::RenderFrameHost* const render_frame_host_; |
| 50 | 53 |
| 51 scoped_refptr<PlatformVerificationFlow> platform_verification_flow_; | 54 scoped_refptr<PlatformVerificationFlow> platform_verification_flow_; |
| 52 | 55 |
| 53 base::WeakPtrFactory<PlatformVerificationImpl> weak_factory_; | 56 base::WeakPtrFactory<PlatformVerificationImpl> weak_factory_; |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 } // namespace attestation | 59 } // namespace attestation |
| 57 } // namespace chromeos | 60 } // namespace chromeos |
| 58 | 61 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ |
| OLD | NEW |