class DictionaryValue;
}
+namespace policy {
+class PolicyService;
+} // namespace policy
+
namespace remoting {
class ChromotingHost;
class RsaKeyPair;
namespace policy_hack {
-
class PolicyWatcher;
-
} // namespace policy_hack
// These state values are duplicated in host_session.js. Remember to update
};
It2MeHost(
- ChromotingHostContext* context,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ scoped_ptr<ChromotingHostContext> context,
+ scoped_ptr<policy_hack::PolicyWatcher> policy_watcher,
base::WeakPtr<It2MeHost::Observer> observer,
const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
const std::string& directory_bot_jid);
virtual void RequestNatPolicy();
// remoting::HostStatusObserver implementation.
- virtual void OnAccessDenied(const std::string& jid) OVERRIDE;
- virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
- virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
+ void OnAccessDenied(const std::string& jid) override;
+ void OnClientAuthenticated(const std::string& jid) override;
+ void OnClientDisconnected(const std::string& jid) override;
void SetStateForTesting(It2MeHostState state) { SetState(state); }
protected:
friend class base::RefCountedThreadSafe<It2MeHost>;
- virtual ~It2MeHost();
+ ~It2MeHost() override;
- ChromotingHostContext* host_context() { return host_context_; }
+ ChromotingHostContext* host_context() { return host_context_.get(); }
scoped_refptr<base::SingleThreadTaskRunner> task_runner() {
return task_runner_;
}
// the UI thread.
void ShutdownOnUiThread();
+ // Called when |policy_watcher_| has stopped listening for changes and it is
+ // safe to delete it.
+ void OnPolicyWatcherShutdown();
+
// Called when initial policies are read, and when they change.
void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies);
void UpdateHostDomainPolicy(const std::string& host_domain);
// Caller supplied fields.
-
- // The creator of the It2MeHost object owns the the host context and is
- // responsible for keeping it alive throughout the liftime of the host.
- ChromotingHostContext* host_context_;
+ scoped_ptr<ChromotingHostContext> host_context_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::WeakPtr<It2MeHost::Observer> observer_;
XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
It2MeHostFactory();
virtual ~It2MeHostFactory();
+ // |policy_service| is used for creating the policy watcher for new
+ // instances of It2MeHost on ChromeOS. The caller must ensure that
+ // |policy_service| is valid throughout the lifetime of the It2MeHostFactory
+ // and each created It2MeHost object. This is currently possible because
+ // |policy_service| is a global singleton available from the browser process.
+ virtual void set_policy_service(policy::PolicyService* policy_service);
+
virtual scoped_refptr<It2MeHost> CreateIt2MeHost(
- ChromotingHostContext* context,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ scoped_ptr<ChromotingHostContext> context,
base::WeakPtr<It2MeHost::Observer> observer,
const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
const std::string& directory_bot_jid);
private:
+ policy::PolicyService* policy_service_;
DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory);
};