summaryrefslogtreecommitdiffstats
path: root/extensions/browser/api/system_network/system_network_api.h
blob: 29d20bdeb2ec031e8353bdadc54c4a76de6ca380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 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 EXTENSIONS_BROWSER_API_SYSTEM_NETWORK_SYSTEM_NETWORK_API_H_
#define EXTENSIONS_BROWSER_API_SYSTEM_NETWORK_SYSTEM_NETWORK_API_H_

#include "extensions/browser/extension_function.h"
#include "extensions/common/api/system_network.h"
#include "net/base/network_interfaces.h"

namespace extensions {
namespace api {

class SystemNetworkGetNetworkInterfacesFunction
    : public AsyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("system.network.getNetworkInterfaces",
                             SYSTEM_NETWORK_GETNETWORKINTERFACES)

  SystemNetworkGetNetworkInterfacesFunction();

 protected:
  ~SystemNetworkGetNetworkInterfacesFunction() override;

  // AsyncApiFunction:
  bool RunAsync() override;

 private:
  void GetListOnFileThread();
  void HandleGetListError();
  void SendResponseOnUIThread(const net::NetworkInterfaceList& interface_list);
};

}  // namespace api
}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_API_SYSTEM_NETWORK_SYSTEM_NETWORK_API_H_