| 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 "android_webview/native/aw_web_contents_delegate.h" | 5 #include "android_webview/native/aw_web_contents_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_javascript_dialog_manager.h" | 7 #include "android_webview/browser/aw_javascript_dialog_manager.h" |
| 8 #include "android_webview/browser/find_helper.h" | 8 #include "android_webview/browser/find_helper.h" |
| 9 #include "android_webview/native/aw_contents.h" | 9 #include "android_webview/native/aw_contents.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 void AwWebContentsDelegate::ActivateContents(WebContents* contents) { | 170 void AwWebContentsDelegate::ActivateContents(WebContents* contents) { |
| 171 JNIEnv* env = AttachCurrentThread(); | 171 JNIEnv* env = AttachCurrentThread(); |
| 172 | 172 |
| 173 ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env); | 173 ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env); |
| 174 if (java_delegate.obj()) { | 174 if (java_delegate.obj()) { |
| 175 Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj()); | 175 Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj()); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 void AwWebContentsDelegate::UpdatePreferredSize( | |
| 180 WebContents* web_contents, | |
| 181 const gfx::Size& pref_size) { | |
| 182 JNIEnv* env = AttachCurrentThread(); | |
| 183 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | |
| 184 if (obj.is_null()) | |
| 185 return; | |
| 186 return Java_AwWebContentsDelegate_updatePreferredSize( | |
| 187 env, obj.obj(), pref_size.width(), pref_size.height()); | |
| 188 } | |
| 189 | |
| 190 static void FilesSelectedInChooser( | 179 static void FilesSelectedInChooser( |
| 191 JNIEnv* env, jclass clazz, | 180 JNIEnv* env, jclass clazz, |
| 192 jint process_id, jint render_id, jint mode_flags, | 181 jint process_id, jint render_id, jint mode_flags, |
| 193 jobjectArray file_paths) { | 182 jobjectArray file_paths) { |
| 194 content::RenderViewHost* rvh = content::RenderViewHost::FromID(process_id, | 183 content::RenderViewHost* rvh = content::RenderViewHost::FromID(process_id, |
| 195 render_id); | 184 render_id); |
| 196 if (!rvh) | 185 if (!rvh) |
| 197 return; | 186 return; |
| 198 | 187 |
| 199 std::vector<std::string> file_path_str; | 188 std::vector<std::string> file_path_str; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 217 LOG(INFO) << "File Chooser result: mode = " << mode | 206 LOG(INFO) << "File Chooser result: mode = " << mode |
| 218 << ", file paths = " << JoinString(file_path_str, ":"); | 207 << ", file paths = " << JoinString(file_path_str, ":"); |
| 219 rvh->FilesSelectedInChooser(files, mode); | 208 rvh->FilesSelectedInChooser(files, mode); |
| 220 } | 209 } |
| 221 | 210 |
| 222 bool RegisterAwWebContentsDelegate(JNIEnv* env) { | 211 bool RegisterAwWebContentsDelegate(JNIEnv* env) { |
| 223 return RegisterNativesImpl(env); | 212 return RegisterNativesImpl(env); |
| 224 } | 213 } |
| 225 | 214 |
| 226 } // namespace android_webview | 215 } // namespace android_webview |
| OLD | NEW |