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

Side by Side Diff: chromeos/timezone/timezone_resolver.h

Issue 2624843003: Add support for cellular geolocation (Closed)
Patch Set: Update device tests to use correct dict key Created 3 years, 10 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
« no previous file with comments | « chromeos/network/network_util.cc ('k') | chromeos/timezone/timezone_resolver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_ 5 #ifndef CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_
6 #define CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_ 6 #define CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 24 matching lines...) Expand all
35 using DelayNetworkCallClosure = base::Callback<void(const base::Closure&)>; 35 using DelayNetworkCallClosure = base::Callback<void(const base::Closure&)>;
36 36
37 class Delegate { 37 class Delegate {
38 public: 38 public:
39 Delegate(); 39 Delegate();
40 virtual ~Delegate(); 40 virtual ~Delegate();
41 41
42 // Returns true if TimeZoneResolver should include WiFi data in request. 42 // Returns true if TimeZoneResolver should include WiFi data in request.
43 virtual bool ShouldSendWiFiGeolocationData() = 0; 43 virtual bool ShouldSendWiFiGeolocationData() = 0;
44 44
45 // Returns true if TimeZoneResolver should include Cellular data in request.
46 virtual bool ShouldSendCellularGeolocationData() = 0;
47
45 private: 48 private:
46 DISALLOW_COPY_AND_ASSIGN(Delegate); 49 DISALLOW_COPY_AND_ASSIGN(Delegate);
47 }; 50 };
48 51
49 // This is a LocalState preference to store base::Time value of the last 52 // This is a LocalState preference to store base::Time value of the last
50 // request. It is used to limit request rate on browser restart. 53 // request. It is used to limit request rate on browser restart.
51 static const char kLastTimeZoneRefreshTime[]; 54 static const char kLastTimeZoneRefreshTime[];
52 55
53 TimeZoneResolver(Delegate* delegate, 56 TimeZoneResolver(Delegate* delegate,
54 scoped_refptr<net::URLRequestContextGetter> context, 57 scoped_refptr<net::URLRequestContextGetter> context,
(...skipping 20 matching lines...) Expand all
75 return delay_network_call_; 78 return delay_network_call_;
76 } 79 }
77 80
78 ApplyTimeZoneCallback apply_timezone() const { return apply_timezone_; } 81 ApplyTimeZoneCallback apply_timezone() const { return apply_timezone_; }
79 82
80 PrefService* local_state() const { return local_state_; } 83 PrefService* local_state() const { return local_state_; }
81 84
82 // Proxy call to Delegate::ShouldSendWiFiGeolocationData(). 85 // Proxy call to Delegate::ShouldSendWiFiGeolocationData().
83 bool ShouldSendWiFiGeolocationData() const; 86 bool ShouldSendWiFiGeolocationData() const;
84 87
88 // Proxy call to Delegate::ShouldSendCellularGeolocationData().
89 bool ShouldSendCellularGeolocationData() const;
90
85 // Expose internal fuctions for testing. 91 // Expose internal fuctions for testing.
86 static int MaxRequestsCountForIntervalForTesting( 92 static int MaxRequestsCountForIntervalForTesting(
87 const double interval_seconds); 93 const double interval_seconds);
88 static int IntervalForNextRequestForTesting(const int requests); 94 static int IntervalForNextRequestForTesting(const int requests);
89 95
90 private: 96 private:
91 Delegate* delegate_; 97 Delegate* delegate_;
92 98
93 scoped_refptr<net::URLRequestContextGetter> context_; 99 scoped_refptr<net::URLRequestContextGetter> context_;
94 const GURL url_; 100 const GURL url_;
95 101
96 const ApplyTimeZoneCallback apply_timezone_; 102 const ApplyTimeZoneCallback apply_timezone_;
97 const DelayNetworkCallClosure delay_network_call_; 103 const DelayNetworkCallClosure delay_network_call_;
98 PrefService* local_state_; 104 PrefService* local_state_;
99 105
100 std::unique_ptr<TimeZoneResolverImpl> implementation_; 106 std::unique_ptr<TimeZoneResolverImpl> implementation_;
101 107
102 base::ThreadChecker thread_checker_; 108 base::ThreadChecker thread_checker_;
103 109
104 DISALLOW_COPY_AND_ASSIGN(TimeZoneResolver); 110 DISALLOW_COPY_AND_ASSIGN(TimeZoneResolver);
105 }; 111 };
106 112
107 } // namespace chromeos 113 } // namespace chromeos
108 114
109 #endif // CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_ 115 #endif // CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_
OLDNEW
« no previous file with comments | « chromeos/network/network_util.cc ('k') | chromeos/timezone/timezone_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698