Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / proximity_auth / authenticator.h
blobf1cbbf302c15aaf082a207dff3f20d974be93e92
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.
5 #ifndef COMPONENTS_PROXIMITY_AUTH_AUTHENTICATOR_H
6 #define COMPONENTS_PROXIMITY_AUTH_AUTHENTICATOR_H
8 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h"
11 namespace proximity_auth {
13 class SecureContext;
15 // Interface for authenticating the remote connection. The two devices
16 // authenticate each other, and if the protocol succeeds, establishes a
17 // SecureContext that is used to securely encode and decode all messages sent
18 // and received over the connection.
19 // Do not reuse after calling |Authenticate()|.
20 class Authenticator {
21 public:
22 // The result of the authentication protocol.
23 enum class Result {
24 SUCCESS,
25 DISCONNECTED,
26 FAILURE,
29 virtual ~Authenticator() {}
31 // Initiates the authentication attempt, invoking |callback| with the result.
32 // If the authentication protocol succeeds, then |secure_context| will be
33 // contain the SecureContext used to securely exchange messages. Otherwise, it
34 // will be null if the protocol fails.
35 typedef base::Callback<void(Result result,
36 scoped_ptr<SecureContext> secure_context)>
37 AuthenticationCallback;
38 virtual void Authenticate(const AuthenticationCallback& callback) = 0;
41 } // namespace proximity_auth
43 #endif // COMPONENTS_PROXIMITY_AUTH_AUTHENTICATOR_H