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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/desktop_environment.h" 5 #include "remoting/host/desktop_environment.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h"
10 #include "ipc/ipc_channel_proxy.h"
11 #include "ipc/ipc_message.h"
12
9 #include "remoting/host/capturer.h" 13 #include "remoting/host/capturer.h"
10 #include "remoting/host/chromoting_host.h" 14 #include "remoting/host/chromoting_host.h"
11 #include "remoting/host/chromoting_host_context.h" 15 #include "remoting/host/chromoting_host_context.h"
12 #include "remoting/host/event_executor.h" 16 #include "remoting/host/event_executor.h"
13 17
18 namespace {
19
20 // Name of the chromoting service IPC channel.
21 const char kChromotingSessionChannelName[] = "chromoting_session";
22
23 } // namespace
24
14 namespace remoting { 25 namespace remoting {
15 26
16 // static 27 // static
17 DesktopEnvironment* DesktopEnvironment::Create(ChromotingHostContext* context) { 28 scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create(
18 scoped_ptr<Capturer> capturer(Capturer::Create()); 29 ChromotingHostContext* context) {
19 scoped_ptr<EventExecutor> event_executor( 30 scoped_ptr<DesktopEnvironment> desktop_environment(
20 EventExecutor::Create(context->desktop_message_loop(), capturer.get())); 31 new DesktopEnvironment(context));
21 32
22 if (capturer.get() == NULL || event_executor.get() == NULL) { 33 if (!desktop_environment->Initialize()) {
23 LOG(ERROR) << "Unable to create DesktopEnvironment"; 34 desktop_environment.reset(NULL);
24 return NULL;
25 } 35 }
26 36
27 return new DesktopEnvironment(context, 37 return desktop_environment;
28 capturer.release(),
29 event_executor.release());
30 } 38 }
31 39
32 DesktopEnvironment::DesktopEnvironment(ChromotingHostContext* context, 40 // static
33 Capturer* capturer, 41 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateFake(
34 EventExecutor* event_executor) 42 ChromotingHostContext* context,
35 : host_(NULL), 43 Capturer* capturer,
36 context_(context), 44 EventExecutor* event_executor)
37 capturer_(capturer), 45 {
38 event_executor_(event_executor) { 46 scoped_ptr<DesktopEnvironment> desktop_environment(
47 new DesktopEnvironment(context));
48
49 desktop_environment->capturer_.reset(capturer);
50 desktop_environment->event_executor_.reset(event_executor);
51 return desktop_environment;
52 }
53
54 DesktopEnvironment::DesktopEnvironment(ChromotingHostContext* context)
55 : context_(context) {
39 } 56 }
40 57
41 DesktopEnvironment::~DesktopEnvironment() { 58 DesktopEnvironment::~DesktopEnvironment() {
42 } 59 }
43 60
61 bool DesktopEnvironment::Initialize() {
62 DCHECK(context_ != NULL);
63
64 // Attempt to establish an IPC connection to the Chromoting service.
65 if (context_->io_message_loop()) {
66 chromoting_session_.reset(new IPC::ChannelProxy(
67 kChromotingSessionChannelName,
68 IPC::Channel::MODE_CLIENT,
69 this,
70 context_->io_message_loop()));
71 }
72
73 capturer_.reset(Capturer::Create());
74 event_executor_.reset(EventExecutor::Create(context_->desktop_message_loop(),
75 chromoting_session_.get(),
76 capturer_.get()));
77
78 if (capturer_.get() == NULL || event_executor_.get() == NULL) {
79 LOG(ERROR) << "Unable to initialize DesktopEnvironment";
80 return false;
81 }
82
83 return true;
84 }
85
86 bool DesktopEnvironment::OnMessageReceived(const IPC::Message& message) {
87 return false;
88 }
89
44 } // namespace remoting 90 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698