summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/host/chromoting_host.cc7
-rw-r--r--remoting/host/chromoting_host.h3
-rw-r--r--remoting/host/client_session.cc10
-rw-r--r--remoting/host/client_session.h11
-rw-r--r--remoting/host/host_mock_objects.cc3
-rw-r--r--remoting/host/host_mock_objects.h7
-rw-r--r--remoting/protocol/connection_to_client.cc10
-rw-r--r--remoting/protocol/connection_to_client.h21
-rw-r--r--remoting/protocol/protocol_mock_objects.cc3
-rw-r--r--remoting/protocol/protocol_mock_objects.h4
10 files changed, 69 insertions, 10 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 63ac7bc..0e8561a 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -225,6 +225,13 @@ void ChromotingHost::OnSessionSequenceNumber(ClientSession* session,
recorder_->UpdateSequenceNumber(sequence_number);
}
+void ChromotingHost::OnSessionIpAddress(ClientSession* session,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) {
+ // TODO(lambroslambrou): Notify the HostStatusObservers via a new interface
+ // method.
+}
+
void ChromotingHost::OnSessionManagerReady() {
DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
// Don't need to do anything here, just wait for incoming
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index eb7364d..8b56ab9 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -110,6 +110,9 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
virtual void OnSessionClosed(ClientSession* session) OVERRIDE;
virtual void OnSessionSequenceNumber(ClientSession* session,
int64 sequence_number) OVERRIDE;
+ virtual void OnSessionIpAddress(ClientSession* session,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) OVERRIDE;
// SessionManager::Listener implementation.
virtual void OnSessionManagerReady() OVERRIDE;
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 532b825..140f4c5 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -125,6 +125,14 @@ void ClientSession::OnSequenceNumberUpdated(
event_handler_->OnSessionSequenceNumber(this, sequence_number);
}
+void ClientSession::OnClientIpAddress(protocol::ConnectionToClient* connection,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) {
+ DCHECK(CalledOnValidThread());
+ DCHECK_EQ(connection_.get(), connection);
+ event_handler_->OnSessionIpAddress(this, channel_name, end_point);
+}
+
void ClientSession::Disconnect() {
DCHECK(CalledOnValidThread());
DCHECK(connection_.get());
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 9dd8ff0..98f6cf8 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -46,6 +46,12 @@ class ClientSession : public protocol::HostStub,
// callback must not tear down this object.
virtual void OnSessionSequenceNumber(ClientSession* client,
int64 sequence_number) = 0;
+
+ // Called on notification of a route change event, when a channel is
+ // connected.
+ virtual void OnSessionIpAddress(ClientSession* client,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) = 0;
};
// Takes ownership of |connection|. Does not take ownership of
@@ -69,6 +75,9 @@ class ClientSession : public protocol::HostStub,
protocol::Session::Error error) OVERRIDE;
virtual void OnSequenceNumberUpdated(
protocol::ConnectionToClient* connection, int64 sequence_number) OVERRIDE;
+ virtual void OnClientIpAddress(protocol::ConnectionToClient* connection,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) OVERRIDE;
// Disconnects the session and destroys the transport. Event handler
// is guaranteed not to be called after this method is called. Can
diff --git a/remoting/host/host_mock_objects.cc b/remoting/host/host_mock_objects.cc
index fe8d71d..2d34908 100644
--- a/remoting/host/host_mock_objects.cc
+++ b/remoting/host/host_mock_objects.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
#include "remoting/host/host_mock_objects.h"
#include "base/message_loop_proxy.h"
+#include "net/base/ip_endpoint.h"
#include "remoting/proto/event.pb.h"
namespace remoting {
diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h
index 7548775..e1c91fa 100644
--- a/remoting/host/host_mock_objects.h
+++ b/remoting/host/host_mock_objects.h
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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_HOST_HOST_MOCK_OBJECTS_H_
#define REMOTING_HOST_HOST_MOCK_OBJECTS_H_
+#include "net/base/ip_endpoint.h"
#include "remoting/host/capturer.h"
#include "remoting/host/curtain.h"
#include "remoting/host/chromoting_host_context.h"
@@ -103,6 +104,10 @@ class MockClientSessionEventHandler : public ClientSession::EventHandler {
MOCK_METHOD1(OnSessionFailed, void(ClientSession* client));
MOCK_METHOD2(OnSessionSequenceNumber, void(ClientSession* client,
int64 sequence_number));
+ MOCK_METHOD3(OnSessionIpAddress, void(ClientSession* client,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point));
+
private:
DISALLOW_COPY_AND_ASSIGN(MockClientSessionEventHandler);
};
diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc
index de5b401..ea17201 100644
--- a/remoting/protocol/connection_to_client.cc
+++ b/remoting/protocol/connection_to_client.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -25,6 +25,9 @@ ConnectionToClient::ConnectionToClient(protocol::Session* session)
session_->SetStateChangeCallback(
base::Bind(&ConnectionToClient::OnSessionStateChange,
base::Unretained(this)));
+ session_->SetRouteChangeCallback(
+ base::Bind(&ConnectionToClient::OnSessionRouteChange,
+ base::Unretained(this)));
}
ConnectionToClient::~ConnectionToClient() {
@@ -131,6 +134,11 @@ void ConnectionToClient::OnSessionStateChange(Session::State state) {
}
}
+void ConnectionToClient::OnSessionRouteChange(
+ const std::string& channel_name, const net::IPEndPoint& end_point) {
+ handler_->OnClientIpAddress(this, channel_name, end_point);
+}
+
void ConnectionToClient::OnChannelInitialized(bool successful) {
DCHECK(CalledOnValidThread());
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index 1b3490f..9a92724 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -6,6 +6,7 @@
#define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
#include <deque>
+#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
@@ -14,6 +15,10 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/video_writer.h"
+namespace net {
+class IPEndPoint;
+} // namespace net
+
namespace remoting {
namespace protocol {
@@ -45,6 +50,12 @@ class ConnectionToClient : public base::NonThreadSafe {
// Called when sequence number is updated.
virtual void OnSequenceNumberUpdated(ConnectionToClient* connection,
int64 sequence_number) = 0;
+
+ // Called on notification of a route change event, which happens when a
+ // channel is connected.
+ virtual void OnClientIpAddress(ConnectionToClient* connection,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) = 0;
};
// Constructs a ConnectionToClient object for the |session|. Takes
@@ -52,9 +63,8 @@ class ConnectionToClient : public base::NonThreadSafe {
explicit ConnectionToClient(Session* session);
virtual ~ConnectionToClient();
- // Set |event_handler| for connection events. |event_handler| is
- // guaranteed to be used only on the network thread. Must be called
- // once when this object is created.
+ // Set |event_handler| for connection events. Must be called once when this
+ // object is created.
void SetEventHandler(EventHandler* event_handler);
// Returns the connection in use.
@@ -81,6 +91,9 @@ class ConnectionToClient : public base::NonThreadSafe {
// Callback for protocol Session.
void OnSessionStateChange(Session::State state);
+ void OnSessionRouteChange(const std::string& channel_name,
+ const net::IPEndPoint& end_point);
+
// Callback for channel initialization.
void OnChannelInitialized(bool successful);
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc
index c4b5b10..09a169d 100644
--- a/remoting/protocol/protocol_mock_objects.cc
+++ b/remoting/protocol/protocol_mock_objects.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
#include "remoting/protocol/protocol_mock_objects.h"
#include "base/message_loop_proxy.h"
+#include "net/base/ip_endpoint.h"
namespace remoting {
namespace protocol {
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 94a4868..ea79d72 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -7,6 +7,7 @@
#include <string>
+#include "net/base/ip_endpoint.h"
#include "remoting/proto/internal.pb.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/connection_to_client.h"
@@ -48,6 +49,9 @@ class MockConnectionToClientEventHandler :
Session::Error error));
MOCK_METHOD2(OnSequenceNumberUpdated, void(ConnectionToClient* connection,
int64 sequence_number));
+ MOCK_METHOD3(OnClientIpAddress, void(ConnectionToClient* connection,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point));
private:
DISALLOW_COPY_AND_ASSIGN(MockConnectionToClientEventHandler);