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

Unified Diff: remoting/client/host_connection.h

Issue 2690003: Copy the (early prototype of) remoting in Chrome into the public tree.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/decoder_verbatim_unittest.cc ('k') | remoting/client/host_connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/host_connection.h
===================================================================
--- remoting/client/host_connection.h (revision 0)
+++ remoting/client/host_connection.h (revision 0)
@@ -0,0 +1,77 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_HOST_CONNECTION_H_
+#define REMOTING_CLIENT_HOST_CONNECTION_H_
+
+#include <deque>
+#include <vector>
+
+#include "base/message_loop.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "remoting/base/protocol_decoder.h"
+#include "remoting/base/protocol/chromotocol.pb.h"
+#include "remoting/jingle_glue/jingle_channel.h"
+#include "remoting/jingle_glue/jingle_client.h"
+
+namespace remoting {
+
+class HostConnection : public JingleChannel::Callback,
+ public JingleClient::Callback {
+ public:
+ class EventHandler {
+ public:
+ virtual ~EventHandler() {}
+
+ // Handles an event received by the HostConnection. Receiver will own the
+ // HostMessages in HostMessageList and needs to delete them.
+ // Note that the sender of messages will not reference messages
+ // again so it is okay to clear |messages| in this method.
+ virtual void HandleMessages(HostConnection* conn,
+ HostMessageList* messages) = 0;
+
+ // Called when the network connection is opened.
+ virtual void OnConnectionOpened(HostConnection* conn) = 0;
+
+ // Called when the network connection is closed.
+ virtual void OnConnectionClosed(HostConnection* conn) = 0;
+
+ // Called when the network connection has failed.
+ virtual void OnConnectionFailed(HostConnection* conn) = 0;
+ };
+
+ // Constructs a HostConnection object.
+ HostConnection(ProtocolDecoder* decoder, EventHandler* handler);
+
+ virtual ~HostConnection();
+
+ void Connect(const std::string& username, const std::string& password,
+ const std::string& host_jid);
+ void Disconnect();
+
+ // JingleChannel::Callback interface.
+ void OnStateChange(JingleChannel* channel, JingleChannel::State state);
+ void OnPacketReceived(JingleChannel* channel,
+ scoped_refptr<media::DataBuffer> buffer);
+
+ // JingleClient::Callback interface.
+ void OnStateChange(JingleClient* client, JingleClient::State state);
+ bool OnAcceptConnection(JingleClient* client, const std::string& jid,
+ JingleChannel::Callback** callback);
+ void OnNewConnection(JingleClient* client,
+ scoped_refptr<JingleChannel> channel);
+
+ private:
+ scoped_refptr<JingleClient> jingle_client_;
+ scoped_refptr<JingleChannel> jingle_channel_;
+ scoped_ptr<ProtocolDecoder> decoder_;
+ EventHandler* handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostConnection);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_HOST_CONNECTION_H_
Property changes on: remoting/client/host_connection.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « remoting/client/decoder_verbatim_unittest.cc ('k') | remoting/client/host_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698