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; | |
27 | 26 |
28 class HostUserInterface : public HostStatusObserver { | 27 class HostUserInterface : public HostStatusObserver { |
29 public: | 28 public: |
30 HostUserInterface( | 29 HostUserInterface( |
31 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 30 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
32 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
33 const UiStrings& ui_strings); | 32 const UiStrings& ui_strings); |
34 virtual ~HostUserInterface(); | 33 virtual ~HostUserInterface(); |
35 | 34 |
36 // Initialize the OS-specific UI objects. | 35 // Initialize the OS-specific UI objects. |
(...skipping 29 matching lines...) Expand all Loading... |
66 void DisconnectSession() const; | 65 void DisconnectSession() const; |
67 | 66 |
68 virtual void ProcessOnClientAuthenticated(const std::string& username); | 67 virtual void ProcessOnClientAuthenticated(const std::string& username); |
69 virtual void ProcessOnClientDisconnected(); | 68 virtual void ProcessOnClientDisconnected(); |
70 | 69 |
71 ChromotingHost* host_; | 70 ChromotingHost* host_; |
72 | 71 |
73 // Used to ask the host to disconnect the session. | 72 // Used to ask the host to disconnect the session. |
74 base::Closure disconnect_callback_; | 73 base::Closure disconnect_callback_; |
75 | 74 |
76 // Provide a user interface allowing the host user to close the connection. | |
77 scoped_ptr<DisconnectWindow> disconnect_window_; | |
78 | |
79 private: | 75 private: |
80 // Invoked from the UI thread when the user clicks on the Disconnect button | 76 // Invoked from the UI thread when the user clicks on the Disconnect button |
81 // to disconnect the session. | 77 // to disconnect the session. |
82 void OnDisconnectCallback(); | 78 void OnDisconnectCallback(); |
83 | 79 |
84 // The JID of the currently-authenticated user (or an empty string if no user | 80 // The JID of the currently-authenticated user (or an empty string if no user |
85 // is connected). | 81 // is connected). |
86 std::string authenticated_jid_; | 82 std::string authenticated_jid_; |
87 | 83 |
88 // Thread on which the ChromotingHost processes network events. | 84 // Thread on which the ChromotingHost processes network events. |
89 // Notifications from the host, and some calls into it, use this thread. | 85 // Notifications from the host, and some calls into it, use this thread. |
90 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 86 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
91 | 87 |
92 // Thread on which to run the user interface. | 88 // Thread on which to run the user interface. |
93 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
94 | 90 |
95 // TODO(alexeypa): move |ui_strings_| to DesktopEnvironmentFactory. | 91 // TODO(alexeypa): move |ui_strings_| to DesktopEnvironmentFactory. |
96 UiStrings ui_strings_; | 92 UiStrings ui_strings_; |
97 | 93 |
98 // WeakPtr used to avoid tasks accessing the client after it is deleted. | 94 // WeakPtr used to avoid tasks accessing the client after it is deleted. |
99 base::WeakPtrFactory<HostUserInterface> weak_factory_; | 95 base::WeakPtrFactory<HostUserInterface> weak_factory_; |
100 base::WeakPtr<HostUserInterface> weak_ptr_; | 96 base::WeakPtr<HostUserInterface> weak_ptr_; |
101 | 97 |
102 DISALLOW_COPY_AND_ASSIGN(HostUserInterface); | 98 DISALLOW_COPY_AND_ASSIGN(HostUserInterface); |
103 }; | 99 }; |
104 | 100 |
105 } // namespace remoting | 101 } // namespace remoting |
106 | 102 |
107 #endif // REMOTING_HOST_HOST_USER_INTERFACE_H_ | 103 #endif // REMOTING_HOST_HOST_USER_INTERFACE_H_ |
OLD | NEW |