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

Side by Side Diff: remoting/host/continue_window.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: 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
OLDNEW
(Empty)
1 // Copyright 2013 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/continue_window.h"
6
7 #include "base/location.h"
8 #include "remoting/host/client_session_control.h"
9
10 // Minutes before the local user should confirm that the session should go on.
11 const int kSessionExpirationTimeoutMinutes = 10;
Sergey Ulanov 2013/04/04 21:04:26 move these constants to anonymous namespace
alexeypa (please no reviews) 2013/04/06 18:07:56 Constants have local scope by default. There is no
12
13 // Minutes before the session will be disconnected (from the moment the Continue
14 // window has been shown).
15 const int kSessionDisconnectTimeoutMinutes = 1;
16
17 namespace remoting {
18
19 ContinueWindow::~ContinueWindow() {
20 DCHECK(CalledOnValidThread());
Sergey Ulanov 2013/04/04 21:04:26 NonThreadSafe destructor has the same DCHECK, no n
alexeypa (please no reviews) 2013/04/06 18:07:56 Done.
21 }
22
23 void ContinueWindow::Start(
24 const base::WeakPtr<ClientSessionControl>& client_session_control) {
25 DCHECK(CalledOnValidThread());
26 DCHECK(!client_session_control_);
27 DCHECK(client_session_control);
28
29 client_session_control_ = client_session_control;
30
31 session_expired_timer_.Start(
32 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes),
33 this, &ContinueWindow::OnSessionExpired);
34 }
35
36 void ContinueWindow::ContinueSession() {
37 DCHECK(CalledOnValidThread());
38
39 disconnect_timer_.Stop();
40
41 if (!client_session_control_)
42 return;
43
44 // Hide the Continue window and resume the session.
45 HideUi();
46 client_session_control_->SetDisableInputs(false);
47
48 session_expired_timer_.Start(
49 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes),
50 this, &ContinueWindow::OnSessionExpired);
51 }
52
53 void ContinueWindow::DisconnectSession() {
Sergey Ulanov 2013/04/04 21:04:26 Maybe OnDisconnectTimer()?
alexeypa (please no reviews) 2013/04/06 18:07:56 The primary purpose if this API is to be called by
54 DCHECK(CalledOnValidThread());
55
56 disconnect_timer_.Stop();
57 if (client_session_control_)
58 client_session_control_->DisconnectSession();
59 }
60
61 ContinueWindow::ContinueWindow() {
62 disconnect_timer_.Stop();
63 session_expired_timer_.Stop();
64 }
65
66 void ContinueWindow::OnSessionExpired() {
67 DCHECK(CalledOnValidThread());
68
69 if (!client_session_control_)
70 return;
71
72 // Stop the remote input while the Continue window is shown.
73 client_session_control_->SetDisableInputs(true);
74
75 // Show the Continue window and wait for the local user input.
76 ShowUi();
77 disconnect_timer_.Start(
78 FROM_HERE, base::TimeDelta::FromMinutes(kSessionDisconnectTimeoutMinutes),
79 this, &ContinueWindow::DisconnectSession);
80 }
81
82 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698