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 "content/components/web_contents_delegate_android/web_contents_delegate
_android.h" | 5 #include "content/components/web_contents_delegate_android/web_contents_delegate
_android.h" |
6 | 6 |
7 #include <android/keycodes.h> | 7 #include <android/keycodes.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 203 } |
204 return Java_WebContentsDelegateAndroid_addMessageToConsole( | 204 return Java_WebContentsDelegateAndroid_addMessageToConsole( |
205 env, | 205 env, |
206 GetJavaDelegate(env).obj(), | 206 GetJavaDelegate(env).obj(), |
207 jlevel, | 207 jlevel, |
208 jmessage.obj(), | 208 jmessage.obj(), |
209 line_no, | 209 line_no, |
210 jsource_id.obj()); | 210 jsource_id.obj()); |
211 } | 211 } |
212 | 212 |
213 // TODO(merge): WARNING! method no longer available on the base class. | |
214 // See http://crbug.com/149477 | |
215 void WebContentsDelegateAndroid::URLStarredChanged(WebContents* source, | |
216 bool starred) { | |
217 JNIEnv* env = AttachCurrentThread(); | |
218 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | |
219 if (obj.is_null()) | |
220 return; | |
221 Java_WebContentsDelegateAndroid_onUrlStarredChanged(env, obj.obj(), starred); | |
222 } | |
223 | |
224 // This is either called from TabContents::DidNavigateMainFramePostCommit() with | 213 // This is either called from TabContents::DidNavigateMainFramePostCommit() with |
225 // an empty GURL or responding to RenderViewHost::OnMsgUpateTargetURL(). In | 214 // an empty GURL or responding to RenderViewHost::OnMsgUpateTargetURL(). In |
226 // Chrome, the latter is not always called, especially not during history | 215 // Chrome, the latter is not always called, especially not during history |
227 // navigation. So we only handle the first case and pass the source TabContents' | 216 // navigation. So we only handle the first case and pass the source TabContents' |
228 // url to Java to update the UI. | 217 // url to Java to update the UI. |
229 void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source, | 218 void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source, |
230 int32 page_id, | 219 int32 page_id, |
231 const GURL& url) { | 220 const GURL& url) { |
232 if (!url.is_empty()) | 221 if (!url.is_empty()) |
233 return; | 222 return; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 297 |
309 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 298 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
310 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 299 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
311 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 300 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
312 return false; | 301 return false; |
313 } | 302 } |
314 return RegisterNativesImpl(env); | 303 return RegisterNativesImpl(env); |
315 } | 304 } |
316 | 305 |
317 } // namespace content | 306 } // namespace content |
OLD | NEW |