Index: chrome/browser/extensions/api/diagnostics/diagnostics_api.h |
diff --git a/chrome/browser/extensions/api/diagnostics/diagnostics_api.h b/chrome/browser/extensions/api/diagnostics/diagnostics_api.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a765646be8993f88f328d068af9ba74420336e83 |
--- /dev/null |
+++ b/chrome/browser/extensions/api/diagnostics/diagnostics_api.h |
@@ -0,0 +1,42 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_ |
+#define CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/extensions/api/api_function.h" |
+#include "chrome/browser/extensions/api/diagnostics/send_ping_packet.h" |
+#include "chrome/common/extensions/api/diagnostics.h" |
+ |
+namespace extensions { |
+ |
+class DiagnosticsSendPacketFunction : public AsyncApiFunction { |
not at google - send to devlin
2013/06/20 23:32:12
What thread does this stuff happen on? Is it the U
Bei Zhang
2013/06/21 08:31:07
AsyncApiFunction works on IO thread.
On 2013/06/2
not at google - send to devlin
2013/06/21 17:13:24
Ok. Could you add some DCHECK(CurrentyOn(IO))s aro
Bei Zhang
2013/06/21 19:31:44
Actually all the apps APIs are by default works on
|
+ public: |
+ DECLARE_EXTENSION_FUNCTION("diagnostics.sendPacket", |
+ DIAGNOSTICS_SENDPACKET); |
+ DiagnosticsSendPacketFunction(); |
+ |
+ protected: |
+ virtual ~DiagnosticsSendPacketFunction(); |
+ |
+ // AsyncApiFunction: |
+ virtual bool Prepare() OVERRIDE; |
+ virtual void AsyncWorkStart() OVERRIDE; |
+ virtual bool Respond() OVERRIDE; |
+ |
+ private: |
+ void OnComplete(SendPingPacketResultCode result_code, |
+ const std::string& ip, |
+ double latency); |
+ |
+ scoped_ptr<extensions::api::diagnostics::SendPacket::Params> |
+ parameters_; |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_ |