| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <jni.h> | 5 #include <jni.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 std::vector<int /* RenderProcessHost id */> suspended_processes_; | 90 std::vector<int /* RenderProcessHost id */> suspended_processes_; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 base::LazyInstance<SuspendedProcessWatcher> g_suspended_processes_watcher = | 93 base::LazyInstance<SuspendedProcessWatcher> g_suspended_processes_watcher = |
| 94 LAZY_INSTANCE_INITIALIZER; | 94 LAZY_INSTANCE_INITIALIZER; |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| 97 | 97 |
| 98 // Returns the first substring consisting of the address of a physical location. | 98 // Returns the first substring consisting of the address of a physical location. |
| 99 static ScopedJavaLocalRef<jstring> FindAddress(JNIEnv* env, | 99 static ScopedJavaLocalRef<jstring> FindAddress( |
| 100 jclass clazz, | 100 JNIEnv* env, |
| 101 jstring addr) { | 101 const JavaParamRef<jclass>& clazz, |
| 102 const JavaParamRef<jstring>& addr) { |
| 102 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr); | 103 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr); |
| 103 base::string16 result_16; | 104 base::string16 result_16; |
| 104 if (content::address_parser::FindAddress(content_16, &result_16)) | 105 if (content::address_parser::FindAddress(content_16, &result_16)) |
| 105 return ConvertUTF16ToJavaString(env, result_16); | 106 return ConvertUTF16ToJavaString(env, result_16); |
| 106 return ScopedJavaLocalRef<jstring>(); | 107 return ScopedJavaLocalRef<jstring>(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 static void SetWebKitSharedTimersSuspended(JNIEnv* env, | 110 static void SetWebKitSharedTimersSuspended(JNIEnv* env, |
| 110 jclass obj, | 111 const JavaParamRef<jclass>& obj, |
| 111 jboolean suspend) { | 112 jboolean suspend) { |
| 112 if (suspend) { | 113 if (suspend) { |
| 113 g_suspended_processes_watcher.Pointer()->SuspendWebKitSharedTimers(); | 114 g_suspended_processes_watcher.Pointer()->SuspendWebKitSharedTimers(); |
| 114 } else { | 115 } else { |
| 115 g_suspended_processes_watcher.Pointer()->ResumeWebkitSharedTimers(); | 116 g_suspended_processes_watcher.Pointer()->ResumeWebkitSharedTimers(); |
| 116 } | 117 } |
| 117 } | 118 } |
| 118 | 119 |
| 119 namespace content { | 120 namespace content { |
| 120 | 121 |
| 121 bool RegisterWebViewStatics(JNIEnv* env) { | 122 bool RegisterWebViewStatics(JNIEnv* env) { |
| 122 return RegisterNativesImpl(env); | 123 return RegisterNativesImpl(env); |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace content | 126 } // namespace content |
| OLD | NEW |