blob: 71619eaf5360135c169527bffd6b83197d9226ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
#define REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "remoting/host/host_user_interface.h"
namespace remoting {
class ContinueWindow;
// This class implements the IT2Me-specific parts of the ChromotingHost:
// Disconnect and Continue window popups.
// IT2Me-specific handling of multiple connection attempts.
class It2MeHostUserInterface : public HostUserInterface {
public:
It2MeHostUserInterface(ChromotingHostContext* context);
virtual ~It2MeHostUserInterface();
virtual void Start(ChromotingHost* host,
const base::Closure& disconnect_callback) OVERRIDE;
// HostStatusObserver implementation. These methods will be called from the
// network thread.
virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
protected:
virtual void ProcessOnClientAuthenticated(
const std::string& username) OVERRIDE;
virtual void ProcessOnClientDisconnected() OVERRIDE;
private:
class TimerTask;
// Allow ChromotingHostTest::SetUp() to call StartForTest().
friend class ChromotingHostTest;
// Used by unit-tests as an alternative to Start() so that mock versions of
// internal objects can be used.
void StartForTest(
ChromotingHost* host,
const base::Closure& disconnect_callback,
scoped_ptr<DisconnectWindow> disconnect_window,
scoped_ptr<ContinueWindow> continue_window,
scoped_ptr<LocalInputMonitor> local_input_monitor);
// Called by the ContinueWindow implementation (on the UI thread) when the
// user dismisses the Continue prompt.
void ContinueSession(bool continue_session);
void OnContinueWindowTimer();
void OnShutdownHostTimer();
// Show or hide the Continue Sharing window on the UI thread.
void ShowContinueWindow(bool show);
void StartContinueWindowTimer(bool start);
// Provide a user interface requiring the user to periodically re-confirm
// the connection.
scoped_ptr<ContinueWindow> continue_window_;
// Weak pointer factory used to abandon the "continue session" timer when
// hiding the "continue session" dialog, or tearing down the IT2Me UI.
base::WeakPtrFactory<It2MeHostUserInterface> timer_weak_factory_;
DISALLOW_COPY_AND_ASSIGN(It2MeHostUserInterface);
};
} // namespace remoting
#endif // REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
|