Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: components/web_contents_delegate_android/web_contents_delegate_android.cc

Issue 1391893003: NOT FOR REVIEW: Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/web_contents_delegate_android/web_contents_delegate_android .h" 5 #include "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_array.h" 10 #include "base/android/jni_array.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (obj.is_null()) 241 if (obj.is_null())
242 return true; 242 return true;
243 return Java_WebContentsDelegateAndroid_onGoToEntryOffset(env, obj.obj(), 243 return Java_WebContentsDelegateAndroid_onGoToEntryOffset(env, obj.obj(),
244 offset); 244 offset);
245 } 245 }
246 246
247 void WebContentsDelegateAndroid::WebContentsCreated( 247 void WebContentsDelegateAndroid::WebContentsCreated(
248 WebContents* source_contents, int opener_render_frame_id, 248 WebContents* source_contents, int opener_render_frame_id,
249 const std::string& frame_name, const GURL& target_url, 249 const std::string& frame_name, const GURL& target_url,
250 WebContents* new_contents) { 250 WebContents* new_contents) {
251 #if !defined(USE_AURA)
251 JNIEnv* env = AttachCurrentThread(); 252 JNIEnv* env = AttachCurrentThread();
252 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 253 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
253 if (obj.is_null()) 254 if (obj.is_null())
254 return; 255 return;
255 256
256 ScopedJavaLocalRef<jobject> jsource_contents; 257 ScopedJavaLocalRef<jobject> jsource_contents;
257 if (source_contents) 258 if (source_contents)
258 jsource_contents = source_contents->GetJavaWebContents(); 259 jsource_contents = source_contents->GetJavaWebContents();
259 ScopedJavaLocalRef<jobject> jnew_contents; 260 ScopedJavaLocalRef<jobject> jnew_contents;
260 if (new_contents) 261 if (new_contents)
261 jnew_contents = new_contents->GetJavaWebContents(); 262 jnew_contents = new_contents->GetJavaWebContents();
262 263
263 Java_WebContentsDelegateAndroid_webContentsCreated( 264 Java_WebContentsDelegateAndroid_webContentsCreated(
264 env, 265 env,
265 obj.obj(), 266 obj.obj(),
266 jsource_contents.obj(), 267 jsource_contents.obj(),
267 opener_render_frame_id, 268 opener_render_frame_id,
268 base::android::ConvertUTF8ToJavaString(env, frame_name).Release(), 269 base::android::ConvertUTF8ToJavaString(env, frame_name).Release(),
269 base::android::ConvertUTF8ToJavaString(env, target_url.spec()).Release(), 270 base::android::ConvertUTF8ToJavaString(env, target_url.spec()).Release(),
270 jnew_contents.obj()); 271 jnew_contents.obj());
272 #endif
271 } 273 }
272 274
273 void WebContentsDelegateAndroid::CloseContents(WebContents* source) { 275 void WebContentsDelegateAndroid::CloseContents(WebContents* source) {
274 JNIEnv* env = AttachCurrentThread(); 276 JNIEnv* env = AttachCurrentThread();
275 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 277 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
276 if (obj.is_null()) 278 if (obj.is_null())
277 return; 279 return;
278 Java_WebContentsDelegateAndroid_closeContents(env, obj.obj()); 280 Java_WebContentsDelegateAndroid_closeContents(env, obj.obj());
279 } 281 }
280 282
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 ScopedJavaLocalRef<jstring> java_url = 341 ScopedJavaLocalRef<jstring> java_url =
340 ConvertUTF8ToJavaString(env, source->GetURL().spec()); 342 ConvertUTF8ToJavaString(env, source->GetURL().spec());
341 Java_WebContentsDelegateAndroid_onUpdateUrl(env, 343 Java_WebContentsDelegateAndroid_onUpdateUrl(env,
342 obj.obj(), 344 obj.obj(),
343 java_url.obj()); 345 java_url.obj());
344 } 346 }
345 347
346 void WebContentsDelegateAndroid::HandleKeyboardEvent( 348 void WebContentsDelegateAndroid::HandleKeyboardEvent(
347 WebContents* source, 349 WebContents* source,
348 const content::NativeWebKeyboardEvent& event) { 350 const content::NativeWebKeyboardEvent& event) {
349 jobject key_event = event.os_event; 351 jobject key_event = (jobject)event.os_event;
350 if (key_event) { 352 if (key_event) {
351 JNIEnv* env = AttachCurrentThread(); 353 JNIEnv* env = AttachCurrentThread();
352 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 354 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
353 if (obj.is_null()) 355 if (obj.is_null())
354 return; 356 return;
355 Java_WebContentsDelegateAndroid_handleKeyboardEvent( 357 Java_WebContentsDelegateAndroid_handleKeyboardEvent(
356 env, obj.obj(), key_event); 358 env, obj.obj(), key_event);
357 } 359 }
358 } 360 }
359 361
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // Native JNI methods 443 // Native JNI methods
442 // ---------------------------------------------------------------------------- 444 // ----------------------------------------------------------------------------
443 445
444 // Register native methods 446 // Register native methods
445 447
446 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { 448 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) {
447 return RegisterNativesImpl(env); 449 return RegisterNativesImpl(env);
448 } 450 }
449 451
450 } // namespace web_contents_delegate_android 452 } // namespace web_contents_delegate_android
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698