1 // Copyright 2015 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.
5 #include "chromecast/base/android/system_time_change_notifier_android.h"
7 #include "jni/SystemTimeChangeNotifierAndroid_jni.h"
12 bool SystemTimeChangeNotifierAndroid::RegisterJni(JNIEnv
* env
) {
13 return RegisterNativesImpl(env
);
16 SystemTimeChangeNotifierAndroid::SystemTimeChangeNotifierAndroid() {
19 SystemTimeChangeNotifierAndroid::~SystemTimeChangeNotifierAndroid() {
22 void SystemTimeChangeNotifierAndroid::Initialize() {
23 JNIEnv
* env
= base::android::AttachCurrentThread();
24 java_notifier_
.Reset(Java_SystemTimeChangeNotifierAndroid_create(
25 env
, base::android::GetApplicationContext()));
26 Java_SystemTimeChangeNotifierAndroid_initializeFromNative(
27 env
, java_notifier_
.obj(), reinterpret_cast<jlong
>(this));
30 void SystemTimeChangeNotifierAndroid::Finalize() {
31 JNIEnv
* env
= base::android::AttachCurrentThread();
32 Java_SystemTimeChangeNotifierAndroid_finalizeFromNative(
33 env
, java_notifier_
.obj());
36 void SystemTimeChangeNotifierAndroid::OnTimeChanged(JNIEnv
* env
, jobject jobj
) {
37 NotifySystemTimeChanged();
40 } // namespace chromecast