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

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

Issue 1053773007: Add Platform Verification Mojo Services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn build Created 5 years, 7 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
(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 #include "chrome/browser/chromeos/attestation/platform_verification_impl.h"
6 #include "content/public/browser/browser_thread.h"
7 #include "content/public/browser/web_contents.h"
8 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
9
10 namespace chromeos {
11 namespace attestation {
12
13 // static
14 void PlatformVerificationImpl::Create(
15 content::RenderFrameHost* render_frame_host,
16 mojo::InterfaceRequest<media::interfaces::PlatformVerification> request) {
17 DVLOG(2) << __FUNCTION__;
18 DCHECK(render_frame_host);
19
20 mojo::BindToRequest(new PlatformVerificationImpl(render_frame_host),
21 &request);
22 }
23
24 PlatformVerificationImpl::PlatformVerificationImpl(
25 content::RenderFrameHost* render_frame_host)
26 : render_frame_host_(render_frame_host), weak_factory_(this) {
27 DCHECK(render_frame_host);
28 }
29
30 PlatformVerificationImpl::~PlatformVerificationImpl() {
31 }
32
33 void PlatformVerificationImpl::ChallengePlatform(
34 const mojo::String& service_id,
35 const mojo::String& challenge,
36 const ChallengePlatformCallback& callback) {
37 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
38
39 if (!platform_verification_flow_.get())
40 platform_verification_flow_ = new PlatformVerificationFlow();
41
42 platform_verification_flow_->ChallengePlatformKey(
43 content::WebContents::FromRenderFrameHost(render_frame_host_), service_id,
Darren Krahn 2015/05/06 19:02:40 Side note: PlatformVerification takes a WebContent
xhwang 2015/05/07 00:27:36 This is fine for now. Agreed we can probably simpl
44 challenge, base::Bind(&PlatformVerificationImpl::OnPlatformChallenged,
45 weak_factory_.GetWeakPtr(), callback));
46 }
47
48 void PlatformVerificationImpl::OnPlatformChallenged(
49 const ChallengePlatformCallback& callback,
50 Result result,
51 const std::string& signed_data,
52 const std::string& signature,
53 const std::string& platform_key_certificate) {
54 if (result != PlatformVerificationFlow::SUCCESS) {
55 DCHECK(signed_data.empty());
56 DCHECK(signature.empty());
57 DCHECK(platform_key_certificate.empty());
58 LOG(ERROR) << "Platform verification failed.";
Darren Krahn 2015/05/06 19:02:40 We don't need to bubble the failure status up to t
xhwang 2015/05/07 00:27:37 Done.
59 }
60
61 callback.Run(signed_data, signature, platform_key_certificate);
62 }
63
64 } // namespace attestation
65 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698