OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/time_zone_monitor_android.h" | |
6 | |
7 #include "base/android/jni_android.h" | |
8 #include "jni/TimeZoneMonitor_jni.h" | |
9 | |
10 namespace content { | |
11 | |
12 TimeZoneMonitorAndroid::TimeZoneMonitorAndroid() : TimeZoneMonitor() { | |
13 JNIEnv* env = base::android::AttachCurrentThread(); | |
14 impl_.Reset(Java_TimeZoneMonitor_getInstance( | |
bulach
2014/04/29 08:33:44
how about making getInstance() call start() if nee
Mark Mentovai
2014/04/29 16:01:05
bulach wrote:
| |
15 env, base::android::GetApplicationContext())); | |
16 Java_TimeZoneMonitor_start( | |
17 env, impl_.obj(), reinterpret_cast<intptr_t>(this)); | |
18 } | |
19 | |
20 TimeZoneMonitorAndroid::~TimeZoneMonitorAndroid() { | |
21 Java_TimeZoneMonitor_stop(base::android::AttachCurrentThread(), impl_.obj()); | |
22 } | |
23 | |
24 // static | |
25 bool TimeZoneMonitorAndroid::Register(JNIEnv* env) { | |
26 return RegisterNativesImpl(env); | |
27 } | |
28 | |
29 void TimeZoneMonitorAndroid::TimeZoneChangedFromJava(JNIEnv* env, | |
30 jobject caller) { | |
31 NotifyRenderers(); | |
32 } | |
33 | |
34 // static | |
35 scoped_ptr<TimeZoneMonitor> TimeZoneMonitor::Create() { | |
36 return scoped_ptr<TimeZoneMonitor>(new TimeZoneMonitorAndroid()); | |
37 } | |
38 | |
39 } // namespace content | |
OLD | NEW |