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

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

Issue 2847853003: Remove policy watching from It2MeHost. (Closed)
Patch Set: Fix unit tests Created 3 years, 7 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
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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 class PolicyService; 26 class PolicyService;
27 } // namespace policy 27 } // namespace policy
28 28
29 namespace remoting { 29 namespace remoting {
30 30
31 class ChromotingHost; 31 class ChromotingHost;
32 class ChromotingHostContext; 32 class ChromotingHostContext;
33 class DesktopEnvironmentFactory; 33 class DesktopEnvironmentFactory;
34 class HostEventLogger; 34 class HostEventLogger;
35 class HostStatusLogger; 35 class HostStatusLogger;
36 class PolicyWatcher;
37 class RegisterSupportHostRequest; 36 class RegisterSupportHostRequest;
38 class RsaKeyPair; 37 class RsaKeyPair;
39 38
40 // These state values are duplicated in host_session.js. Remember to update 39 // These state values are duplicated in host_session.js. Remember to update
41 // both copies when making changes. 40 // both copies when making changes.
42 enum It2MeHostState { 41 enum It2MeHostState {
43 kDisconnected, 42 kDisconnected,
44 kStarting, 43 kStarting,
45 kRequestedAccessCode, 44 kRequestedAccessCode,
46 kReceivedAccessCode, 45 kReceivedAccessCode,
(...skipping 11 matching lines...) Expand all
58 public: 57 public:
59 virtual void OnClientAuthenticated(const std::string& client_username) = 0; 58 virtual void OnClientAuthenticated(const std::string& client_username) = 0;
60 virtual void OnStoreAccessCode(const std::string& access_code, 59 virtual void OnStoreAccessCode(const std::string& access_code,
61 base::TimeDelta access_code_lifetime) = 0; 60 base::TimeDelta access_code_lifetime) = 0;
62 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0; 61 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0;
63 virtual void OnStateChanged(It2MeHostState state, 62 virtual void OnStateChanged(It2MeHostState state,
64 const std::string& error_message) = 0; 63 const std::string& error_message) = 0;
65 }; 64 };
66 65
67 It2MeHost(std::unique_ptr<ChromotingHostContext> context, 66 It2MeHost(std::unique_ptr<ChromotingHostContext> context,
68 std::unique_ptr<PolicyWatcher> policy_watcher,
69 std::unique_ptr<It2MeConfirmationDialogFactory> dialog_factory_, 67 std::unique_ptr<It2MeConfirmationDialogFactory> dialog_factory_,
70 base::WeakPtr<It2MeHost::Observer> observer, 68 base::WeakPtr<It2MeHost::Observer> observer,
71 std::unique_ptr<SignalStrategy> signal_strategy, 69 std::unique_ptr<SignalStrategy> signal_strategy,
72 const std::string& username, 70 const std::string& username,
73 const std::string& directory_bot_jid); 71 const std::string& directory_bot_jid);
74 72
75 // Methods called by the script object, from the plugin thread. 73 // Methods called by the script object, from the plugin thread.
76 74
77 // Creates It2Me host structures and starts the host. 75 // Creates It2Me host structures and starts the host.
78 virtual void Connect(); 76 virtual void Connect();
(...skipping 13 matching lines...) Expand all
92 void SetStateForTesting(It2MeHostState state, 90 void SetStateForTesting(It2MeHostState state,
93 const std::string& error_message) { 91 const std::string& error_message) {
94 SetState(state, error_message); 92 SetState(state, error_message);
95 } 93 }
96 94
97 // Returns the callback used for validating the connection. Do not run the 95 // Returns the callback used for validating the connection. Do not run the
98 // returned callback after this object has been destroyed. 96 // returned callback after this object has been destroyed.
99 protocol::ValidatingAuthenticator::ValidationCallback 97 protocol::ValidatingAuthenticator::ValidationCallback
100 GetValidationCallbackForTesting(); 98 GetValidationCallbackForTesting();
101 99
100 // Called when initial policies are read, and when they change.
101 void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies);
102
102 protected: 103 protected:
103 friend class base::RefCountedThreadSafe<It2MeHost>; 104 friend class base::RefCountedThreadSafe<It2MeHost>;
104 105
105 ~It2MeHost() override; 106 ~It2MeHost() override;
106 107
107 ChromotingHostContext* host_context() { return host_context_.get(); } 108 ChromotingHostContext* host_context() { return host_context_.get(); }
108 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } 109 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; }
109 110
110 private: 111 private:
111 // Updates state of the host. Can be called only on the network thread. 112 // Updates state of the host. Can be called only on the network thread.
(...skipping 11 matching lines...) Expand all
123 void ReadPolicyAndConnect(); 124 void ReadPolicyAndConnect();
124 125
125 // Called by ReadPolicyAndConnect once policies have been read. 126 // Called by ReadPolicyAndConnect once policies have been read.
126 void FinishConnect(); 127 void FinishConnect();
127 128
128 // Called when the support host registration completes. 129 // Called when the support host registration completes.
129 void OnReceivedSupportID(const std::string& support_id, 130 void OnReceivedSupportID(const std::string& support_id,
130 const base::TimeDelta& lifetime, 131 const base::TimeDelta& lifetime,
131 const std::string& error_message); 132 const std::string& error_message);
132 133
133 // Called when initial policies are read, and when they change.
134 void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies);
135
136 // Called when malformed policies are detected.
137 void OnPolicyError();
138
139 // Handlers for NAT traversal and domain policies. 134 // Handlers for NAT traversal and domain policies.
140 void UpdateNatPolicy(bool nat_traversal_enabled); 135 void UpdateNatPolicy(bool nat_traversal_enabled);
141 void UpdateHostDomainListPolicy(std::vector<std::string> host_domain_list); 136 void UpdateHostDomainListPolicy(std::vector<std::string> host_domain_list);
142 void UpdateClientDomainListPolicy( 137 void UpdateClientDomainListPolicy(
143 std::vector<std::string> client_domain_list); 138 std::vector<std::string> client_domain_list);
144 139
145 void DisconnectOnNetworkThread(); 140 void DisconnectOnNetworkThread();
146 141
147 // Uses details of the connection and current policies to determine if the 142 // Uses details of the connection and current policies to determine if the
148 // connection should be accepted or rejected. 143 // connection should be accepted or rejected.
(...skipping 12 matching lines...) Expand all
161 156
162 scoped_refptr<RsaKeyPair> host_key_pair_; 157 scoped_refptr<RsaKeyPair> host_key_pair_;
163 std::unique_ptr<RegisterSupportHostRequest> register_request_; 158 std::unique_ptr<RegisterSupportHostRequest> register_request_;
164 std::unique_ptr<HostStatusLogger> host_status_logger_; 159 std::unique_ptr<HostStatusLogger> host_status_logger_;
165 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; 160 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
166 std::unique_ptr<HostEventLogger> host_event_logger_; 161 std::unique_ptr<HostEventLogger> host_event_logger_;
167 162
168 std::unique_ptr<ChromotingHost> host_; 163 std::unique_ptr<ChromotingHost> host_;
169 int failed_login_attempts_ = 0; 164 int failed_login_attempts_ = 0;
170 165
171 std::unique_ptr<PolicyWatcher> policy_watcher_;
172 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; 166 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_;
173 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; 167 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_;
174 168
175 // Host the current nat traversal policy setting. 169 // Host the current nat traversal policy setting.
176 bool nat_traversal_enabled_ = false; 170 bool nat_traversal_enabled_ = false;
177 171
178 // The client and host domain policy setting. 172 // The client and host domain policy setting.
179 std::vector<std::string> required_client_domain_list_; 173 std::vector<std::string> required_client_domain_list_;
180 std::vector<std::string> required_host_domain_list_; 174 std::vector<std::string> required_host_domain_list_;
181 175
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const std::string& username, 210 const std::string& username,
217 const std::string& directory_bot_jid); 211 const std::string& directory_bot_jid);
218 212
219 private: 213 private:
220 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); 214 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory);
221 }; 215 };
222 216
223 } // namespace remoting 217 } // namespace remoting
224 218
225 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 219 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/it2me/it2me_host.cc » ('j') | remoting/host/it2me/it2me_native_messaging_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698