Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Side by Side Diff: remoting/protocol/authenticator.h

Issue 12389010: Refactor of Authenticator to allow it to ProcessMessage asynchronously and then call a callback (Closed) Base URL: http://git.chromium.org/chromium/src.git@host_key_pair
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_H_ 5 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_AUTHENTICATOR_H_ 6 #define REMOTING_PROTOCOL_AUTHENTICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 12
12 namespace buzz { 13 namespace buzz {
13 class XmlElement; 14 class XmlElement;
14 } // namespace buzz 15 } // namespace buzz
15 16
16 namespace remoting { 17 namespace remoting {
17 namespace protocol { 18 namespace protocol {
18 19
19 class ChannelAuthenticator; 20 class ChannelAuthenticator;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 77
77 // Returns current state of the authenticator. 78 // Returns current state of the authenticator.
78 virtual State state() const = 0; 79 virtual State state() const = 0;
79 80
80 // Returns rejection reason. Can be called only when in REJECTED state. 81 // Returns rejection reason. Can be called only when in REJECTED state.
81 virtual RejectionReason rejection_reason() const = 0; 82 virtual RejectionReason rejection_reason() const = 0;
82 83
83 // Called in response to incoming message received from the peer. 84 // Called in response to incoming message received from the peer.
84 // Should only be called when in WAITING_MESSAGE state. Caller 85 // Should only be called when in WAITING_MESSAGE state. Caller
85 // retains ownership of |message|. 86 // retains ownership of |message|.
86 virtual void ProcessMessage(const buzz::XmlElement* message) = 0; 87 virtual void ProcessMessage(const base::Closure& resume_callback,
88 const buzz::XmlElement* message) = 0;
87 89
88 // Must be called when in MESSAGE_READY state. Returns next 90 // Must be called when in MESSAGE_READY state. Returns next
89 // authentication message that needs to be sent to the peer. 91 // authentication message that needs to be sent to the peer.
90 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() = 0; 92 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() = 0;
91 93
92 // Creates new authenticator for a channel. Can be called only in 94 // Creates new authenticator for a channel. Can be called only in
93 // the ACCEPTED state. 95 // the ACCEPTED state.
94 virtual scoped_ptr<ChannelAuthenticator> 96 virtual scoped_ptr<ChannelAuthenticator>
95 CreateChannelAuthenticator() const = 0; 97 CreateChannelAuthenticator() const = 0;
96 }; 98 };
(...skipping 15 matching lines...) Expand all
112 virtual scoped_ptr<Authenticator> CreateAuthenticator( 114 virtual scoped_ptr<Authenticator> CreateAuthenticator(
113 const std::string& local_jid, 115 const std::string& local_jid,
114 const std::string& remote_jid, 116 const std::string& remote_jid,
115 const buzz::XmlElement* first_message) = 0; 117 const buzz::XmlElement* first_message) = 0;
116 }; 118 };
117 119
118 } // namespace protocol 120 } // namespace protocol
119 } // namespace remoting 121 } // namespace remoting
120 122
121 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ 123 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698