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" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/file_select_helper.h" | 12 #include "chrome/browser/file_select_helper.h" |
13 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 13 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
14 #include "chrome/browser/media/media_stream_capture_indicator.h" | 14 #include "chrome/browser/media/media_stream_capture_indicator.h" |
15 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 15 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
16 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" | 16 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" |
17 #include "chrome/browser/prerender/prerender_manager.h" | 17 #include "chrome/browser/prerender/prerender_manager.h" |
18 #include "chrome/browser/prerender/prerender_manager_factory.h" | 18 #include "chrome/browser/prerender/prerender_manager_factory.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/android/bluetooth_chooser_android.h" |
20 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 21 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
21 #include "chrome/browser/ui/browser_navigator.h" | 22 #include "chrome/browser/ui/browser_navigator.h" |
22 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 23 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
23 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 24 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
24 #include "chrome/browser/ui/tab_helpers.h" | 25 #include "chrome/browser/ui/tab_helpers.h" |
25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
26 #include "components/app_modal/javascript_dialog_manager.h" | 27 #include "components/app_modal/javascript_dialog_manager.h" |
27 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_source.h" | 30 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
32 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
33 #include "content/public/common/file_chooser_params.h" | 34 #include "content/public/common/file_chooser_params.h" |
34 #include "jni/ChromeWebContentsDelegateAndroid_jni.h" | 35 #include "jni/ChromeWebContentsDelegateAndroid_jni.h" |
35 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 36 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
36 #include "ui/gfx/geometry/rect.h" | 37 #include "ui/gfx/geometry/rect.h" |
37 #include "ui/gfx/geometry/rect_f.h" | 38 #include "ui/gfx/geometry/rect_f.h" |
38 | 39 |
39 #if defined(ENABLE_PLUGINS) | 40 #if defined(ENABLE_PLUGINS) |
40 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 41 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
41 #endif | 42 #endif |
42 | 43 |
43 using base::android::AttachCurrentThread; | 44 using base::android::AttachCurrentThread; |
44 using base::android::ScopedJavaLocalRef; | 45 using base::android::ScopedJavaLocalRef; |
| 46 using content::BluetoothChooser; |
45 using content::FileChooserParams; | 47 using content::FileChooserParams; |
46 using content::WebContents; | 48 using content::WebContents; |
47 | 49 |
48 namespace { | 50 namespace { |
49 | 51 |
50 ScopedJavaLocalRef<jobject> CreateJavaRectF( | 52 ScopedJavaLocalRef<jobject> CreateJavaRectF( |
51 JNIEnv* env, | 53 JNIEnv* env, |
52 const gfx::RectF& rect) { | 54 const gfx::RectF& rect) { |
53 return ScopedJavaLocalRef<jobject>( | 55 return ScopedJavaLocalRef<jobject>( |
54 Java_ChromeWebContentsDelegateAndroid_createRectF(env, | 56 Java_ChromeWebContentsDelegateAndroid_createRectF(env, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 source, to_different_document); | 98 source, to_different_document); |
97 LoadProgressChanged(source, has_stopped ? 1 : 0); | 99 LoadProgressChanged(source, has_stopped ? 1 : 0); |
98 } | 100 } |
99 | 101 |
100 void ChromeWebContentsDelegateAndroid::RunFileChooser( | 102 void ChromeWebContentsDelegateAndroid::RunFileChooser( |
101 WebContents* web_contents, | 103 WebContents* web_contents, |
102 const FileChooserParams& params) { | 104 const FileChooserParams& params) { |
103 FileSelectHelper::RunFileChooser(web_contents, params); | 105 FileSelectHelper::RunFileChooser(web_contents, params); |
104 } | 106 } |
105 | 107 |
| 108 scoped_ptr<BluetoothChooser> |
| 109 ChromeWebContentsDelegateAndroid::RunBluetoothChooser( |
| 110 content::WebContents* web_contents, |
| 111 const BluetoothChooser::EventHandler& event_handler, |
| 112 const GURL& origin) { |
| 113 return make_scoped_ptr( |
| 114 new BluetoothChooserAndroid(web_contents, event_handler, origin)); |
| 115 } |
| 116 |
106 void ChromeWebContentsDelegateAndroid::CloseContents( | 117 void ChromeWebContentsDelegateAndroid::CloseContents( |
107 WebContents* web_contents) { | 118 WebContents* web_contents) { |
108 // Prevent dangling registrations assigned to closed web contents. | 119 // Prevent dangling registrations assigned to closed web contents. |
109 if (notification_registrar_.IsRegistered(this, | 120 if (notification_registrar_.IsRegistered(this, |
110 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 121 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
111 content::Source<WebContents>(web_contents))) { | 122 content::Source<WebContents>(web_contents))) { |
112 notification_registrar_.Remove(this, | 123 notification_registrar_.Remove(this, |
113 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 124 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
114 content::Source<WebContents>(web_contents)); | 125 content::Source<WebContents>(web_contents)); |
115 } | 126 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 jboolean IsCapturingVideo(JNIEnv* env, | 400 jboolean IsCapturingVideo(JNIEnv* env, |
390 jclass clazz, | 401 jclass clazz, |
391 jobject java_web_contents) { | 402 jobject java_web_contents) { |
392 content::WebContents* web_contents = | 403 content::WebContents* web_contents = |
393 content::WebContents::FromJavaWebContents(java_web_contents); | 404 content::WebContents::FromJavaWebContents(java_web_contents); |
394 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 405 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
395 MediaCaptureDevicesDispatcher::GetInstance()-> | 406 MediaCaptureDevicesDispatcher::GetInstance()-> |
396 GetMediaStreamCaptureIndicator(); | 407 GetMediaStreamCaptureIndicator(); |
397 return indicator->IsCapturingVideo(web_contents); | 408 return indicator->IsCapturingVideo(web_contents); |
398 } | 409 } |
OLD | NEW |