| 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 jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) { |
| 100 jclass clazz, | |
| 101 jstring addr) { | |
| 102 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr); | 100 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr); |
| 103 base::string16 result_16; | 101 base::string16 result_16; |
| 104 if (content::address_parser::FindAddress(content_16, &result_16)) | 102 if (content::address_parser::FindAddress(content_16, &result_16)) |
| 105 return ConvertUTF16ToJavaString(env, result_16); | 103 return ConvertUTF16ToJavaString(env, result_16).Release(); |
| 106 return ScopedJavaLocalRef<jstring>(); | 104 return NULL; |
| 107 } | 105 } |
| 108 | 106 |
| 109 static void SetWebKitSharedTimersSuspended(JNIEnv* env, | 107 static void SetWebKitSharedTimersSuspended(JNIEnv* env, |
| 110 jclass obj, | 108 jclass obj, |
| 111 jboolean suspend) { | 109 jboolean suspend) { |
| 112 if (suspend) { | 110 if (suspend) { |
| 113 g_suspended_processes_watcher.Pointer()->SuspendWebKitSharedTimers(); | 111 g_suspended_processes_watcher.Pointer()->SuspendWebKitSharedTimers(); |
| 114 } else { | 112 } else { |
| 115 g_suspended_processes_watcher.Pointer()->ResumeWebkitSharedTimers(); | 113 g_suspended_processes_watcher.Pointer()->ResumeWebkitSharedTimers(); |
| 116 } | 114 } |
| 117 } | 115 } |
| 118 | 116 |
| 119 namespace content { | 117 namespace content { |
| 120 | 118 |
| 121 bool RegisterWebViewStatics(JNIEnv* env) { | 119 bool RegisterWebViewStatics(JNIEnv* env) { |
| 122 return RegisterNativesImpl(env); | 120 return RegisterNativesImpl(env); |
| 123 } | 121 } |
| 124 | 122 |
| 125 } // namespace content | 123 } // namespace content |
| OLD | NEW |