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

Unified Diff: remoting/host/desktop_environment.cc

Issue 9617027: Chromoting: Implemented security attention sequence (SAS) emulation on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 years, 9 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/desktop_environment.cc
diff --git a/remoting/host/desktop_environment.cc b/remoting/host/desktop_environment.cc
index fbf4ffc19785745de90647b6a209b2dad774f400..bd8855f8a354c627cd439770a6c1f3e36bfa496e 100644
--- a/remoting/host/desktop_environment.cc
+++ b/remoting/host/desktop_environment.cc
@@ -6,39 +6,85 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "ipc/ipc_channel_proxy.h"
+#include "ipc/ipc_message.h"
+
#include "remoting/host/capturer.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/event_executor.h"
+namespace {
+
+// Name of the chromoting service IPC channel.
+const char kChromotingSessionChannelName[] = "chromoting_session";
+
+} // namespace
+
namespace remoting {
// static
-DesktopEnvironment* DesktopEnvironment::Create(ChromotingHostContext* context) {
- scoped_ptr<Capturer> capturer(Capturer::Create());
- scoped_ptr<EventExecutor> event_executor(
- EventExecutor::Create(context->desktop_message_loop(), capturer.get()));
-
- if (capturer.get() == NULL || event_executor.get() == NULL) {
- LOG(ERROR) << "Unable to create DesktopEnvironment";
- return NULL;
+scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create(
+ ChromotingHostContext* context) {
+ scoped_ptr<DesktopEnvironment> desktop_environment(
+ new DesktopEnvironment(context));
+
+ if (!desktop_environment->Initialize()) {
+ desktop_environment.reset(NULL);
}
- return new DesktopEnvironment(context,
- capturer.release(),
- event_executor.release());
+ return desktop_environment;
}
-DesktopEnvironment::DesktopEnvironment(ChromotingHostContext* context,
- Capturer* capturer,
- EventExecutor* event_executor)
- : host_(NULL),
- context_(context),
- capturer_(capturer),
- event_executor_(event_executor) {
+// static
+scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateFake(
+ ChromotingHostContext* context,
+ Capturer* capturer,
+ EventExecutor* event_executor)
+{
+ scoped_ptr<DesktopEnvironment> desktop_environment(
+ new DesktopEnvironment(context));
+
+ desktop_environment->capturer_.reset(capturer);
+ desktop_environment->event_executor_.reset(event_executor);
+ return desktop_environment;
+}
+
+DesktopEnvironment::DesktopEnvironment(ChromotingHostContext* context)
+ : context_(context) {
}
DesktopEnvironment::~DesktopEnvironment() {
}
+bool DesktopEnvironment::Initialize() {
+ DCHECK(context_ != NULL);
+
+ // Attempt to establish an IPC connection to the Chromoting service.
+ if (context_->io_message_loop()) {
+ chromoting_session_.reset(new IPC::ChannelProxy(
+ kChromotingSessionChannelName,
+ IPC::Channel::MODE_CLIENT,
+ this,
+ context_->io_message_loop()));
+ }
+
+ capturer_.reset(Capturer::Create());
+ event_executor_.reset(EventExecutor::Create(context_->desktop_message_loop(),
+ chromoting_session_.get(),
+ capturer_.get()));
+
+ if (capturer_.get() == NULL || event_executor_.get() == NULL) {
+ LOG(ERROR) << "Unable to initialize DesktopEnvironment";
+ return false;
+ }
+
+ return true;
+}
+
+bool DesktopEnvironment::OnMessageReceived(const IPC::Message& message) {
+ return false;
+}
+
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698