Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / net / quic / crypto / strike_register_client.h
blobe37827a899d1577dedd7679bdedc3425d1fdd5b0
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 #ifndef NET_QUIC_CRYPTO_STRIKE_REGISTER_CLIENT_H_
6 #define NET_QUIC_CRYPTO_STRIKE_REGISTER_CLIENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/strings/string_piece.h"
12 #include "net/base/net_export.h"
13 #include "net/quic/quic_time.h"
15 namespace net {
17 // Interface implemented by clients that talk to strike registers
18 // implemented as local or remote services.
19 class NET_EXPORT_PRIVATE StrikeRegisterClient {
20 public:
21 // Single use callback that will be invoked once the validation
22 // operation is complete.
23 class NET_EXPORT_PRIVATE ResultCallback {
24 public:
25 ResultCallback() {}
26 virtual ~ResultCallback() {}
27 void Run(bool nonce_is_valid_and_unique) {
28 RunImpl(nonce_is_valid_and_unique);
29 delete this;
32 protected:
33 virtual void RunImpl(bool nonce_is_valid_and_unique) = 0;
35 private:
36 DISALLOW_COPY_AND_ASSIGN(ResultCallback);
39 StrikeRegisterClient() {}
40 virtual ~StrikeRegisterClient() {}
42 // Returns true iff the strike register knows about the given orbit.
43 virtual bool IsKnownOrbit(base::StringPiece orbit) const = 0;
44 // Validate a nonce for freshness and uniqueness.
45 // Will invoke cb->Run(ValidateResponse::nonce_is_valid_and_unique())
46 // once the asynchronous operation is complete.
47 virtual void VerifyNonceIsValidAndUnique(
48 base::StringPiece nonce,
49 QuicWallTime now,
50 ResultCallback* cb) = 0;
52 private:
53 DISALLOW_COPY_AND_ASSIGN(StrikeRegisterClient);
56 } // namespace net
58 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_CLIENT_H_