| 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 <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "extensions/browser/api/messaging/native_message_host.h" | 15 #include "extensions/browser/api/messaging/native_message_host.h" |
| 15 #include "remoting/base/auto_thread_task_runner.h" | |
| 16 #include "remoting/host/chromoting_host_context.h" | |
| 17 #include "remoting/host/it2me/it2me_host.h" | 16 #include "remoting/host/it2me/it2me_host.h" |
| 18 | 17 |
| 19 #if !defined(OS_CHROMEOS) | 18 #if !defined(OS_CHROMEOS) |
| 20 #include "remoting/host/native_messaging/log_message_handler.h" | 19 #include "remoting/host/native_messaging/log_message_handler.h" |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 namespace base { | 22 namespace base { |
| 24 class DictionaryValue; | 23 class DictionaryValue; |
| 25 class Value; | 24 class Value; |
| 25 class SingleThreadTaskRunner; |
| 26 } // namespace base | 26 } // namespace base |
| 27 | 27 |
| 28 namespace remoting { | 28 namespace remoting { |
| 29 | 29 |
| 30 class ChromotingHostContext; |
| 31 |
| 30 // Implementation of the native messaging host process. | 32 // Implementation of the native messaging host process. |
| 31 class It2MeNativeMessagingHost : public It2MeHost::Observer, | 33 class It2MeNativeMessagingHost : public It2MeHost::Observer, |
| 32 public extensions::NativeMessageHost { | 34 public extensions::NativeMessageHost { |
| 33 public: | 35 public: |
| 34 It2MeNativeMessagingHost(std::unique_ptr<ChromotingHostContext> host_context, | 36 It2MeNativeMessagingHost(std::unique_ptr<ChromotingHostContext> host_context, |
| 35 std::unique_ptr<It2MeHostFactory> host_factory); | 37 std::unique_ptr<It2MeHostFactory> host_factory); |
| 36 ~It2MeNativeMessagingHost() override; | 38 ~It2MeNativeMessagingHost() override; |
| 37 | 39 |
| 38 // extensions::NativeMessageHost implementation. | 40 // extensions::NativeMessageHost implementation. |
| 39 void OnMessage(const std::string& message) override; | 41 void OnMessage(const std::string& message) override; |
| 40 void Start(Client* client) override; | 42 void Start(Client* client) override; |
| 41 scoped_refptr<base::SingleThreadTaskRunner> task_runner() | 43 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override; |
| 42 const override; | |
| 43 | 44 |
| 44 // It2MeHost::Observer implementation. | 45 // It2MeHost::Observer implementation. |
| 45 void OnClientAuthenticated(const std::string& client_username) | 46 void OnClientAuthenticated(const std::string& client_username) |
| 46 override; | 47 override; |
| 47 void OnStoreAccessCode(const std::string& access_code, | 48 void OnStoreAccessCode(const std::string& access_code, |
| 48 base::TimeDelta access_code_lifetime) override; | 49 base::TimeDelta access_code_lifetime) override; |
| 49 void OnNatPolicyChanged(bool nat_traversal_enabled) override; | 50 void OnNatPolicyChanged(bool nat_traversal_enabled) override; |
| 50 void OnStateChanged(It2MeHostState state, | 51 void OnStateChanged(It2MeHostState state, |
| 51 const std::string& error_message) override; | 52 const std::string& error_message) override; |
| 52 | 53 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 92 |
| 92 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_; | 93 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_; |
| 93 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_; | 94 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_; |
| 94 | 95 |
| 95 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost); | 96 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost); |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace remoting | 99 } // namespace remoting |
| 99 | 100 |
| 100 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ | 101 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ |
| OLD | NEW |