Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: chrome/browser/extensions/api/diagnostics/diagnostics_api.h

Issue 17210002: Connectivity Diagnostics API: chrome.diagnostics.sendPacket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/diagnostics/diagnostics_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/common/extensions/api/diagnostics.h"
13
14 namespace extensions {
15
16 class DiagnosticsSendPacketFunction : public AsyncApiFunction {
17 public:
18 // Result code for sending packet. Platform specific AsyncWorkStart() will
19 // finish with this ResultCode so we can maximize shared code.
20 enum SendPacketResultCode {
21 // Ping packed is sent and ICMP reply is received before time out.
22 SEND_PACKET_OK,
23
24 // Not implemented on the platform.
25 SEND_PACKET_NOT_IMPLEMENTED,
26
27 // The ping operation failed because of timeout or network unreachable.
28 SEND_PACKET_FAILED,
29 };
30
31 DECLARE_EXTENSION_FUNCTION("diagnostics.sendPacket",
32 DIAGNOSTICS_SENDPACKET);
33
34 DiagnosticsSendPacketFunction();
35
36 protected:
37 virtual ~DiagnosticsSendPacketFunction();
38
39 // AsyncApiFunction:
40 virtual bool Prepare() OVERRIDE;
41 // This methods will be implemented differently on different platforms.
42 virtual void AsyncWorkStart() OVERRIDE;
43 virtual bool Respond() OVERRIDE;
44
45 private:
46 void SendPingPacket();
47 void OnCompleted(SendPacketResultCode result_code,
48 const std::string& ip,
49 double latency);
50
51 scoped_ptr<extensions::api::diagnostics::SendPacket::Params>
52 parameters_;
53 };
54
55 } // namespace extensions
56
57 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/diagnostics/diagnostics_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698