Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / proximity_auth / secure_context.h
blobb249720e755482e1ce5a3930cf94df6d6cecb83c
1 // Copyright 2014 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_SECURE_CONTEXT_H
6 #define COMPONENTS_PROXIMITY_AUTH_SECURE_CONTEXT_H
8 #include "base/callback_forward.h"
10 namespace proximity_auth {
12 // An interface used to decode and encode messages.
13 class SecureContext {
14 public:
15 typedef base::Callback<void(const std::string& message)> MessageCallback;
17 // The protocol version used during authentication.
18 enum ProtocolVersion {
19 PROTOCOL_VERSION_THREE_ZERO, // 3.0
20 PROTOCOL_VERSION_THREE_ONE, // 3.1
23 virtual ~SecureContext() {}
25 // Decodes the |encoded_message| and returns the result.
26 // This function is asynchronous because the ChromeOS implementation requires
27 // a DBus call.
28 virtual void Decode(const std::string& encoded_message,
29 const MessageCallback& callback) = 0;
31 // Encodes the |message| and returns the result.
32 // This function is asynchronous because the ChromeOS implementation requires
33 // a DBus call.
34 virtual void Encode(const std::string& message,
35 const MessageCallback& callback) = 0;
37 // Returns the protocol version that was used during authentication.
38 virtual ProtocolVersion GetProtocolVersion() const = 0;
41 } // namespace proximity_auth
43 #endif // COMPONENTS_PROXIMITY_AUTH_SECURE_CONTEXT_H