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

Unified Diff: device/time_zone_monitor/time_zone_monitor.cc

Issue 2690963002: [DeviceService] Move //device/time_zone_monitor to //services/device (Closed)
Patch Set: Enable device service to register JNI 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/time_zone_monitor/time_zone_monitor.h ('k') | device/time_zone_monitor/time_zone_monitor_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/time_zone_monitor/time_zone_monitor.cc
diff --git a/device/time_zone_monitor/time_zone_monitor.cc b/device/time_zone_monitor/time_zone_monitor.cc
deleted file mode 100644
index 0e671b4ddc0f7eadc73a677e4d73ae9acecb31e3..0000000000000000000000000000000000000000
--- a/device/time_zone_monitor/time_zone_monitor.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/time_zone_monitor/time_zone_monitor.h"
-
-#include "base/logging.h"
-#include "build/build_config.h"
-#include "third_party/icu/source/common/unicode/unistr.h"
-#include "third_party/icu/source/i18n/unicode/timezone.h"
-
-namespace device {
-
-TimeZoneMonitor::TimeZoneMonitor() {
- DCHECK(thread_checker_.CalledOnValidThread());
-}
-
-TimeZoneMonitor::~TimeZoneMonitor() {
- DCHECK(thread_checker_.CalledOnValidThread());
-}
-
-void TimeZoneMonitor::Bind(device::mojom::TimeZoneMonitorRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void TimeZoneMonitor::NotifyClients() {
- DCHECK(thread_checker_.CalledOnValidThread());
-#if defined(OS_CHROMEOS)
- // On CrOS, ICU's default tz is already set to a new zone. No
- // need to redetect it with detectHostTimeZone().
- std::unique_ptr<icu::TimeZone> new_zone(icu::TimeZone::createDefault());
-#else
- icu::TimeZone* new_zone = icu::TimeZone::detectHostTimeZone();
-#if defined(OS_LINUX)
- // We get here multiple times on Linux per a single tz change, but
- // want to update the ICU default zone and notify renderer only once.
- std::unique_ptr<icu::TimeZone> current_zone(icu::TimeZone::createDefault());
- if (*current_zone == *new_zone) {
- VLOG(1) << "timezone already updated";
- delete new_zone;
- return;
- }
-#endif
- icu::TimeZone::adoptDefault(new_zone);
-#endif
- icu::UnicodeString zone_id;
- std::string zone_id_str;
- new_zone->getID(zone_id).toUTF8String(zone_id_str);
- VLOG(1) << "timezone reset to " << zone_id_str;
-
- clients_.ForAllPtrs(
- [&zone_id_str](device::mojom::TimeZoneMonitorClient* client) {
- client->OnTimeZoneChange(zone_id_str);
- });
-}
-
-void TimeZoneMonitor::AddClient(
- device::mojom::TimeZoneMonitorClientPtr client) {
- clients_.AddPtr(std::move(client));
-}
-
-} // namespace device
« no previous file with comments | « device/time_zone_monitor/time_zone_monitor.h ('k') | device/time_zone_monitor/time_zone_monitor_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698