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// Internal API backing the chrome.certificateProvider API events.
6// The internal API associates events with replies to these events using request
7// IDs. A custom binding is used to hide these IDs from the public API.
8// Before an event hits the extension, the request ID is removed and instead a
9// callback is added to the event arguments. On the way back, when the extension
10// runs the callback to report its results, the callback magically prepends the
11// request ID to the results and calls the respective internal report function
12// (reportSignature or reportCertificates).
13[implemented_in = "chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h"]
14namespace certificateProviderInternal {
15  callback DoneCallback = void ();
16  callback ResultCallback = void (ArrayBuffer[] rejectedCertificates);
17
18  interface Functions {
19    // Matches certificateProvider.SignCallback. Must be called without the
20    // signature to report an error.
21    static void reportSignature(
22        long requestId,
23        optional ArrayBuffer signature,
24        optional DoneCallback callback);
25
26    // Matches certificateProvider.CertificatesCallback. Must be called without
27    // the certificates argument to report an error.
28    static void reportCertificates(
29        long requestId,
30        optional certificateProvider.CertificateInfo[] certificates,
31        optional ResultCallback callback);
32  };
33};
34
35