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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 intptr_t parent_window_handle, | 42 intptr_t parent_window_handle, |
43 scoped_ptr<extensions::NativeMessagingChannel> channel, | 43 scoped_ptr<extensions::NativeMessagingChannel> channel, |
44 scoped_refptr<DaemonController> daemon_controller, | 44 scoped_refptr<DaemonController> daemon_controller, |
45 scoped_refptr<protocol::PairingRegistry> pairing_registry, | 45 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
46 scoped_ptr<OAuthClient> oauth_client); | 46 scoped_ptr<OAuthClient> oauth_client); |
47 virtual ~Me2MeNativeMessagingHost(); | 47 virtual ~Me2MeNativeMessagingHost(); |
48 | 48 |
49 void Start(const base::Closure& quit_closure); | 49 void Start(const base::Closure& quit_closure); |
50 | 50 |
51 // extensions::NativeMessagingChannel::EventHandler implementation | 51 // extensions::NativeMessagingChannel::EventHandler implementation |
52 virtual void OnMessage(scoped_ptr<base::Value> message) OVERRIDE; | 52 virtual void OnMessage(scoped_ptr<base::Value> message) override; |
53 virtual void OnDisconnect() OVERRIDE; | 53 virtual void OnDisconnect() override; |
54 | 54 |
55 private: | 55 private: |
56 // These "Process.." methods handle specific request types. The |response| | 56 // These "Process.." methods handle specific request types. The |response| |
57 // dictionary is pre-filled by ProcessMessage() with the parts of the | 57 // dictionary is pre-filled by ProcessMessage() with the parts of the |
58 // response already known ("id" and "type" fields). | 58 // response already known ("id" and "type" fields). |
59 void ProcessHello( | 59 void ProcessHello( |
60 scoped_ptr<base::DictionaryValue> message, | 60 scoped_ptr<base::DictionaryValue> message, |
61 scoped_ptr<base::DictionaryValue> response); | 61 scoped_ptr<base::DictionaryValue> response); |
62 void ProcessClearPairedClients( | 62 void ProcessClearPairedClients( |
63 scoped_ptr<base::DictionaryValue> message, | 63 scoped_ptr<base::DictionaryValue> message, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Returns true if the request was successfully delegated to the elevated | 128 // Returns true if the request was successfully delegated to the elevated |
129 // host and false otherwise. | 129 // host and false otherwise. |
130 bool DelegateToElevatedHost(scoped_ptr<base::DictionaryValue> message); | 130 bool DelegateToElevatedHost(scoped_ptr<base::DictionaryValue> message); |
131 | 131 |
132 #if defined(OS_WIN) | 132 #if defined(OS_WIN) |
133 class ElevatedChannelEventHandler | 133 class ElevatedChannelEventHandler |
134 : public extensions::NativeMessagingChannel::EventHandler { | 134 : public extensions::NativeMessagingChannel::EventHandler { |
135 public: | 135 public: |
136 ElevatedChannelEventHandler(Me2MeNativeMessagingHost* host); | 136 ElevatedChannelEventHandler(Me2MeNativeMessagingHost* host); |
137 | 137 |
138 virtual void OnMessage(scoped_ptr<base::Value> message) OVERRIDE; | 138 virtual void OnMessage(scoped_ptr<base::Value> message) override; |
139 virtual void OnDisconnect() OVERRIDE; | 139 virtual void OnDisconnect() override; |
140 private: | 140 private: |
141 Me2MeNativeMessagingHost* parent_; | 141 Me2MeNativeMessagingHost* parent_; |
142 }; | 142 }; |
143 | 143 |
144 // Create and connect to an elevated host process if necessary. | 144 // Create and connect to an elevated host process if necessary. |
145 // |elevated_channel_| will contain the native messaging channel to the | 145 // |elevated_channel_| will contain the native messaging channel to the |
146 // elevated host if the function succeeds. | 146 // elevated host if the function succeeds. |
147 void Me2MeNativeMessagingHost::EnsureElevatedHostCreated(); | 147 void Me2MeNativeMessagingHost::EnsureElevatedHostCreated(); |
148 | 148 |
149 // Disconnect and shut down the elevated host. | 149 // Disconnect and shut down the elevated host. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_; | 183 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_; |
184 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_; | 184 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost); | 186 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace remoting | 189 } // namespace remoting |
190 | 190 |
191 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ | 191 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ |
OLD | NEW |