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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 content::RenderProcessHost* host = content::RenderProcessHost::FromID(*it); | 55 content::RenderProcessHost* host = content::RenderProcessHost::FromID(*it); |
56 if (host) // The process might have been killed since it was suspended. | 56 if (host) // The process might have been killed since it was suspended. |
57 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(false)); | 57 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(false)); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 // Returns the first substring consisting of the address of a physical location. | 63 // Returns the first substring consisting of the address of a physical location. |
64 static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) { | 64 static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) { |
65 string16 content_16 = ConvertJavaStringToUTF16(env, addr); | 65 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr); |
66 string16 result_16; | 66 base::string16 result_16; |
67 if (content::address_parser::FindAddress(content_16, &result_16)) | 67 if (content::address_parser::FindAddress(content_16, &result_16)) |
68 return ConvertUTF16ToJavaString(env, result_16).Release(); | 68 return ConvertUTF16ToJavaString(env, result_16).Release(); |
69 return NULL; | 69 return NULL; |
70 } | 70 } |
71 | 71 |
72 static void SetWebKitSharedTimersSuspended(JNIEnv* env, | 72 static void SetWebKitSharedTimersSuspended(JNIEnv* env, |
73 jclass obj, | 73 jclass obj, |
74 jboolean suspend) { | 74 jboolean suspend) { |
75 std::vector<int>* suspended_processes = g_suspended_processes.Pointer(); | 75 std::vector<int>* suspended_processes = g_suspended_processes.Pointer(); |
76 if (suspend) { | 76 if (suspend) { |
77 DCHECK(suspended_processes->empty()); | 77 DCHECK(suspended_processes->empty()); |
78 SuspendWebKitSharedTimers(suspended_processes); | 78 SuspendWebKitSharedTimers(suspended_processes); |
79 } else { | 79 } else { |
80 ResumeWebkitSharedTimers(*suspended_processes); | 80 ResumeWebkitSharedTimers(*suspended_processes); |
81 suspended_processes->clear(); | 81 suspended_processes->clear(); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 namespace content { | 85 namespace content { |
86 | 86 |
87 bool RegisterWebViewStatics(JNIEnv* env) { | 87 bool RegisterWebViewStatics(JNIEnv* env) { |
88 return RegisterNativesImpl(env) >= 0; | 88 return RegisterNativesImpl(env) >= 0; |
89 } | 89 } |
90 | 90 |
91 } // namespace content | 91 } // namespace content |
OLD | NEW |