1d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// found in the LICENSE file.
4d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
5d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#ifndef PPAPI_PROXY_PLATFORM_VERIFICATION_PRIVATE_RESOURCE_H_
6d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#define PPAPI_PROXY_PLATFORM_VERIFICATION_PRIVATE_RESOURCE_H_
7d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
8d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ppapi/proxy/plugin_resource.h"
9d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ppapi/proxy/ppapi_proxy_export.h"
10d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ppapi/thunk/ppb_platform_verification_api.h"
11d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
12d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace ppapi {
13d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace proxy {
14d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
15d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)class PPAPI_PROXY_EXPORT PlatformVerificationPrivateResource
16d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    : public PluginResource,
17d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      public thunk::PPB_PlatformVerification_API {
18d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) public:
19d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  PlatformVerificationPrivateResource(Connection connection,
20d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)                                      PP_Instance instance);
21d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
22d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) private:
23d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  struct ChallengePlatformParams {
24d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    PP_Var* signed_data;
25d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    PP_Var* signed_data_signature;
26d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    PP_Var* platform_key_certificate;
27d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    scoped_refptr<TrackedCallback> callback;
28d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  };
29d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
30d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual ~PlatformVerificationPrivateResource();
31d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
32d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // PluginResource overrides.
33d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual thunk::PPB_PlatformVerification_API*
34d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      AsPPB_PlatformVerification_API() OVERRIDE;
35d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
36d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // PPB_PlatformVerification_API implementation.
37d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual int32_t ChallengePlatform(
38d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const PP_Var& service_id,
39d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const PP_Var& challenge,
40d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      PP_Var* signed_data,
41d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      PP_Var* signed_data_signature,
42d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      PP_Var* platform_key_certificate,
43d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
44d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void OnChallengePlatformReply(
45d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      ChallengePlatformParams output_params,
46d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const ResourceMessageReplyParams& params,
47d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const std::vector<uint8_t>& raw_signed_data,
48d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const std::vector<uint8_t>& raw_signed_data_signature,
49d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      const std::string& raw_platform_key_certificate);
50d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
51d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(PlatformVerificationPrivateResource);
52d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)};
53d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
54d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}  // namespace proxy
55d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}  // namespace ppapi
56d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
57d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#endif  // PPAPI_PROXY_PLATFORM_VERIFICATION_PRIVATE_RESOURCE_H_
58