Infer appropriate GNU_STACK alignment for a shared library.
[chromium-blink-merge.git] / remoting / host / continue_window.cc
blob35a7f90b554ce332bef7f211dd7cf812c14992d6
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.
5 #include "remoting/host/continue_window.h"
7 #include "base/location.h"
8 #include "remoting/host/client_session_control.h"
10 // Minutes before the local user should confirm that the session should go on.
11 const int kSessionExpirationTimeoutMinutes = 10;
13 // Minutes before the session will be disconnected (from the moment the Continue
14 // window has been shown).
15 const int kSessionDisconnectTimeoutMinutes = 1;
17 namespace remoting {
19 ContinueWindow::~ContinueWindow() {
22 void ContinueWindow::Start(
23 const base::WeakPtr<ClientSessionControl>& client_session_control) {
24 DCHECK(CalledOnValidThread());
25 DCHECK(!client_session_control_.get());
26 DCHECK(client_session_control.get());
28 client_session_control_ = client_session_control;
30 session_expired_timer_.Start(
31 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes),
32 this, &ContinueWindow::OnSessionExpired);
35 void ContinueWindow::ContinueSession() {
36 DCHECK(CalledOnValidThread());
38 disconnect_timer_.Stop();
40 if (!client_session_control_.get())
41 return;
43 // Hide the Continue window and resume the session.
44 HideUi();
45 client_session_control_->SetDisableInputs(false);
47 session_expired_timer_.Start(
48 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes),
49 this, &ContinueWindow::OnSessionExpired);
52 void ContinueWindow::DisconnectSession() {
53 DCHECK(CalledOnValidThread());
55 disconnect_timer_.Stop();
56 if (client_session_control_.get())
57 client_session_control_->DisconnectSession();
60 ContinueWindow::ContinueWindow() {
63 void ContinueWindow::OnSessionExpired() {
64 DCHECK(CalledOnValidThread());
66 if (!client_session_control_.get())
67 return;
69 // Stop the remote input while the Continue window is shown.
70 client_session_control_->SetDisableInputs(true);
72 // Show the Continue window and wait for the local user input.
73 ShowUi();
74 disconnect_timer_.Start(
75 FROM_HERE, base::TimeDelta::FromMinutes(kSessionDisconnectTimeoutMinutes),
76 this, &ContinueWindow::DisconnectSession);
79 } // namespace remoting