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