OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/extensions/api/api_function.h" |
| 12 #include "chrome/browser/extensions/api/diagnostics/send_ping_packet.h" |
| 13 #include "chrome/common/extensions/api/diagnostics.h" |
| 14 |
| 15 namespace extensions { |
| 16 |
| 17 class DiagnosticsSendPacketFunction : public AsyncApiFunction { |
| 18 public: |
| 19 DECLARE_EXTENSION_FUNCTION("diagnostics.sendPacket", |
| 20 DIAGNOSTICS_SENDPACKET); |
| 21 DiagnosticsSendPacketFunction(); |
| 22 |
| 23 protected: |
| 24 virtual ~DiagnosticsSendPacketFunction(); |
| 25 |
| 26 // AsyncApiFunction: |
| 27 virtual bool Prepare() OVERRIDE; |
| 28 virtual void AsyncWorkStart() OVERRIDE; |
| 29 virtual bool Respond() OVERRIDE; |
| 30 |
| 31 private: |
| 32 void OnComplete(SendPingPacketResultCode result_code, |
| 33 const std::string& ip, |
| 34 double latency); |
| 35 |
| 36 scoped_ptr<extensions::api::diagnostics::SendPacket::Params> |
| 37 parameters_; |
| 38 }; |
| 39 |
| 40 } // namespace extensions |
| 41 |
| 42 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_ |
OLD | NEW |