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

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

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 #include "chrome/browser/chromeos/attestation/platform_verification_impl.h" 5 #include "chrome/browser/chromeos/attestation/platform_verification_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 namespace attestation { 14 namespace attestation {
14 15
15 using media::mojom::PlatformVerification; 16 using media::mojom::PlatformVerification;
16 17
17 // static 18 // static
18 void PlatformVerificationImpl::Create( 19 void PlatformVerificationImpl::Create(
19 content::RenderFrameHost* render_frame_host, 20 content::RenderFrameHost* render_frame_host,
20 mojo::InterfaceRequest<PlatformVerification> request) { 21 mojo::InterfaceRequest<PlatformVerification> request) {
21 DVLOG(2) << __FUNCTION__; 22 DVLOG(2) << __FUNCTION__;
22 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
23 DCHECK(render_frame_host); 24 DCHECK(render_frame_host);
24 25 mojo::MakeStrongBinding(
25 // The created object is strongly bound to (and owned by) the pipe. 26 base::MakeUnique<PlatformVerificationImpl>(render_frame_host),
26 new PlatformVerificationImpl(render_frame_host, std::move(request)); 27 std::move(request));
27 } 28 }
28 29
29 PlatformVerificationImpl::PlatformVerificationImpl( 30 PlatformVerificationImpl::PlatformVerificationImpl(
30 content::RenderFrameHost* render_frame_host, 31 content::RenderFrameHost* render_frame_host)
31 mojo::InterfaceRequest<PlatformVerification> request) 32 : render_frame_host_(render_frame_host), weak_factory_(this) {
32 : binding_(this, std::move(request)),
33 render_frame_host_(render_frame_host),
34 weak_factory_(this) {
35 DCHECK(render_frame_host); 33 DCHECK(render_frame_host);
36 } 34 }
37 35
38 PlatformVerificationImpl::~PlatformVerificationImpl() { 36 PlatformVerificationImpl::~PlatformVerificationImpl() {
39 } 37 }
40 38
41 void PlatformVerificationImpl::ChallengePlatform( 39 void PlatformVerificationImpl::ChallengePlatform(
42 const mojo::String& service_id, 40 const mojo::String& service_id,
43 const mojo::String& challenge, 41 const mojo::String& challenge,
44 const ChallengePlatformCallback& callback) { 42 const ChallengePlatformCallback& callback) {
(...skipping 28 matching lines...) Expand all
73 } 71 }
74 72
75 DCHECK(!signed_data.empty()); 73 DCHECK(!signed_data.empty());
76 DCHECK(!signature.empty()); 74 DCHECK(!signature.empty());
77 DCHECK(!platform_key_certificate.empty()); 75 DCHECK(!platform_key_certificate.empty());
78 callback.Run(true, signed_data, signature, platform_key_certificate); 76 callback.Run(true, signed_data, signature, platform_key_certificate);
79 } 77 }
80 78
81 } // namespace attestation 79 } // namespace attestation
82 } // namespace chromeos 80 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/attestation/platform_verification_impl.h ('k') | chrome/browser/media/output_protection_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698