Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: remoting/host/it2me/it2me_host.h

Issue 320403002: Pull out common code from client and host versions of LogToServer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unittests for LogToServer Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/host_status_logger_unittest.cc ('k') | remoting/host/it2me/it2me_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_IT2ME_IT2ME_HOST_H_ 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_HOST_H_
6 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 6 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "remoting/host/log_to_server.h" 12 #include "remoting/host/host_status_observer.h"
13 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 13 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
14 14
15 namespace base { 15 namespace base {
16 class DictionaryValue; 16 class DictionaryValue;
17 } 17 }
18 18
19 namespace remoting { 19 namespace remoting {
20 20
21 class ChromotingHost; 21 class ChromotingHost;
22 class ChromotingHostContext; 22 class ChromotingHostContext;
23 class DesktopEnvironmentFactory; 23 class DesktopEnvironmentFactory;
24 class HostEventLogger; 24 class HostEventLogger;
25 class HostNPScriptObject; 25 class HostNPScriptObject;
26 class HostStatusLogger;
26 class RegisterSupportHostRequest; 27 class RegisterSupportHostRequest;
27 class RsaKeyPair; 28 class RsaKeyPair;
28 29
29 namespace policy_hack { 30 namespace policy_hack {
30 31
31 class PolicyWatcher; 32 class PolicyWatcher;
32 33
33 } // namespace policy_hack 34 } // namespace policy_hack
34 35
35 // These state values are duplicated in host_session.js. Remember to update 36 // These state values are duplicated in host_session.js. Remember to update
36 // both copies when making changes. 37 // both copies when making changes.
37 enum It2MeHostState { 38 enum It2MeHostState {
38 kDisconnected, 39 kDisconnected,
39 kStarting, 40 kStarting,
40 kRequestedAccessCode, 41 kRequestedAccessCode,
41 kReceivedAccessCode, 42 kReceivedAccessCode,
42 kConnected, 43 kConnected,
43 kDisconnecting, 44 kDisconnecting,
44 kError, 45 kError,
45 kInvalidDomainError 46 kInvalidDomainError
46 }; 47 };
47 48
48 // Internal implementation of the plugin's It2Me host function. 49 // Internal implementation of the plugin's It2Me host function.
49 class It2MeHost 50 class It2MeHost : public base::RefCountedThreadSafe<It2MeHost>,
50 : public base::RefCountedThreadSafe<It2MeHost>, 51 public HostStatusObserver {
51 public HostStatusObserver {
52 public: 52 public:
53
54 class Observer { 53 class Observer {
55 public: 54 public:
56 virtual void OnClientAuthenticated(const std::string& client_username) = 0; 55 virtual void OnClientAuthenticated(const std::string& client_username) = 0;
57 virtual void OnStoreAccessCode(const std::string& access_code, 56 virtual void OnStoreAccessCode(const std::string& access_code,
58 base::TimeDelta access_code_lifetime) = 0; 57 base::TimeDelta access_code_lifetime) = 0;
59 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0; 58 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0;
60 virtual void OnStateChanged(It2MeHostState state) = 0; 59 virtual void OnStateChanged(It2MeHostState state) = 0;
61 }; 60 };
62 61
63 It2MeHost( 62 It2MeHost(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 138 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
140 base::WeakPtr<It2MeHost::Observer> observer_; 139 base::WeakPtr<It2MeHost::Observer> observer_;
141 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; 140 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
142 std::string directory_bot_jid_; 141 std::string directory_bot_jid_;
143 142
144 It2MeHostState state_; 143 It2MeHostState state_;
145 144
146 scoped_refptr<RsaKeyPair> host_key_pair_; 145 scoped_refptr<RsaKeyPair> host_key_pair_;
147 scoped_ptr<SignalStrategy> signal_strategy_; 146 scoped_ptr<SignalStrategy> signal_strategy_;
148 scoped_ptr<RegisterSupportHostRequest> register_request_; 147 scoped_ptr<RegisterSupportHostRequest> register_request_;
149 scoped_ptr<LogToServer> log_to_server_; 148 scoped_ptr<HostStatusLogger> host_status_logger_;
150 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; 149 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
151 scoped_ptr<HostEventLogger> host_event_logger_; 150 scoped_ptr<HostEventLogger> host_event_logger_;
152 151
153 scoped_ptr<ChromotingHost> host_; 152 scoped_ptr<ChromotingHost> host_;
154 int failed_login_attempts_; 153 int failed_login_attempts_;
155 154
156 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 155 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
157 156
158 // Host the current nat traversal policy setting. 157 // Host the current nat traversal policy setting.
159 bool nat_traversal_enabled_; 158 bool nat_traversal_enabled_;
(...skipping 29 matching lines...) Expand all
189 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, 188 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
190 const std::string& directory_bot_jid); 189 const std::string& directory_bot_jid);
191 190
192 private: 191 private:
193 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); 192 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory);
194 }; 193 };
195 194
196 } // namespace remoting 195 } // namespace remoting
197 196
198 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 197 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_
OLDNEW
« no previous file with comments | « remoting/host/host_status_logger_unittest.cc ('k') | remoting/host/it2me/it2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698