OLD | NEW |
---|---|
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_NATIVE_MESSAGING_HOST_H_ | 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ |
6 #define REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ | 6 #define REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_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 "chrome/browser/extensions/api/messaging/native_messaging_channel.h" | |
11 #include "remoting/base/auto_thread_task_runner.h" | 12 #include "remoting/base/auto_thread_task_runner.h" |
12 #include "remoting/host/it2me/it2me_host.h" | 13 #include "remoting/host/it2me/it2me_host.h" |
13 #include "remoting/host/native_messaging/native_messaging_channel.h" | |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 class File; | |
weitao
2014/09/12 16:37:36
Why is this needed?
kelvinp
2014/09/12 17:58:32
Done.
| |
17 } // namespace base | 18 } // namespace base |
18 | 19 |
19 namespace remoting { | 20 namespace remoting { |
20 | 21 |
21 // Implementation of the native messaging host process. | 22 // Implementation of the native messaging host process. |
22 class It2MeNativeMessagingHost : public It2MeHost::Observer { | 23 class It2MeNativeMessagingHost : public It2MeHost::Observer { |
23 public: | 24 public: |
24 It2MeNativeMessagingHost( | 25 It2MeNativeMessagingHost( |
25 scoped_refptr<AutoThreadTaskRunner> task_runner, | 26 scoped_refptr<AutoThreadTaskRunner> task_runner, |
26 scoped_ptr<NativeMessagingChannel> channel, | 27 scoped_ptr<extensions::NativeMessagingChannel> channel, |
27 scoped_ptr<It2MeHostFactory> factory); | 28 scoped_ptr<It2MeHostFactory> factory); |
28 virtual ~It2MeNativeMessagingHost(); | 29 virtual ~It2MeNativeMessagingHost(); |
29 | 30 |
30 void Start(const base::Closure& quit_closure) const; | 31 void Start(const base::Closure& quit_closure) const; |
31 | 32 |
32 // It2MeHost::Observer implementation | 33 // It2MeHost::Observer implementation |
33 virtual void OnClientAuthenticated(const std::string& client_username) | 34 virtual void OnClientAuthenticated(const std::string& client_username) |
34 OVERRIDE; | 35 OVERRIDE; |
35 virtual void OnStoreAccessCode(const std::string& access_code, | 36 virtual void OnStoreAccessCode(const std::string& access_code, |
36 base::TimeDelta access_code_lifetime) OVERRIDE; | 37 base::TimeDelta access_code_lifetime) OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... | |
49 scoped_ptr<base::DictionaryValue> response) const; | 50 scoped_ptr<base::DictionaryValue> response) const; |
50 void ProcessConnect(const base::DictionaryValue& message, | 51 void ProcessConnect(const base::DictionaryValue& message, |
51 scoped_ptr<base::DictionaryValue> response); | 52 scoped_ptr<base::DictionaryValue> response); |
52 void ProcessDisconnect(const base::DictionaryValue& message, | 53 void ProcessDisconnect(const base::DictionaryValue& message, |
53 scoped_ptr<base::DictionaryValue> response); | 54 scoped_ptr<base::DictionaryValue> response); |
54 void SendErrorAndExit(scoped_ptr<base::DictionaryValue> response, | 55 void SendErrorAndExit(scoped_ptr<base::DictionaryValue> response, |
55 const std::string& description) const; | 56 const std::string& description) const; |
56 | 57 |
57 scoped_refptr<AutoThreadTaskRunner> task_runner() const; | 58 scoped_refptr<AutoThreadTaskRunner> task_runner() const; |
58 | 59 |
59 scoped_ptr<NativeMessagingChannel> channel_; | 60 scoped_ptr<extensions::NativeMessagingChannel> channel_; |
60 scoped_ptr<It2MeHostFactory> factory_; | 61 scoped_ptr<It2MeHostFactory> factory_; |
61 scoped_ptr<ChromotingHostContext> host_context_; | 62 scoped_ptr<ChromotingHostContext> host_context_; |
62 scoped_refptr<It2MeHost> it2me_host_; | 63 scoped_refptr<It2MeHost> it2me_host_; |
63 | 64 |
64 // Cached, read-only copies of |it2me_host_| session state. | 65 // Cached, read-only copies of |it2me_host_| session state. |
65 It2MeHostState state_; | 66 It2MeHostState state_; |
66 std::string access_code_; | 67 std::string access_code_; |
67 base::TimeDelta access_code_lifetime_; | 68 base::TimeDelta access_code_lifetime_; |
68 std::string client_username_; | 69 std::string client_username_; |
69 | 70 |
70 // IT2Me Talk server configuration used by |it2me_host_| to connect. | 71 // IT2Me Talk server configuration used by |it2me_host_| to connect. |
71 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; | 72 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; |
72 | 73 |
73 // Chromoting Bot JID used by |it2me_host_| to register the host. | 74 // Chromoting Bot JID used by |it2me_host_| to register the host. |
74 std::string directory_bot_jid_; | 75 std::string directory_bot_jid_; |
75 | 76 |
76 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_; | 77 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_; |
77 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_; | 78 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_; |
78 | 79 |
79 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost); | 80 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost); |
80 }; | 81 }; |
81 | 82 |
82 } // namespace remoting | 83 } // namespace remoting |
83 | 84 |
84 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ | 85 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ |
85 | 86 |
OLD | NEW |