summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 00:46:01 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 00:46:01 +0000
commitd87c404738c7c89968ee01353d71d3a31f91669f (patch)
tree91e581d1d29cbcb64f22634961bb212b674ed1c7 /remoting/host
parentde9bdd1e4d2f87f53b1c2d3eacfbe43ef6ca1019 (diff)
downloadchromium_src-d87c404738c7c89968ee01353d71d3a31f91669f.zip
chromium_src-d87c404738c7c89968ee01353d71d3a31f91669f.tar.gz
chromium_src-d87c404738c7c89968ee01353d71d3a31f91669f.tar.bz2
Move protocol classes to the remoting::protocol namespace
BUG=None TEST=compiles Review URL: http://codereview.chromium.org/4233005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/chromoting_host.cc17
-rw-r--r--remoting/host/chromoting_host.h18
-rw-r--r--remoting/host/client_connection.cc2
-rw-r--r--remoting/host/client_connection.h2
-rw-r--r--remoting/host/client_connection_unittest.cc6
-rw-r--r--remoting/host/mock_objects.h4
-rw-r--r--remoting/host/session_manager.cc20
-rw-r--r--remoting/host/session_manager.h18
-rw-r--r--remoting/host/session_manager_unittest.cc4
9 files changed, 54 insertions, 37 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 4a75d52..89389a6 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -134,7 +134,7 @@ void ChromotingHost::Shutdown() {
}
// This method is called if a client is connected to this object.
-void ChromotingHost::OnClientConnected(ClientConnection* client) {
+void ChromotingHost::OnClientConnected(protocol::ClientConnection* client) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
// Create a new RecordSession if there was none.
@@ -158,7 +158,7 @@ void ChromotingHost::OnClientConnected(ClientConnection* client) {
VLOG(1) << "Session manager started";
}
-void ChromotingHost::OnClientDisconnected(ClientConnection* client) {
+void ChromotingHost::OnClientDisconnected(protocol::ClientConnection* client) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
// Remove the client from the session manager and pause the session.
@@ -176,8 +176,8 @@ void ChromotingHost::OnClientDisconnected(ClientConnection* client) {
}
////////////////////////////////////////////////////////////////////////////
-// ClientConnection::EventHandler implementations
-void ChromotingHost::HandleMessage(ClientConnection* client,
+// protocol::ClientConnection::EventHandler implementations
+void ChromotingHost::HandleMessage(protocol::ClientConnection* client,
ChromotingClientMessage* message) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
@@ -187,7 +187,7 @@ void ChromotingHost::HandleMessage(ClientConnection* client,
executor_->HandleInputEvent(message);
}
-void ChromotingHost::OnConnectionOpened(ClientConnection* client) {
+void ChromotingHost::OnConnectionOpened(protocol::ClientConnection* client) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
// Completes the client connection.
@@ -195,14 +195,14 @@ void ChromotingHost::OnConnectionOpened(ClientConnection* client) {
OnClientConnected(client_.get());
}
-void ChromotingHost::OnConnectionClosed(ClientConnection* client) {
+void ChromotingHost::OnConnectionClosed(protocol::ClientConnection* client) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
VLOG(1) << "Connection to client closed.";
OnClientDisconnected(client_.get());
}
-void ChromotingHost::OnConnectionFailed(ClientConnection* client) {
+void ChromotingHost::OnConnectionFailed(protocol::ClientConnection* client) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
LOG(ERROR) << "Connection failed unexpectedly.";
@@ -281,7 +281,7 @@ void ChromotingHost::OnNewClientSession(
// If we accept the connected then create a client object and set the
// callback.
- client_ = new ClientConnection(context_->main_message_loop(), this);
+ client_ = new protocol::ClientConnection(context_->main_message_loop(), this);
client_->Init(session);
}
@@ -308,5 +308,4 @@ Encoder* ChromotingHost::CreateEncoder(const ChromotocolConfig* config) {
return NULL;
}
-
} // namespace remoting
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index b091cb3..04b0d2b 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -56,7 +56,7 @@ class SessionManager;
// return to the idle state. We then go to step (2) if there a new
// incoming connection.
class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
- public ClientConnection::EventHandler,
+ public protocol::ClientConnection::EventHandler,
public JingleClient::Callback {
public:
ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config,
@@ -78,18 +78,18 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
void Shutdown();
// This method is called if a client is connected to this object.
- void OnClientConnected(ClientConnection* client);
+ void OnClientConnected(protocol::ClientConnection* client);
// This method is called if a client is disconnected from the host.
- void OnClientDisconnected(ClientConnection* client);
+ void OnClientDisconnected(protocol::ClientConnection* client);
////////////////////////////////////////////////////////////////////////////
- // ClientConnection::EventHandler implementations
- virtual void HandleMessage(ClientConnection* client,
+ // protocol::ClientConnection::EventHandler implementations
+ virtual void HandleMessage(protocol::ClientConnection* client,
ChromotingClientMessage* message);
- virtual void OnConnectionOpened(ClientConnection* client);
- virtual void OnConnectionClosed(ClientConnection* client);
- virtual void OnConnectionFailed(ClientConnection* client);
+ virtual void OnConnectionOpened(protocol::ClientConnection* client);
+ virtual void OnConnectionClosed(protocol::ClientConnection* client);
+ virtual void OnConnectionFailed(protocol::ClientConnection* client);
////////////////////////////////////////////////////////////////////////////
// JingleClient::Callback implementations
@@ -145,7 +145,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
// A ClientConnection manages the connectino to a remote client.
// TODO(hclam): Expand this to a list of clients.
- scoped_refptr<ClientConnection> client_;
+ scoped_refptr<protocol::ClientConnection> client_;
// Session manager for the host process.
scoped_refptr<SessionManager> session_;
diff --git a/remoting/host/client_connection.cc b/remoting/host/client_connection.cc
index 3a769326..779e630 100644
--- a/remoting/host/client_connection.cc
+++ b/remoting/host/client_connection.cc
@@ -11,6 +11,7 @@
#include "remoting/protocol/util.h"
namespace remoting {
+namespace protocol {
// Determine how many update streams we should count to find the size of
// average update stream.
@@ -136,4 +137,5 @@ void ClientConnection::MessageReceivedTask(ChromotingClientMessage* message) {
void ClientConnection::OnClosed() {
}
+} // namespace protocol
} // namespace remoting
diff --git a/remoting/host/client_connection.h b/remoting/host/client_connection.h
index f5e05c1..50589e69 100644
--- a/remoting/host/client_connection.h
+++ b/remoting/host/client_connection.h
@@ -18,6 +18,7 @@
#include "remoting/protocol/video_writer.h"
namespace remoting {
+namespace protocol {
// This class represents a remote viewer connected to the chromoting host
// through a libjingle connection. A viewer object is responsible for sending
@@ -114,6 +115,7 @@ class ClientConnection : public base::RefCountedThreadSafe<ClientConnection> {
DISALLOW_COPY_AND_ASSIGN(ClientConnection);
};
+} // namespace protocol
} // namespace remoting
#endif // REMOTING_HOST_CLIENT_CONNECTION_H_
diff --git a/remoting/host/client_connection_unittest.cc b/remoting/host/client_connection_unittest.cc
index 7c043bb..8f522db 100644
--- a/remoting/host/client_connection_unittest.cc
+++ b/remoting/host/client_connection_unittest.cc
@@ -26,7 +26,7 @@ class ClientConnectionTest : public testing::Test {
session_->set_message_loop(&message_loop_);
// Allocate a ClientConnection object with the mock objects.
- viewer_ = new ClientConnection(&message_loop_, &handler_);
+ viewer_ = new protocol::ClientConnection(&message_loop_, &handler_);
viewer_->Init(session_);
EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get()));
session_->state_change_callback()->Run(
@@ -35,8 +35,8 @@ class ClientConnectionTest : public testing::Test {
}
MessageLoop message_loop_;
- MockClientConnectionEventHandler handler_;
- scoped_refptr<ClientConnection> viewer_;
+ protocol::MockClientConnectionEventHandler handler_;
+ scoped_refptr<protocol::ClientConnection> viewer_;
scoped_refptr<protocol::FakeSession> session_;
diff --git a/remoting/host/mock_objects.h b/remoting/host/mock_objects.h
index 79b8d6f..a28f32d 100644
--- a/remoting/host/mock_objects.h
+++ b/remoting/host/mock_objects.h
@@ -41,6 +41,8 @@ class MockEventExecutor : public EventExecutor {
DISALLOW_COPY_AND_ASSIGN(MockEventExecutor);
};
+namespace protocol {
+
class MockClientConnection : public ClientConnection {
public:
MockClientConnection(){}
@@ -70,6 +72,8 @@ class MockClientConnectionEventHandler : public ClientConnection::EventHandler {
DISALLOW_COPY_AND_ASSIGN(MockClientConnectionEventHandler);
};
+} // namespace protocol
+
} // namespace remoting
#endif // REMOTING_HOST_MOCK_OBJECTS_H_
diff --git a/remoting/host/session_manager.cc b/remoting/host/session_manager.cc
index 1867f07..68458bc 100644
--- a/remoting/host/session_manager.cc
+++ b/remoting/host/session_manager.cc
@@ -74,14 +74,16 @@ void SessionManager::SetMaxRate(double rate) {
FROM_HERE, NewTracedMethod(this, &SessionManager::DoSetMaxRate, rate));
}
-void SessionManager::AddClient(scoped_refptr<ClientConnection> client) {
+void SessionManager::AddClient(
+ scoped_refptr<protocol::ClientConnection> client) {
// Gets the init information for the client.
capture_loop_->PostTask(
FROM_HERE,
NewTracedMethod(this, &SessionManager::DoGetInitInfo, client));
}
-void SessionManager::RemoveClient(scoped_refptr<ClientConnection> client) {
+void SessionManager::RemoveClient(
+ scoped_refptr<protocol::ClientConnection> client) {
network_loop_->PostTask(
FROM_HERE,
NewTracedMethod(this, &SessionManager::DoRemoveClient, client));
@@ -243,7 +245,8 @@ void SessionManager::DoFinishEncode() {
DoCapture();
}
-void SessionManager::DoGetInitInfo(scoped_refptr<ClientConnection> client) {
+void SessionManager::DoGetInitInfo(
+ scoped_refptr<protocol::ClientConnection> client) {
DCHECK_EQ(capture_loop_, MessageLoop::current());
ScopedTracer tracer("init");
@@ -342,22 +345,25 @@ void SessionManager::DoSendVideoPacket(VideoPacket* packet) {
TraceContext::tracer()->PrintString("DoSendUpdate done");
}
-void SessionManager::DoSendInit(scoped_refptr<ClientConnection> client,
- int width, int height) {
+void SessionManager::DoSendInit(
+ scoped_refptr<protocol::ClientConnection> client,
+ int width, int height) {
DCHECK_EQ(network_loop_, MessageLoop::current());
// Sends the client init information.
client->SendInitClientMessage(width, height);
}
-void SessionManager::DoAddClient(scoped_refptr<ClientConnection> client) {
+void SessionManager::DoAddClient(
+ scoped_refptr<protocol::ClientConnection> client) {
DCHECK_EQ(network_loop_, MessageLoop::current());
// TODO(hclam): Force a full frame for next encode.
clients_.push_back(client);
}
-void SessionManager::DoRemoveClient(scoped_refptr<ClientConnection> client) {
+void SessionManager::DoRemoveClient(
+ scoped_refptr<protocol::ClientConnection> client) {
DCHECK_EQ(network_loop_, MessageLoop::current());
// TODO(hclam): Is it correct to do to a scoped_refptr?
diff --git a/remoting/host/session_manager.h b/remoting/host/session_manager.h
index fedfc4f..c58ef32 100644
--- a/remoting/host/session_manager.h
+++ b/remoting/host/session_manager.h
@@ -19,7 +19,10 @@
namespace remoting {
class CaptureData;
+
+namespace protocol {
class ClientConnection;
+} // namespace protocol
// A class for controlling and coordinate Capturer, Encoder
// and NetworkChannel in a record session.
@@ -84,10 +87,10 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
void SetMaxRate(double rate);
// Add a client to this recording session.
- void AddClient(scoped_refptr<ClientConnection> client);
+ void AddClient(scoped_refptr<protocol::ClientConnection> client);
// Remove a client from receiving screen updates.
- void RemoveClient(scoped_refptr<ClientConnection> client);
+ void RemoveClient(scoped_refptr<protocol::ClientConnection> client);
// Remove all clients.
void RemoveAllClients();
@@ -112,7 +115,7 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data);
void DoFinishEncode();
- void DoGetInitInfo(scoped_refptr<ClientConnection> client);
+ void DoGetInitInfo(scoped_refptr<protocol::ClientConnection> client);
// Network thread -----------------------------------------------------------
@@ -126,11 +129,11 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
// DoSendUpdate takes ownership of header and is responsible for deleting it.
void DoSendVideoPacket(VideoPacket* packet);
- void DoSendInit(scoped_refptr<ClientConnection> client,
+ void DoSendInit(scoped_refptr<protocol::ClientConnection> client,
int width, int height);
- void DoAddClient(scoped_refptr<ClientConnection> client);
- void DoRemoveClient(scoped_refptr<ClientConnection> client);
+ void DoAddClient(scoped_refptr<protocol::ClientConnection> client);
+ void DoRemoveClient(scoped_refptr<protocol::ClientConnection> client);
void DoRemoveAllClients();
// Encoder thread -----------------------------------------------------------
@@ -158,7 +161,8 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
// This member is always accessed on the NETWORK thread.
// TODO(hclam): Have to scoped_refptr the clients since they have a shorter
// lifetime than this object.
- typedef std::vector<scoped_refptr<ClientConnection> > ClientConnectionList;
+ typedef std::vector<scoped_refptr<protocol::ClientConnection> >
+ ClientConnectionList;
ClientConnectionList clients_;
// The following members are accessed on the capture thread.
diff --git a/remoting/host/session_manager_unittest.cc b/remoting/host/session_manager_unittest.cc
index f3870e2..7291c3e 100644
--- a/remoting/host/session_manager_unittest.cc
+++ b/remoting/host/session_manager_unittest.cc
@@ -32,7 +32,7 @@ class SessionManagerTest : public testing::Test {
void Init() {
capturer_ = new MockCapturer();
encoder_ = new MockEncoder();
- client_ = new MockClientConnection();
+ client_ = new protocol::MockClientConnection();
record_ = new SessionManager(&message_loop_,
&message_loop_,
&message_loop_,
@@ -41,7 +41,7 @@ class SessionManagerTest : public testing::Test {
}
scoped_refptr<SessionManager> record_;
- scoped_refptr<MockClientConnection> client_;
+ scoped_refptr<protocol::MockClientConnection> client_;
MockCapturer* capturer_;
MockEncoder* encoder_;
MessageLoop message_loop_;