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

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

Issue 6724033: Remove authenticated_ fields from stubs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer's comments. Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/client_stub.cc ('k') | remoting/protocol/connection_to_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CONNECTION_TO_CLIENT_H_ 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 29 matching lines...) Expand all
40 // Called when the network connection is closed. 40 // Called when the network connection is closed.
41 virtual void OnConnectionClosed(ConnectionToClient* connection) = 0; 41 virtual void OnConnectionClosed(ConnectionToClient* connection) = 0;
42 42
43 // Called when the network connection has failed. 43 // Called when the network connection has failed.
44 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; 44 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0;
45 }; 45 };
46 46
47 // Constructs a ConnectionToClient object. |message_loop| is the message loop 47 // Constructs a ConnectionToClient object. |message_loop| is the message loop
48 // that this object runs on. A viewer object receives events and messages from 48 // that this object runs on. A viewer object receives events and messages from
49 // a libjingle channel, these events are delegated to |handler|. 49 // a libjingle channel, these events are delegated to |handler|.
50 // It is guranteed that |handler| is called only on the |message_loop|. 50 // It is guaranteed that |handler| is called only on the |message_loop|.
51 ConnectionToClient(MessageLoop* message_loop, 51 ConnectionToClient(MessageLoop* message_loop,
52 EventHandler* handler, 52 EventHandler* handler);
53 InputStub* input_stub);
54 53
55 virtual void Init(Session* session); 54 virtual void Init(Session* session);
56 55
57 // Returns the connection in use. 56 // Returns the connection in use.
58 virtual Session* session(); 57 virtual Session* session();
59 58
60 // Disconnect the client connection. This method is allowed to be called 59 // Disconnect the client connection. This method is allowed to be called
61 // more than once and calls after the first one will be ignored. 60 // more than once and calls after the first one will be ignored.
62 // 61 //
63 // After this method is called all the send method calls will be ignored. 62 // After this method is called all the send method calls will be ignored.
64 virtual void Disconnect(); 63 virtual void Disconnect();
65 64
66 // Send encoded update stream data to the viewer. 65 // Send encoded update stream data to the viewer.
67 virtual VideoStub* video_stub(); 66 virtual VideoStub* video_stub();
68 67
69 // Return pointer to ClientStub. 68 // Return pointer to ClientStub.
70 virtual ClientStub* client_stub(); 69 virtual ClientStub* client_stub();
71 70
72 virtual HostStub* host_stub(); 71 // These two setters should be called before Init().
73 virtual void set_host_stub(HostStub* host_stub); 72 virtual void set_host_stub(HostStub* host_stub);
74 73 virtual void set_input_stub(InputStub* input_stub);
75 // Called when the host accepts the client authentication.
76 void OnClientAuthenticated();
77
78 // Whether the client has been authenticated.
79 bool client_authenticated();
80 74
81 protected: 75 protected:
82 friend class base::RefCountedThreadSafe<ConnectionToClient>; 76 friend class base::RefCountedThreadSafe<ConnectionToClient>;
83 virtual ~ConnectionToClient(); 77 virtual ~ConnectionToClient();
84 78
85 private: 79 private:
86 // Callback for protocol Session. 80 // Callback for protocol Session.
87 void OnSessionStateChange(Session::State state); 81 void OnSessionStateChange(Session::State state);
88 82
89 // Process a libjingle state change event on the |loop_|. 83 // Process a libjingle state change event on the |loop_|.
90 void StateChangeTask(Session::State state); 84 void StateChangeTask(Session::State state);
91 85
92 void OnClosed(); 86 void OnClosed();
93 87
94 // Initially false, this is set to true once the client has authenticated
95 // properly. When this is false, many client messages (like input events)
96 // will be ignored.
97 bool client_authenticated_;
98
99 // The libjingle channel used to send and receive data from the remote client. 88 // The libjingle channel used to send and receive data from the remote client.
100 scoped_refptr<Session> session_; 89 scoped_refptr<Session> session_;
101 90
102 scoped_ptr<VideoWriter> video_writer_; 91 scoped_ptr<VideoWriter> video_writer_;
103 92
104 // ClientStub for sending messages to the client. 93 // ClientStub for sending messages to the client.
105 scoped_ptr<ClientStub> client_stub_; 94 scoped_ptr<ClientStub> client_stub_;
106 95
107 // The message loop that this object runs on. 96 // The message loop that this object runs on.
108 MessageLoop* loop_; 97 MessageLoop* loop_;
(...skipping 10 matching lines...) Expand all
119 // Dispatcher for submitting messages to stubs. 108 // Dispatcher for submitting messages to stubs.
120 scoped_ptr<HostMessageDispatcher> dispatcher_; 109 scoped_ptr<HostMessageDispatcher> dispatcher_;
121 110
122 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); 111 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient);
123 }; 112 };
124 113
125 } // namespace protocol 114 } // namespace protocol
126 } // namespace remoting 115 } // namespace remoting
127 116
128 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ 117 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
OLDNEW
« no previous file with comments | « remoting/protocol/client_stub.cc ('k') | remoting/protocol/connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698