OLD | NEW |
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 CONTENT_BROWSER_TIME_ZONE_MONITOR_H_ | 5 #ifndef SERVICES_DEVICE_TIME_ZONE_MONITOR_TIME_ZONE_MONITOR_H_ |
6 #define CONTENT_BROWSER_TIME_ZONE_MONITOR_H_ | 6 #define SERVICES_DEVICE_TIME_ZONE_MONITOR_TIME_ZONE_MONITOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "device/time_zone_monitor/public/interfaces/time_zone_monitor.mojom.h" | |
13 #include "device/time_zone_monitor/time_zone_monitor_export.h" | |
14 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 13 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 14 #include "services/device/public/interfaces/time_zone_monitor.mojom.h" |
16 | 15 |
17 template <class T> | 16 template <class T> |
18 class scoped_refptr; | 17 class scoped_refptr; |
19 | 18 |
20 namespace base { | 19 namespace base { |
21 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
22 } | 21 } |
23 | 22 |
24 namespace device { | 23 namespace device { |
25 | 24 |
(...skipping 12 matching lines...) Expand all Loading... |
38 // content/zygote/zygote_main_linux.cc and HandleLocaltime in | 37 // content/zygote/zygote_main_linux.cc and HandleLocaltime in |
39 // content/browser/renderer_host/sandbox_ipc_linux.cc to override | 38 // content/browser/renderer_host/sandbox_ipc_linux.cc to override |
40 // localtime in renderer processes with custom code that calls | 39 // localtime in renderer processes with custom code that calls |
41 // localtime in the browser process via Chrome IPC. | 40 // localtime in the browser process via Chrome IPC. |
42 | 41 |
43 class TimeZoneMonitor : public device::mojom::TimeZoneMonitor { | 42 class TimeZoneMonitor : public device::mojom::TimeZoneMonitor { |
44 public: | 43 public: |
45 // Returns a new TimeZoneMonitor object (likely a subclass) specific to the | 44 // Returns a new TimeZoneMonitor object (likely a subclass) specific to the |
46 // platform. Inject |file_task_runner| to enable running blocking file | 45 // platform. Inject |file_task_runner| to enable running blocking file |
47 // operations on it when necessary. | 46 // operations on it when necessary. |
48 DEVICE_TIME_ZONE_MONITOR_EXPORT static std::unique_ptr<TimeZoneMonitor> | 47 static std::unique_ptr<TimeZoneMonitor> Create( |
49 Create(scoped_refptr<base::SequencedTaskRunner> file_task_runner); | 48 scoped_refptr<base::SequencedTaskRunner> file_task_runner); |
50 | 49 |
51 ~TimeZoneMonitor() override; | 50 ~TimeZoneMonitor() override; |
52 | 51 |
53 DEVICE_TIME_ZONE_MONITOR_EXPORT void Bind( | 52 void Bind(device::mojom::TimeZoneMonitorRequest request); |
54 device::mojom::TimeZoneMonitorRequest request); | |
55 | 53 |
56 protected: | 54 protected: |
57 TimeZoneMonitor(); | 55 TimeZoneMonitor(); |
58 | 56 |
59 // Notify all callbacks that the system time zone may have changed. | 57 // Notify all callbacks that the system time zone may have changed. |
60 void NotifyClients(); | 58 void NotifyClients(); |
61 | 59 |
62 private: | 60 private: |
63 base::ThreadChecker thread_checker_; | 61 base::ThreadChecker thread_checker_; |
64 | 62 |
65 // device::mojom::device::mojom::TimeZoneMonitor: | 63 // device::mojom::device::mojom::TimeZoneMonitor: |
66 void AddClient(device::mojom::TimeZoneMonitorClientPtr client) override; | 64 void AddClient(device::mojom::TimeZoneMonitorClientPtr client) override; |
67 | 65 |
68 mojo::BindingSet<device::mojom::TimeZoneMonitor> bindings_; | 66 mojo::BindingSet<device::mojom::TimeZoneMonitor> bindings_; |
69 mojo::InterfacePtrSet<device::mojom::TimeZoneMonitorClient> clients_; | 67 mojo::InterfacePtrSet<device::mojom::TimeZoneMonitorClient> clients_; |
70 DISALLOW_COPY_AND_ASSIGN(TimeZoneMonitor); | 68 DISALLOW_COPY_AND_ASSIGN(TimeZoneMonitor); |
71 }; | 69 }; |
72 | 70 |
73 } // namespace device | 71 } // namespace device |
74 | 72 |
75 #endif // CONTENT_BROWSER_TIME_ZONE_MONITOR_H_ | 73 #endif // SERVICES_DEVICE_TIME_ZONE_MONITOR_TIME_ZONE_MONITOR_H_ |
OLD | NEW |