Add an exponential backoff to rechecking the app list doodle.
[chromium-blink-merge.git] / ppapi / cpp / private / platform_verification.cc
blobe199a7199d1229777882780f3e22f62be24b5c5c
1 // Copyright 2013 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.
5 #include "ppapi/cpp/private/platform_verification.h"
7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_platform_verification_private.h"
10 #include "ppapi/cpp/instance_handle.h"
11 #include "ppapi/cpp/module_impl.h"
12 #include "ppapi/cpp/var.h"
14 namespace pp {
16 namespace {
18 template <> const char* interface_name<PPB_PlatformVerification_Private_0_2>() {
19 return PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2;
22 inline bool HasInterface() {
23 return has_interface<PPB_PlatformVerification_Private_0_2>();
26 inline const PPB_PlatformVerification_Private_0_2* GetInterface() {
27 return get_interface<PPB_PlatformVerification_Private_0_2>();
30 } // namespace
32 PlatformVerification::PlatformVerification(const InstanceHandle& instance) {
33 if (HasInterface())
34 PassRefFromConstructor(GetInterface()->Create(instance.pp_instance()));
37 PlatformVerification::~PlatformVerification() {}
39 int32_t PlatformVerification::ChallengePlatform(
40 const Var& service_id,
41 const Var& challenge,
42 Var* signed_data,
43 Var* signed_data_signature,
44 Var* platform_key_certificate,
45 const CompletionCallback& callback) {
46 if (!HasInterface())
47 return callback.MayForce(PP_ERROR_NOINTERFACE);
49 return GetInterface()->ChallengePlatform(
50 pp_resource(), service_id.pp_var(), challenge.pp_var(),
51 const_cast<PP_Var*>(&signed_data->pp_var()),
52 const_cast<PP_Var*>(&signed_data_signature->pp_var()),
53 const_cast<PP_Var*>(&platform_key_certificate->pp_var()),
54 callback.pp_completion_callback());
57 } // namespace pp