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

Side by Side Diff: content/browser/geolocation/device_data_provider.cc

Issue 10534120: Remove RadioData from geolocation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix content_unittests Created 8 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
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « content/browser/geolocation/device_data_provider.h ('k') | content/browser/geolocation/empty_device_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698