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