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

Side by Side Diff: chrome/browser/component/web_contents_delegate_android/web_contents_delegate_android.cc

Issue 10907166: Upstream chromium side of modal dialogs for webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 "chrome/browser/component/web_contents_delegate_android/web_contents_de legate_android.h" 5 #include "chrome/browser/component/web_contents_delegate_android/web_contents_de legate_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 20 matching lines...) Expand all
31 using base::android::HasClass; 31 using base::android::HasClass;
32 using base::android::ScopedJavaLocalRef; 32 using base::android::ScopedJavaLocalRef;
33 using content::DownloadItem; 33 using content::DownloadItem;
34 using content::JavaScriptDialogCreator; 34 using content::JavaScriptDialogCreator;
35 using content::RenderViewHost; 35 using content::RenderViewHost;
36 using content::WebContents; 36 using content::WebContents;
37 37
38 namespace web_contents_delegate_android { 38 namespace web_contents_delegate_android {
39 39
40 WebContentsDelegateAndroid::WebContentsDelegateAndroid(JNIEnv* env, jobject obj) 40 WebContentsDelegateAndroid::WebContentsDelegateAndroid(JNIEnv* env, jobject obj)
41 : weak_java_delegate_(env, obj), 41 : weak_java_delegate_(env, obj) {
42 javascript_dialog_creator_(NULL) {
43 } 42 }
44 43
45 WebContentsDelegateAndroid::~WebContentsDelegateAndroid() { 44 WebContentsDelegateAndroid::~WebContentsDelegateAndroid() {
46 } 45 }
47 46
48 ScopedJavaLocalRef<jobject> 47 ScopedJavaLocalRef<jobject>
49 WebContentsDelegateAndroid::GetJavaDelegate(JNIEnv* env) const { 48 WebContentsDelegateAndroid::GetJavaDelegate(JNIEnv* env) const {
50 return weak_java_delegate_.get(env); 49 return weak_java_delegate_.get(env);
51 } 50 }
52 51
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 328
330 bool WebContentsDelegateAndroid::TakeFocus(WebContents* source, bool reverse) { 329 bool WebContentsDelegateAndroid::TakeFocus(WebContents* source, bool reverse) {
331 JNIEnv* env = AttachCurrentThread(); 330 JNIEnv* env = AttachCurrentThread();
332 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 331 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
333 if (obj.is_null()) 332 if (obj.is_null())
334 return WebContentsDelegate::TakeFocus(source, reverse); 333 return WebContentsDelegate::TakeFocus(source, reverse);
335 return Java_WebContentsDelegateAndroid_takeFocus( 334 return Java_WebContentsDelegateAndroid_takeFocus(
336 env, obj.obj(), reverse); 335 env, obj.obj(), reverse);
337 } 336 }
338 337
339 JavaScriptDialogCreator*
340 WebContentsDelegateAndroid::GetJavaScriptDialogCreator() {
341 return javascript_dialog_creator_;
342 }
343
344 // ---------------------------------------------------------------------------- 338 // ----------------------------------------------------------------------------
345 // Native JNI methods 339 // Native JNI methods
346 // ---------------------------------------------------------------------------- 340 // ----------------------------------------------------------------------------
347 341
348 // Register native methods 342 // Register native methods
349 343
350 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { 344 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) {
351 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { 345 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) {
352 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; 346 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!";
353 return false; 347 return false;
354 } 348 }
355 return RegisterNativesImpl(env); 349 return RegisterNativesImpl(env);
356 } 350 }
357 351
358 } // namespace web_contents_delegate_android 352 } // namespace web_contents_delegate_android
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698