| 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 #include "content/browser/time_zone_monitor.h" | 5 #include "content/browser/time_zone_monitor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void StartWatchingOnFileThread() { | 80 void StartWatchingOnFileThread() { |
| 81 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 81 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 82 | 82 |
| 83 // There is no true standard for where time zone information is actually | 83 // There is no true standard for where time zone information is actually |
| 84 // stored. glibc uses /etc/localtime, uClibc uses /etc/TZ, and some older | 84 // stored. glibc uses /etc/localtime, uClibc uses /etc/TZ, and some older |
| 85 // systems store the name of the time zone file within /usr/share/zoneinfo | 85 // systems store the name of the time zone file within /usr/share/zoneinfo |
| 86 // in /etc/timezone. Different libraries and custom builds may mean that | 86 // in /etc/timezone. Different libraries and custom builds may mean that |
| 87 // still more paths are used. Just watch all three of these paths, because | 87 // still more paths are used. Just watch all three of these paths, because |
| 88 // false positives are harmless, assuming the false positive rate is | 88 // false positives are harmless, assuming the false positive rate is |
| 89 // reasonable. | 89 // reasonable. |
| 90 const char* kFilesToWatch[] = { | 90 const char* const kFilesToWatch[] = { |
| 91 "/etc/localtime", | 91 "/etc/localtime", |
| 92 "/etc/timezone", | 92 "/etc/timezone", |
| 93 "/etc/TZ", | 93 "/etc/TZ", |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 for (size_t index = 0; index < arraysize(kFilesToWatch); ++index) { | 96 for (size_t index = 0; index < arraysize(kFilesToWatch); ++index) { |
| 97 file_path_watchers_.push_back(new base::FilePathWatcher()); | 97 file_path_watchers_.push_back(new base::FilePathWatcher()); |
| 98 file_path_watchers_.back()->Watch( | 98 file_path_watchers_.back()->Watch( |
| 99 base::FilePath(kFilesToWatch[index]), | 99 base::FilePath(kFilesToWatch[index]), |
| 100 false, | 100 false, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 | 160 |
| 161 // static | 161 // static |
| 162 scoped_ptr<TimeZoneMonitor> TimeZoneMonitor::Create() { | 162 scoped_ptr<TimeZoneMonitor> TimeZoneMonitor::Create() { |
| 163 return scoped_ptr<TimeZoneMonitor>(new TimeZoneMonitorLinux()); | 163 return scoped_ptr<TimeZoneMonitor>(new TimeZoneMonitorLinux()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace content | 166 } // namespace content |
| 167 | 167 |
| 168 #endif // !OS_CHROMEOS | 168 #endif // !OS_CHROMEOS |
| OLD | NEW |