Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/chromeos/attestation/platform_verification_impl.h

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
16 15
17 namespace chromeos { 16 namespace chromeos {
18 namespace attestation { 17 namespace attestation {
19 18
20 // Implements media::mojom::PlatformVerification on ChromeOS using 19 // Implements media::mojom::PlatformVerification on ChromeOS using
21 // PlatformVerificationFlow. Can only be used on the UI thread because 20 // PlatformVerificationFlow. Can only be used on the UI thread because
22 // PlatformVerificationFlow lives on the UI thread. 21 // PlatformVerificationFlow lives on the UI thread.
23 class PlatformVerificationImpl : public media::mojom::PlatformVerification { 22 class PlatformVerificationImpl : public media::mojom::PlatformVerification {
24 public: 23 public:
25 static void Create( 24 static void Create(
26 content::RenderFrameHost* render_frame_host, 25 content::RenderFrameHost* render_frame_host,
27 mojo::InterfaceRequest<media::mojom::PlatformVerification> request); 26 mojo::InterfaceRequest<media::mojom::PlatformVerification> request);
28 27
29 PlatformVerificationImpl( 28 explicit PlatformVerificationImpl(
30 content::RenderFrameHost* render_frame_host, 29 content::RenderFrameHost* render_frame_host);
31 mojo::InterfaceRequest<PlatformVerification> request);
32 ~PlatformVerificationImpl() override; 30 ~PlatformVerificationImpl() override;
33 31
34 // mojo::InterfaceImpl<PlatformVerification> implementation. 32 // mojo::InterfaceImpl<PlatformVerification> implementation.
35 void ChallengePlatform(const mojo::String& service_id, 33 void ChallengePlatform(const mojo::String& service_id,
36 const mojo::String& challenge, 34 const mojo::String& challenge,
37 const ChallengePlatformCallback& callback) override; 35 const ChallengePlatformCallback& callback) override;
38 36
39 private: 37 private:
40 using Result = PlatformVerificationFlow::Result; 38 using Result = PlatformVerificationFlow::Result;
41 39
42 void OnPlatformChallenged(const ChallengePlatformCallback& callback, 40 void OnPlatformChallenged(const ChallengePlatformCallback& callback,
43 Result result, 41 Result result,
44 const std::string& signed_data, 42 const std::string& signed_data,
45 const std::string& signature, 43 const std::string& signature,
46 const std::string& platform_key_certificate); 44 const std::string& platform_key_certificate);
47 45
48 mojo::StrongBinding<media::mojom::PlatformVerification> binding_;
49
50 content::RenderFrameHost* const render_frame_host_; 46 content::RenderFrameHost* const render_frame_host_;
51 47
52 scoped_refptr<PlatformVerificationFlow> platform_verification_flow_; 48 scoped_refptr<PlatformVerificationFlow> platform_verification_flow_;
53 49
54 base::WeakPtrFactory<PlatformVerificationImpl> weak_factory_; 50 base::WeakPtrFactory<PlatformVerificationImpl> weak_factory_;
55 }; 51 };
56 52
57 } // namespace attestation 53 } // namespace attestation
58 } // namespace chromeos 54 } // namespace chromeos
59 55
60 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_ 56 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698