OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_ | |
6 #define CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/macros.h" | |
10 #include "base/threading/thread_checker.h" | |
11 #include "chromeos/chromeos_export.h" | |
12 #include "url/gurl.h" | |
13 | |
14 class PrefRegistrySimple; | |
15 | |
16 namespace net { | |
17 class URLRequestContextGetter; | |
18 } | |
19 | |
20 namespace chromeos { | |
21 | |
22 struct TimeZoneResponseData; | |
23 | |
24 // This class implements periodic timezone synchronization. | |
25 class CHROMEOS_EXPORT TimeZoneResolver { | |
26 public: | |
27 class TimeZoneResolverImpl; | |
Bernhard Bauer
2015/01/05 10:22:33
This can be moved to the private section.
Alexander Alekseev
2015/01/15 18:59:03
It would lead to compilation error:
timezone_reso
| |
28 | |
29 // This callback will be called when new timezone arrives. | |
30 typedef base::Callback<void(const TimeZoneResponseData*)> | |
31 ApplyTimeZoneCallback; | |
32 | |
33 // chromeos::DelayNetworkCall cannot be used directly due to link | |
34 // restrictions. | |
35 typedef base::Callback<void(const base::Closure&)> DelayNetworkCallClosure; | |
36 | |
37 TimeZoneResolver(net::URLRequestContextGetter* context, | |
38 const GURL& url, | |
39 const ApplyTimeZoneCallback& apply_timezone, | |
40 const DelayNetworkCallClosure& delay_network_call); | |
41 ~TimeZoneResolver(); | |
42 | |
43 // Starts periodic timezone refresh. | |
44 void Start(); | |
45 | |
46 // Cancels current request and stops periodic timezone refresh. | |
47 void Stop(); | |
48 | |
49 private: | |
50 net::URLRequestContextGetter* const context_; | |
51 const GURL url_; | |
52 | |
53 const ApplyTimeZoneCallback apply_timezone_; | |
54 const DelayNetworkCallClosure delay_network_call_; | |
55 | |
56 TimeZoneResolverImpl* implementation_; | |
57 | |
58 base::ThreadChecker thread_checker_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(TimeZoneResolver); | |
61 }; | |
62 | |
63 } // namespace chromeos | |
64 | |
65 #endif // CHROMEOS_TIMEZONE_TIMEZONE_RESOLVER_H_ | |
OLD | NEW |