| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Provides MAC addresses of connected routers by using the /proc/net/ | 5 // Provides MAC addresses of connected routers by using the /proc/net/ |
| 6 // directory which contains files with network information. | 6 // directory which contains files with network information. |
| 7 // This directory is used in most Linux based operating systems. | 7 // This directory is used in most Linux based operating systems. |
| 8 | 8 |
| 9 #include "chrome/browser/geolocation/gateway_data_provider_linux.h" | 9 #include "content/browser/geolocation/gateway_data_provider_linux.h" |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <arpa/inet.h> | 12 #include <arpa/inet.h> |
| 13 #include <net/if.h> | 13 #include <net/if.h> |
| 14 #include <net/if_arp.h> | 14 #include <net/if_arp.h> |
| 15 #include <set> | 15 #include <set> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <sys/ioctl.h> | 17 #include <sys/ioctl.h> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| 22 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 23 #include "base/string_tokenizer.h" | 23 #include "base/string_tokenizer.h" |
| 24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
| 26 #include "chrome/browser/geolocation/empty_device_data_provider.h" | |
| 27 #include "chrome/browser/geolocation/gateway_data_provider_common.h" | |
| 28 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "content/browser/geolocation/empty_device_data_provider.h" |
| 28 #include "content/browser/geolocation/gateway_data_provider_common.h" |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 const unsigned int kMaxArpIterations = 30; | 31 const unsigned int kMaxArpIterations = 30; |
| 32 const unsigned int kMaxRouteIterations = 20; | 32 const unsigned int kMaxRouteIterations = 20; |
| 33 const char kNoGateway[] = "00000000"; | 33 const char kNoGateway[] = "00000000"; |
| 34 const char kArpFilePath[] = "/proc/net/arp"; | 34 const char kArpFilePath[] = "/proc/net/arp"; |
| 35 const char kRouteFilePath[] = "/proc/net/route"; | 35 const char kRouteFilePath[] = "/proc/net/route"; |
| 36 | 36 |
| 37 // Converts an IP address held in a little endian paired hex format to period | 37 // Converts an IP address held in a little endian paired hex format to period |
| 38 // separated decimal format. For example 0101A8C0 becomes 192.168.1.1 | 38 // separated decimal format. For example 0101A8C0 becomes 192.168.1.1 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 GatewayDataProviderLinux::GatewayDataProviderLinux() { | 218 GatewayDataProviderLinux::GatewayDataProviderLinux() { |
| 219 } | 219 } |
| 220 | 220 |
| 221 GatewayDataProviderLinux::~GatewayDataProviderLinux() { | 221 GatewayDataProviderLinux::~GatewayDataProviderLinux() { |
| 222 } | 222 } |
| 223 | 223 |
| 224 GatewayDataProviderCommon::GatewayApiInterface* | 224 GatewayDataProviderCommon::GatewayApiInterface* |
| 225 GatewayDataProviderLinux::NewGatewayApi() { | 225 GatewayDataProviderLinux::NewGatewayApi() { |
| 226 return LinuxGatewayApi::Create(); | 226 return LinuxGatewayApi::Create(); |
| 227 } | 227 } |
| OLD | NEW |