| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/browser/geolocation/device_data_provider.h" | 5 #include "content/browser/geolocation/device_data_provider.h" |
| 6 | 6 |
| 7 // statics | 7 // statics |
| 8 template<> DeviceDataProvider<RadioData>* | |
| 9 DeviceDataProvider<RadioData>::instance_ = NULL; | |
| 10 template<> DeviceDataProvider<RadioData>::ImplFactoryFunction | |
| 11 DeviceDataProvider<RadioData>::factory_function_ = DefaultFactoryFunction; | |
| 12 template<> DeviceDataProvider<WifiData>* | 8 template<> DeviceDataProvider<WifiData>* |
| 13 DeviceDataProvider<WifiData>::instance_ = NULL; | 9 DeviceDataProvider<WifiData>::instance_ = NULL; |
| 14 template<> DeviceDataProvider<WifiData>::ImplFactoryFunction | 10 template<> DeviceDataProvider<WifiData>::ImplFactoryFunction |
| 15 DeviceDataProvider<WifiData>::factory_function_ = DefaultFactoryFunction; | 11 DeviceDataProvider<WifiData>::factory_function_ = DefaultFactoryFunction; |
| 16 | 12 |
| 17 namespace { | |
| 18 | |
| 19 bool CellDataMatches(const CellData &data1, const CellData &data2) { | |
| 20 return data1.Matches(data2); | |
| 21 } | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 CellData::CellData() | |
| 26 : cell_id(kint32min), | |
| 27 location_area_code(kint32min), | |
| 28 mobile_network_code(kint32min), | |
| 29 mobile_country_code(kint32min), | |
| 30 radio_signal_strength(kint32min), | |
| 31 timing_advance(kint32min) { | |
| 32 } | |
| 33 | |
| 34 RadioData::RadioData() | |
| 35 : home_mobile_network_code(kint32min), | |
| 36 home_mobile_country_code(kint32min), | |
| 37 radio_type(RADIO_TYPE_UNKNOWN) { | |
| 38 } | |
| 39 | |
| 40 RadioData::~RadioData() {} | |
| 41 | |
| 42 bool RadioData::Matches(const RadioData &other) const { | |
| 43 if (cell_data.size() != other.cell_data.size()) { | |
| 44 return false; | |
| 45 } | |
| 46 if (!std::equal(cell_data.begin(), cell_data.end(), other.cell_data.begin(), | |
| 47 CellDataMatches)) { | |
| 48 return false; | |
| 49 } | |
| 50 return device_id == other.device_id && | |
| 51 home_mobile_network_code == other.home_mobile_network_code && | |
| 52 home_mobile_country_code == other.home_mobile_country_code && | |
| 53 radio_type == other.radio_type && | |
| 54 carrier == other.carrier; | |
| 55 } | |
| 56 | |
| 57 AccessPointData::AccessPointData() | 13 AccessPointData::AccessPointData() |
| 58 : radio_signal_strength(kint32min), | 14 : radio_signal_strength(kint32min), |
| 59 channel(kint32min), | 15 channel(kint32min), |
| 60 signal_to_noise(kint32min) { | 16 signal_to_noise(kint32min) { |
| 61 } | 17 } |
| 62 | 18 |
| 63 AccessPointData::~AccessPointData() {} | 19 AccessPointData::~AccessPointData() {} |
| 64 | 20 |
| 65 WifiData::WifiData() {} | 21 WifiData::WifiData() {} |
| 66 | 22 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 85 if (other.access_point_data.find(*iter) != | 41 if (other.access_point_data.find(*iter) != |
| 86 other.access_point_data.end()) { | 42 other.access_point_data.end()) { |
| 87 ++num_common; | 43 ++num_common; |
| 88 } | 44 } |
| 89 } | 45 } |
| 90 DCHECK(num_common <= min_ap_count); | 46 DCHECK(num_common <= min_ap_count); |
| 91 | 47 |
| 92 // Test how many have changed. | 48 // Test how many have changed. |
| 93 return max_ap_count > num_common + difference_threadhold; | 49 return max_ap_count > num_common + difference_threadhold; |
| 94 } | 50 } |
| OLD | NEW |