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

Unified Diff: remoting/host/ipc_desktop_environment_factory.h

Issue 11028128: [Chromoting] Request the daemon to open a terminal once a connection has been accepted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feeback and rebased on top of https://chromiumcodereview.appspot.com/11017065/ Created 8 years, 2 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
Index: remoting/host/ipc_desktop_environment_factory.h
diff --git a/remoting/host/ipc_desktop_environment_factory.h b/remoting/host/ipc_desktop_environment_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..91086fb58c18f27d39e39596809e0012694930b2
--- /dev/null
+++ b/remoting/host/ipc_desktop_environment_factory.h
@@ -0,0 +1,69 @@
+// 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_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_
+#define REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_
+
+#include <map>
+
+#include "base/memory/scoped_ptr.h"
+#include "remoting/host/desktop_environment_factory.h"
+#include "remoting/host/desktop_session_connector.h"
+
+namespace IPC {
+class ChannelProxy;
+} // namespace IPC
+
+namespace remoting {
+
+class DesktopSessionConnector;
+class IpcDesktopEnvironment;
+
+// Used to create IpcDesktopEnvironment objects intergating with the desktop via
+// a helper process and talking to that process via IPC.
+class IpcDesktopEnvironmentFactory
+ : public DesktopEnvironmentFactory,
+ public DesktopSessionConnector {
+ public:
+ // Passes a reference to the IPC channel connected to the daemon process and
+ // relevant task runners. |daemon_channel| must outlive this object.
+ IpcDesktopEnvironmentFactory(
+ IPC::ChannelProxy* daemon_channel,
Wez 2012/10/17 17:51:57 nit: Is there a way to get a ref-counted or owned-
alexeypa (please no reviews) 2012/10/17 21:35:53 I don't think it is possible without a custom Chan
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
+ virtual ~IpcDesktopEnvironmentFactory();
+
+ virtual scoped_ptr<DesktopEnvironment> Create(
+ scoped_refptr<ChromotingHost> host) OVERRIDE;
+
+ // DesktopSessionConnector implementation.
+ virtual void ConnectTerminal(
+ IpcDesktopEnvironment* desktop_environment) OVERRIDE;
+ virtual void DisconnectTerminal(
+ IpcDesktopEnvironment* desktop_environment) OVERRIDE;
+ virtual void OnTerminalDisconnected(int terminal_id) OVERRIDE;
+
+ private:
+ // A list of DesktopEnvironment instances known to the daemon process.
Wez 2012/10/17 17:51:57 nit: "List of instances we've told the daemon proc
alexeypa (please no reviews) 2012/10/17 21:35:53 Done.
+ typedef std::map<int, IpcDesktopEnvironment*> ActiveConnectionsList;
+ ActiveConnectionsList active_connections_;
Wez 2012/10/17 17:51:57 nit: Move this down below the members that come fr
alexeypa (please no reviews) 2012/10/17 21:35:53 Done.
+
+ // IPC channel connected to the daemon process.
+ IPC::ChannelProxy* daemon_channel_;
+
+ // Task runner the bulk of DesktopSessionConnector implementation runs on.
Wez 2012/10/17 17:51:57 nit: Clarify this; e.g. "Used to service calls to
alexeypa (please no reviews) 2012/10/17 21:35:53 Done.
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
+
+ // Next desktop session ID. IDs are allocated sequentially starting from 0.
+ // This gives us more than 67 years of unique IDs assuming a new ID is
+ // allocated every second.
+ static int next_id_;
Wez 2012/10/17 17:51:57 nit: This doesn't need to be static, I don't think
alexeypa (please no reviews) 2012/10/17 21:35:53 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(IpcDesktopEnvironmentFactory);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698