blob: 2aa8bdf549077c1ec318bd4abf1cb59bd567a1f1 [file] [log] [blame]
// Copyright 2015 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 "chromecast/base/android/system_time_change_notifier_android.h"
#include "jni/SystemTimeChangeNotifierAndroid_jni.h"
using base::android::JavaParamRef;
namespace chromecast {
// static
bool SystemTimeChangeNotifierAndroid::RegisterJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}
SystemTimeChangeNotifierAndroid::SystemTimeChangeNotifierAndroid() {
}
SystemTimeChangeNotifierAndroid::~SystemTimeChangeNotifierAndroid() {
}
void SystemTimeChangeNotifierAndroid::Initialize() {
JNIEnv* env = base::android::AttachCurrentThread();
java_notifier_.Reset(Java_SystemTimeChangeNotifierAndroid_create(env));
Java_SystemTimeChangeNotifierAndroid_initializeFromNative(
env, java_notifier_, reinterpret_cast<jlong>(this));
}
void SystemTimeChangeNotifierAndroid::Finalize() {
JNIEnv* env = base::android::AttachCurrentThread();
Java_SystemTimeChangeNotifierAndroid_finalizeFromNative(env, java_notifier_);
}
void SystemTimeChangeNotifierAndroid::OnTimeChanged(
JNIEnv* env,
const JavaParamRef<jobject>& jobj) {
NotifySystemTimeChanged();
}
} // namespace chromecast