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 "chrome/browser/android/chrome_web_contents_delegate_android.h" | 5 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/android/feature_utilities.h" | 10 #include "chrome/browser/android/feature_utilities.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 40 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
41 #endif | 41 #endif |
42 | 42 |
43 using base::android::AttachCurrentThread; | 43 using base::android::AttachCurrentThread; |
44 using base::android::ScopedJavaLocalRef; | 44 using base::android::ScopedJavaLocalRef; |
45 using content::FileChooserParams; | 45 using content::FileChooserParams; |
46 using content::WebContents; | 46 using content::WebContents; |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 ScopedJavaLocalRef<jobject> CreateJavaRectF( | 50 //ScopedJavaLocalRef<jobject> CreateJavaRectF( |
51 JNIEnv* env, | 51 // JNIEnv* env, |
52 const gfx::RectF& rect) { | 52 // const gfx::RectF& rect) { |
53 return ScopedJavaLocalRef<jobject>( | 53 // return ScopedJavaLocalRef<jobject>( |
54 Java_ChromeWebContentsDelegateAndroid_createRectF(env, | 54 // Java_ChromeWebContentsDelegateAndroid_createRectF(env, |
55 rect.x(), | 55 // rect.x(), |
56 rect.y(), | 56 // rect.y(), |
57 rect.right(), | 57 // rect.right(), |
58 rect.bottom())); | 58 // rect.bottom())); |
59 } | 59 //} |
60 | 60 |
61 ScopedJavaLocalRef<jobject> CreateJavaRect( | 61 ScopedJavaLocalRef<jobject> CreateJavaRect( |
62 JNIEnv* env, | 62 JNIEnv* env, |
63 const gfx::Rect& rect) { | 63 const gfx::Rect& rect) { |
64 return ScopedJavaLocalRef<jobject>( | 64 return ScopedJavaLocalRef<jobject>( |
65 Java_ChromeWebContentsDelegateAndroid_createRect( | 65 Java_ChromeWebContentsDelegateAndroid_createRect( |
66 env, | 66 env, |
67 static_cast<int>(rect.x()), | 67 static_cast<int>(rect.x()), |
68 static_cast<int>(rect.y()), | 68 static_cast<int>(rect.y()), |
69 static_cast<int>(rect.right()), | 69 static_cast<int>(rect.right()), |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 obj.obj()); | 317 obj.obj()); |
318 } | 318 } |
319 | 319 |
320 void ChromeWebContentsDelegateAndroid::AddNewContents( | 320 void ChromeWebContentsDelegateAndroid::AddNewContents( |
321 WebContents* source, | 321 WebContents* source, |
322 WebContents* new_contents, | 322 WebContents* new_contents, |
323 WindowOpenDisposition disposition, | 323 WindowOpenDisposition disposition, |
324 const gfx::Rect& initial_rect, | 324 const gfx::Rect& initial_rect, |
325 bool user_gesture, | 325 bool user_gesture, |
326 bool* was_blocked) { | 326 bool* was_blocked) { |
| 327 #if !defined(USE_AURA) |
327 // No code for this yet. | 328 // No code for this yet. |
328 DCHECK_NE(disposition, SAVE_TO_DISK); | 329 DCHECK_NE(disposition, SAVE_TO_DISK); |
329 // Can't create a new contents for the current tab - invalid case. | 330 // Can't create a new contents for the current tab - invalid case. |
330 DCHECK_NE(disposition, CURRENT_TAB); | 331 DCHECK_NE(disposition, CURRENT_TAB); |
331 | 332 |
332 TabHelpers::AttachTabHelpers(new_contents); | 333 TabHelpers::AttachTabHelpers(new_contents); |
333 | 334 |
334 JNIEnv* env = AttachCurrentThread(); | 335 JNIEnv* env = AttachCurrentThread(); |
335 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 336 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
336 bool handled = false; | 337 bool handled = false; |
(...skipping 12 matching lines...) Expand all Loading... |
349 jnew_contents.obj(), | 350 jnew_contents.obj(), |
350 static_cast<jint>(disposition), | 351 static_cast<jint>(disposition), |
351 NULL, | 352 NULL, |
352 user_gesture); | 353 user_gesture); |
353 } | 354 } |
354 | 355 |
355 if (was_blocked) | 356 if (was_blocked) |
356 *was_blocked = !handled; | 357 *was_blocked = !handled; |
357 if (!handled) | 358 if (!handled) |
358 delete new_contents; | 359 delete new_contents; |
| 360 #endif |
359 } | 361 } |
360 | 362 |
361 } // namespace android | 363 } // namespace android |
362 } // namespace chrome | 364 } // namespace chrome |
363 | 365 |
364 jboolean IsCapturingAudio(JNIEnv* env, | 366 jboolean IsCapturingAudio(JNIEnv* env, |
365 jclass clazz, | 367 jclass clazz, |
366 jobject java_web_contents) { | 368 jobject java_web_contents) { |
| 369 #if !defined(USE_AURA) |
367 content::WebContents* web_contents = | 370 content::WebContents* web_contents = |
368 content::WebContents::FromJavaWebContents(java_web_contents); | 371 content::WebContents::FromJavaWebContents(java_web_contents); |
369 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 372 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
370 MediaCaptureDevicesDispatcher::GetInstance()-> | 373 MediaCaptureDevicesDispatcher::GetInstance()-> |
371 GetMediaStreamCaptureIndicator(); | 374 GetMediaStreamCaptureIndicator(); |
372 return indicator->IsCapturingAudio(web_contents); | 375 return indicator->IsCapturingAudio(web_contents); |
| 376 #else |
| 377 return true; |
| 378 #endif |
373 } | 379 } |
374 | 380 |
375 jboolean IsCapturingVideo(JNIEnv* env, | 381 jboolean IsCapturingVideo(JNIEnv* env, |
376 jclass clazz, | 382 jclass clazz, |
377 jobject java_web_contents) { | 383 jobject java_web_contents) { |
| 384 #if !defined(USE_AURA) |
378 content::WebContents* web_contents = | 385 content::WebContents* web_contents = |
379 content::WebContents::FromJavaWebContents(java_web_contents); | 386 content::WebContents::FromJavaWebContents(java_web_contents); |
380 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 387 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
381 MediaCaptureDevicesDispatcher::GetInstance()-> | 388 MediaCaptureDevicesDispatcher::GetInstance()-> |
382 GetMediaStreamCaptureIndicator(); | 389 GetMediaStreamCaptureIndicator(); |
383 return indicator->IsCapturingVideo(web_contents); | 390 return indicator->IsCapturingVideo(web_contents); |
| 391 #else |
| 392 return true; |
| 393 #endif |
384 } | 394 } |
385 | 395 |
386 jboolean HasAudibleAudio(JNIEnv* env, | 396 jboolean HasAudibleAudio(JNIEnv* env, |
387 jclass clazz, | 397 jclass clazz, |
388 jobject java_web_contents) { | 398 jobject java_web_contents) { |
| 399 #if !defined(USE_AURA) |
389 content::WebContents* web_contents = | 400 content::WebContents* web_contents = |
390 content::WebContents::FromJavaWebContents(java_web_contents); | 401 content::WebContents::FromJavaWebContents(java_web_contents); |
391 return web_contents->WasRecentlyAudible(); | 402 return web_contents->WasRecentlyAudible(); |
| 403 #else |
| 404 return true; |
| 405 #endif |
392 } | 406 } |
OLD | NEW |