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

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: Fixes and rebase 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
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 {
not at google - send to devlin 2013/06/21 17:13:24 is this only used internally? if so it can be priv
Bei Zhang 2013/06/21 19:31:44 A static function in diagnostics_api_chromeos.cc i
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 virtual void AsyncWorkStart() OVERRIDE;
not at google - send to devlin 2013/06/21 17:13:24 comment here that this is implemented differently
Bei Zhang 2013/06/21 19:31:44 Done.
42 virtual bool Respond() OVERRIDE;
43
44 private:
45 void SendPingPacket();
46 void OnCompleted(SendPacketResultCode result_code,
47 const std::string& ip,
48 double latency);
49
50 scoped_ptr<extensions::api::diagnostics::SendPacket::Params>
51 parameters_;
52 };
53
54 } // namespace extensions
55
56 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAGNOSTICS_DIAGNOSTICS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698