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/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop_proxy.h" | |
16 #include "remoting/host/host_status_observer.h" | 15 #include "remoting/host/host_status_observer.h" |
17 | 16 |
| 17 namespace base { |
| 18 class SingleThreadTaskRunner; |
| 19 } // namespace base |
| 20 |
18 namespace remoting { | 21 namespace remoting { |
19 | 22 |
20 class ChromotingHost; | 23 class ChromotingHost; |
21 class ChromotingHostContext; | 24 class ChromotingHostContext; |
22 class DisconnectWindow; | 25 class DisconnectWindow; |
23 class LocalInputMonitor; | 26 class LocalInputMonitor; |
24 class SignalStrategy; | 27 class SignalStrategy; |
25 | 28 |
26 class HostUserInterface : public HostStatusObserver { | 29 class HostUserInterface : public HostStatusObserver { |
27 public: | 30 public: |
28 HostUserInterface(ChromotingHostContext* context); | 31 HostUserInterface(ChromotingHostContext* context); |
29 virtual ~HostUserInterface(); | 32 virtual ~HostUserInterface(); |
30 | 33 |
31 virtual void Start(ChromotingHost* host, | 34 virtual void Start(ChromotingHost* host, |
32 const base::Closure& disconnect_callback); | 35 const base::Closure& disconnect_callback); |
33 | 36 |
34 // HostStatusObserver implementation. These methods will be called from the | 37 // HostStatusObserver implementation. These methods will be called from the |
35 // network thread. | 38 // network thread. |
36 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 39 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
37 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 40 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
38 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; | 41 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; |
39 virtual void OnShutdown() OVERRIDE; | 42 virtual void OnShutdown() OVERRIDE; |
40 | 43 |
41 protected: | 44 protected: |
42 const std::string& get_authenticated_jid() const { | 45 const std::string& get_authenticated_jid() const { |
43 return authenticated_jid_; | 46 return authenticated_jid_; |
44 } | 47 } |
45 ChromotingHost* get_host() const { return host_; } | 48 ChromotingHost* get_host() const { return host_; } |
46 | 49 |
47 // Message loop accessors. | 50 base::SingleThreadTaskRunner* network_task_runner() const; |
48 base::MessageLoopProxy* network_message_loop() const; | 51 base::SingleThreadTaskRunner* ui_task_runner() const; |
49 base::MessageLoopProxy* ui_message_loop() const; | |
50 | 52 |
51 // Invokes the session disconnect callback passed to Start(). | 53 // Invokes the session disconnect callback passed to Start(). |
52 void DisconnectSession() const; | 54 void DisconnectSession() const; |
53 | 55 |
54 virtual void ProcessOnClientAuthenticated(const std::string& username); | 56 virtual void ProcessOnClientAuthenticated(const std::string& username); |
55 virtual void ProcessOnClientDisconnected(); | 57 virtual void ProcessOnClientDisconnected(); |
56 | 58 |
57 // Used by unit-tests as an alternative to Start() so that mock versions of | 59 // Used by unit-tests as an alternative to Start() so that mock versions of |
58 // internal objects can be used. | 60 // internal objects can be used. |
59 void StartForTest( | 61 void StartForTest( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // WeakPtr used to avoid tasks accessing the client after it is deleted. | 100 // WeakPtr used to avoid tasks accessing the client after it is deleted. |
99 base::WeakPtrFactory<HostUserInterface> weak_factory_; | 101 base::WeakPtrFactory<HostUserInterface> weak_factory_; |
100 base::WeakPtr<HostUserInterface> weak_ptr_; | 102 base::WeakPtr<HostUserInterface> weak_ptr_; |
101 | 103 |
102 DISALLOW_COPY_AND_ASSIGN(HostUserInterface); | 104 DISALLOW_COPY_AND_ASSIGN(HostUserInterface); |
103 }; | 105 }; |
104 | 106 |
105 } // namespace remoting | 107 } // namespace remoting |
106 | 108 |
107 #endif // REMOTING_HOST_HOST_USER_INTERFACE_H_ | 109 #endif // REMOTING_HOST_HOST_USER_INTERFACE_H_ |
OLD | NEW |