OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef REMOTING_HOST_HOST_USER_INTERFACE_H_ | 5 #ifndef REMOTING_HOST_HOST_USER_INTERFACE_H_ |
6 #define REMOTING_HOST_HOST_USER_INTERFACE_H_ | 6 #define REMOTING_HOST_HOST_USER_INTERFACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "remoting/host/host_status_observer.h" | 16 #include "remoting/host/host_status_observer.h" |
17 #include "remoting/host/ui_strings.h" | 17 #include "remoting/host/ui_strings.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
21 } // namespace base | 21 } // namespace base |
22 | 22 |
23 namespace remoting { | 23 namespace remoting { |
24 | 24 |
25 class ChromotingHost; | 25 class ChromotingHost; |
26 class DisconnectWindow; | 26 class DisconnectWindow; |
27 class LocalInputMonitor; | |
28 | 27 |
29 class HostUserInterface : public HostStatusObserver { | 28 class HostUserInterface : public HostStatusObserver { |
30 public: | 29 public: |
31 HostUserInterface( | 30 HostUserInterface( |
32 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 31 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 32 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
34 const UiStrings& ui_strings); | 33 const UiStrings& ui_strings); |
35 virtual ~HostUserInterface(); | 34 virtual ~HostUserInterface(); |
36 | 35 |
37 // Initialize the OS-specific UI objects. | 36 // Initialize the OS-specific UI objects. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 virtual void ProcessOnClientDisconnected(); | 69 virtual void ProcessOnClientDisconnected(); |
71 | 70 |
72 ChromotingHost* host_; | 71 ChromotingHost* host_; |
73 | 72 |
74 // Used to ask the host to disconnect the session. | 73 // Used to ask the host to disconnect the session. |
75 base::Closure disconnect_callback_; | 74 base::Closure disconnect_callback_; |
76 | 75 |
77 // Provide a user interface allowing the host user to close the connection. | 76 // Provide a user interface allowing the host user to close the connection. |
78 scoped_ptr<DisconnectWindow> disconnect_window_; | 77 scoped_ptr<DisconnectWindow> disconnect_window_; |
79 | 78 |
80 // Monitor local inputs to allow remote inputs to be blocked while the local | |
81 // user is trying to do something. | |
82 scoped_ptr<LocalInputMonitor> local_input_monitor_; | |
83 | |
84 private: | 79 private: |
85 // Invoked from the UI thread when the user clicks on the Disconnect button | 80 // Invoked from the UI thread when the user clicks on the Disconnect button |
86 // to disconnect the session. | 81 // to disconnect the session. |
87 void OnDisconnectCallback(); | 82 void OnDisconnectCallback(); |
88 | 83 |
89 void MonitorLocalInputs(bool enable); | |
90 | |
91 // The JID of the currently-authenticated user (or an empty string if no user | 84 // The JID of the currently-authenticated user (or an empty string if no user |
92 // is connected). | 85 // is connected). |
93 std::string authenticated_jid_; | 86 std::string authenticated_jid_; |
94 | 87 |
95 // Thread on which the ChromotingHost processes network events. | 88 // Thread on which the ChromotingHost processes network events. |
96 // Notifications from the host, and some calls into it, use this thread. | 89 // Notifications from the host, and some calls into it, use this thread. |
97 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
98 | 91 |
99 // Thread on which to run the user interface. | 92 // Thread on which to run the user interface. |
100 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
101 | 94 |
102 bool is_monitoring_local_inputs_; | |
103 | |
104 // TODO(alexeypa): move |ui_strings_| to DesktopEnvironmentFactory. | 95 // TODO(alexeypa): move |ui_strings_| to DesktopEnvironmentFactory. |
105 UiStrings ui_strings_; | 96 UiStrings ui_strings_; |
106 | 97 |
107 // WeakPtr used to avoid tasks accessing the client after it is deleted. | 98 // WeakPtr used to avoid tasks accessing the client after it is deleted. |
108 base::WeakPtrFactory<HostUserInterface> weak_factory_; | 99 base::WeakPtrFactory<HostUserInterface> weak_factory_; |
109 base::WeakPtr<HostUserInterface> weak_ptr_; | 100 base::WeakPtr<HostUserInterface> weak_ptr_; |
110 | 101 |
111 DISALLOW_COPY_AND_ASSIGN(HostUserInterface); | 102 DISALLOW_COPY_AND_ASSIGN(HostUserInterface); |
112 }; | 103 }; |
113 | 104 |
114 } // namespace remoting | 105 } // namespace remoting |
115 | 106 |
116 #endif // REMOTING_HOST_HOST_USER_INTERFACE_H_ | 107 #endif // REMOTING_HOST_HOST_USER_INTERFACE_H_ |
OLD | NEW |