OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 5 #ifndef REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // false on failure. | 219 // false on failure. |
220 bool LocalizeStringWithSubstitution(NPObject* localize_func, | 220 bool LocalizeStringWithSubstitution(NPObject* localize_func, |
221 const char* tag, | 221 const char* tag, |
222 const char* substitution, | 222 const char* substitution, |
223 string16* result); | 223 string16* result); |
224 | 224 |
225 ////////////////////////////////////////////////////////// | 225 ////////////////////////////////////////////////////////// |
226 // Helper methods for Me2Me host. | 226 // Helper methods for Me2Me host. |
227 | 227 |
228 // Helpers for GenerateKeyPair(). | 228 // Helpers for GenerateKeyPair(). |
229 void DoGenerateKeyPair(const ScopedRefNPObject& callback); | 229 static void DoGenerateKeyPair( |
230 void InvokeGenerateKeyPairCallback(const ScopedRefNPObject& callback, | 230 const scoped_refptr<AutoThreadTaskRunner>& plugin_task_runner, |
| 231 const base::Callback<void (const std::string&, |
| 232 const std::string&)>& callback); |
| 233 void InvokeGenerateKeyPairCallback(scoped_ptr<ScopedRefNPObject> callback, |
231 const std::string& private_key, | 234 const std::string& private_key, |
232 const std::string& public_key); | 235 const std::string& public_key); |
233 | 236 |
234 | |
235 // Callback handler for SetConfigAndStart(), Stop(), SetPin() and | 237 // Callback handler for SetConfigAndStart(), Stop(), SetPin() and |
236 // SetUsageStatsConsent() in DaemonController. | 238 // SetUsageStatsConsent() in DaemonController. |
237 void InvokeAsyncResultCallback(const ScopedRefNPObject& callback, | 239 void InvokeAsyncResultCallback(scoped_ptr<ScopedRefNPObject> callback, |
238 DaemonController::AsyncResult result); | 240 DaemonController::AsyncResult result); |
239 | 241 |
240 // Callback handler for PairingRegistry methods that return a boolean | 242 // Callback handler for PairingRegistry methods that return a boolean |
241 // success status. | 243 // success status. |
242 void InvokeBooleanCallback(const ScopedRefNPObject& callback, bool result); | 244 void InvokeBooleanCallback(scoped_ptr<ScopedRefNPObject> callback, |
| 245 bool result); |
243 | 246 |
244 // Callback handler for DaemonController::GetConfig(). | 247 // Callback handler for DaemonController::GetConfig(). |
245 void InvokeGetDaemonConfigCallback(const ScopedRefNPObject& callback, | 248 void InvokeGetDaemonConfigCallback(scoped_ptr<ScopedRefNPObject> callback, |
246 scoped_ptr<base::DictionaryValue> config); | 249 scoped_ptr<base::DictionaryValue> config); |
247 | 250 |
248 // Callback handler for DaemonController::GetVersion(). | 251 // Callback handler for DaemonController::GetVersion(). |
249 void InvokeGetDaemonVersionCallback(const ScopedRefNPObject& callback, | 252 void InvokeGetDaemonVersionCallback(scoped_ptr<ScopedRefNPObject> callback, |
250 const std::string& version); | 253 const std::string& version); |
251 | 254 |
252 // Callback handler for GetPairedClients(). | 255 // Callback handler for GetPairedClients(). |
253 void InvokeGetPairedClientsCallback( | 256 void InvokeGetPairedClientsCallback( |
254 const ScopedRefNPObject& callback, | 257 scoped_ptr<ScopedRefNPObject> callback, |
255 scoped_ptr<base::ListValue> paired_clients); | 258 scoped_ptr<base::ListValue> paired_clients); |
256 | 259 |
257 // Callback handler for DaemonController::GetUsageStatsConsent(). | 260 // Callback handler for DaemonController::GetUsageStatsConsent(). |
258 void InvokeGetUsageStatsConsentCallback( | 261 void InvokeGetUsageStatsConsentCallback( |
259 const ScopedRefNPObject& callback, | 262 scoped_ptr<ScopedRefNPObject> callback, |
260 const DaemonController::UsageStatsConsent& consent); | 263 const DaemonController::UsageStatsConsent& consent); |
261 | 264 |
262 ////////////////////////////////////////////////////////// | 265 ////////////////////////////////////////////////////////// |
263 // Basic helper methods used for both It2Me and Me2me. | 266 // Basic helper methods used for both It2Me and Me2me. |
264 | 267 |
265 // Call LogDebugInfo handler if there is one. | 268 // Call LogDebugInfo handler if there is one. |
266 // This must be called on the correct thread. | 269 // This must be called on the correct thread. |
267 void LogDebugInfo(const std::string& message); | 270 void LogDebugInfo(const std::string& message); |
268 | 271 |
269 // Helper function for executing InvokeDefault on an NPObject, and ignoring | 272 // Helper function for executing InvokeDefault on an NPObject, and ignoring |
270 // the return value. | 273 // the return value. |
271 bool InvokeAndIgnoreResult(NPObject* func, | 274 bool InvokeAndIgnoreResult(const ScopedRefNPObject& func, |
272 const NPVariant* args, | 275 const NPVariant* args, |
273 uint32_t arg_count); | 276 uint32_t arg_count); |
274 | 277 |
275 // Set an exception for the current call. | 278 // Set an exception for the current call. |
276 void SetException(const std::string& exception_string); | 279 void SetException(const std::string& exception_string); |
277 | 280 |
278 ////////////////////////////////////////////////////////// | 281 ////////////////////////////////////////////////////////// |
279 // Plugin state variables shared between It2Me and Me2Me. | 282 // Plugin state variables shared between It2Me and Me2Me. |
280 | 283 |
281 NPP plugin_; | 284 NPP plugin_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Used to cancel pending tasks for this object when it is destroyed. | 333 // Used to cancel pending tasks for this object when it is destroyed. |
331 base::WeakPtrFactory<HostNPScriptObject> weak_factory_; | 334 base::WeakPtrFactory<HostNPScriptObject> weak_factory_; |
332 base::WeakPtr<HostNPScriptObject> weak_ptr_; | 335 base::WeakPtr<HostNPScriptObject> weak_ptr_; |
333 | 336 |
334 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); | 337 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); |
335 }; | 338 }; |
336 | 339 |
337 } // namespace remoting | 340 } // namespace remoting |
338 | 341 |
339 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 342 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
OLD | NEW |