| 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_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ | 5 #ifndef REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ |
| 6 #define REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ | 6 #define REMOTING_HOST_SETUP_ME2ME_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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class GaiaOAuthClient; | 22 class GaiaOAuthClient; |
| 23 } // namespace gaia | 23 } // namespace gaia |
| 24 | 24 |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 | 26 |
| 27 namespace protocol { | 27 namespace protocol { |
| 28 class PairingRegistry; | 28 class PairingRegistry; |
| 29 } // namespace protocol | 29 } // namespace protocol |
| 30 | 30 |
| 31 // Implementation of the me2me native messaging host. | 31 // Implementation of the me2me native messaging host. |
| 32 class NativeMessagingHost { | 32 class Me2MeNativeMessagingHost { |
| 33 public: | 33 public: |
| 34 typedef NativeMessagingChannel::SendMessageCallback SendMessageCallback; | 34 typedef NativeMessagingChannel::SendMessageCallback SendMessageCallback; |
| 35 | 35 |
| 36 NativeMessagingHost( | 36 Me2MeNativeMessagingHost( |
| 37 scoped_ptr<NativeMessagingChannel> channel, | 37 scoped_ptr<NativeMessagingChannel> channel, |
| 38 scoped_refptr<DaemonController> daemon_controller, | 38 scoped_refptr<DaemonController> daemon_controller, |
| 39 scoped_refptr<protocol::PairingRegistry> pairing_registry, | 39 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
| 40 scoped_ptr<OAuthClient> oauth_client); | 40 scoped_ptr<OAuthClient> oauth_client); |
| 41 virtual ~NativeMessagingHost(); | 41 virtual ~Me2MeNativeMessagingHost(); |
| 42 | 42 |
| 43 void Start(const base::Closure& quit_closure); | 43 void Start(const base::Closure& quit_closure); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 void ProcessMessage(scoped_ptr<base::DictionaryValue> message); | 46 void ProcessMessage(scoped_ptr<base::DictionaryValue> message); |
| 47 | 47 |
| 48 // These "Process.." methods handle specific request types. The |response| | 48 // These "Process.." methods handle specific request types. The |response| |
| 49 // dictionary is pre-filled by ProcessMessage() with the parts of the | 49 // dictionary is pre-filled by ProcessMessage() with the parts of the |
| 50 // response already known ("id" and "type" fields). | 50 // response already known ("id" and "type" fields). |
| 51 bool ProcessHello( | 51 bool ProcessHello( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 scoped_refptr<DaemonController> daemon_controller_; | 117 scoped_refptr<DaemonController> daemon_controller_; |
| 118 | 118 |
| 119 // Used to load and update the paired clients for this host. | 119 // Used to load and update the paired clients for this host. |
| 120 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 120 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
| 121 | 121 |
| 122 // Used to exchange the service account authorization code for credentials. | 122 // Used to exchange the service account authorization code for credentials. |
| 123 scoped_ptr<OAuthClient> oauth_client_; | 123 scoped_ptr<OAuthClient> oauth_client_; |
| 124 | 124 |
| 125 base::ThreadChecker thread_checker_; | 125 base::ThreadChecker thread_checker_; |
| 126 | 126 |
| 127 base::WeakPtr<NativeMessagingHost> weak_ptr_; | 127 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_; |
| 128 base::WeakPtrFactory<NativeMessagingHost> weak_factory_; | 128 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_; |
| 129 | 129 |
| 130 DISALLOW_COPY_AND_ASSIGN(NativeMessagingHost); | 130 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost); |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 // Creates a NativeMessagingHost instance, attaches it to stdin/stdout and runs | 133 // Creates a Me2MeNativeMessagingHost instance, attaches it to stdin/stdout and |
| 134 // the message loop until NativeMessagingHost signals shutdown. | 134 // runs the message loop until Me2MeNativeMessagingHost signals shutdown. |
| 135 int NativeMessagingHostMain(); | 135 int Me2MeNativeMessagingHostMain(); |
| 136 | 136 |
| 137 } // namespace remoting | 137 } // namespace remoting |
| 138 | 138 |
| 139 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ | 139 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ |
| OLD | NEW |