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

Side by Side Diff: remoting/host/host_user_interface.cc

Issue 13461029: The continue window is owned by the desktop environment now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 8 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
« no previous file with comments | « remoting/host/host_user_interface.h ('k') | remoting/host/it2me_desktop_environment.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/host/host_user_interface.h"
6
7 #include "base/bind.h"
8 #include "remoting/host/chromoting_host.h"
9
10 namespace remoting {
11
12 HostUserInterface::HostUserInterface(
13 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
14 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
15 const UiStrings& ui_strings)
16 : host_(NULL),
17 network_task_runner_(network_task_runner),
18 ui_task_runner_(ui_task_runner),
19 ui_strings_(ui_strings),
20 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
21 weak_ptr_(weak_factory_.GetWeakPtr()) {
22 DCHECK(ui_task_runner_->BelongsToCurrentThread());
23 }
24
25 HostUserInterface::~HostUserInterface() {
26 DCHECK(ui_task_runner_->BelongsToCurrentThread());
27 }
28
29 void HostUserInterface::Init() {
30 DCHECK(ui_task_runner_->BelongsToCurrentThread());
31 }
32
33 void HostUserInterface::Start(ChromotingHost* host,
34 const base::Closure& disconnect_callback) {
35 DCHECK(network_task_runner_->BelongsToCurrentThread());
36 DCHECK(host_ == NULL);
37
38 host_ = host;
39 disconnect_callback_ = disconnect_callback;
40 host_->AddStatusObserver(this);
41 }
42
43 void HostUserInterface::OnClientAuthenticated(const std::string& jid) {
44 DCHECK(network_task_runner_->BelongsToCurrentThread());
45
46 authenticated_jid_ = jid;
47
48 std::string username = jid.substr(0, jid.find('/'));
49 ui_task_runner_->PostTask(FROM_HERE, base::Bind(
50 &HostUserInterface::ProcessOnClientAuthenticated,
51 weak_ptr_, username));
52 }
53
54 void HostUserInterface::OnClientDisconnected(const std::string& jid) {
55 DCHECK(network_task_runner_->BelongsToCurrentThread());
56
57 if (jid == authenticated_jid_) {
58 ui_task_runner_->PostTask(FROM_HERE, base::Bind(
59 &HostUserInterface::ProcessOnClientDisconnected,
60 weak_ptr_));
61 }
62 }
63
64 void HostUserInterface::OnAccessDenied(const std::string& jid) {
65 }
66
67 void HostUserInterface::OnShutdown() {
68 DCHECK(network_task_runner_->BelongsToCurrentThread());
69
70 // Host status observers must be removed on the network thread, so
71 // it must happen here instead of in the destructor.
72 host_->RemoveStatusObserver(this);
73 host_ = NULL;
74 }
75
76 void HostUserInterface::OnDisconnectCallback() {
77 DCHECK(ui_task_runner_->BelongsToCurrentThread());
78
79 DisconnectSession();
80 }
81
82 base::SingleThreadTaskRunner* HostUserInterface::network_task_runner() const {
83 return network_task_runner_;
84 }
85
86 base::SingleThreadTaskRunner* HostUserInterface::ui_task_runner() const {
87 return ui_task_runner_;
88 }
89
90 void HostUserInterface::DisconnectSession() const {
91 DCHECK(ui_task_runner_->BelongsToCurrentThread());
92
93 disconnect_callback_.Run();
94 }
95
96 void HostUserInterface::ProcessOnClientAuthenticated(
97 const std::string& username) {
98 DCHECK(ui_task_runner_->BelongsToCurrentThread());
99 }
100
101 void HostUserInterface::ProcessOnClientDisconnected() {
102 DCHECK(ui_task_runner_->BelongsToCurrentThread());
103 }
104
105 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_user_interface.h ('k') | remoting/host/it2me_desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698