| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/tab_web_contents_delegate_android.h" | 5 #include "chrome/browser/android/tab_web_contents_delegate_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 WebContentsDelegateAndroid::LoadingStateChanged( | 120 WebContentsDelegateAndroid::LoadingStateChanged( |
| 121 source, to_different_document); | 121 source, to_different_document); |
| 122 LoadProgressChanged(source, has_stopped ? 1 : 0); | 122 LoadProgressChanged(source, has_stopped ? 1 : 0); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void TabWebContentsDelegateAndroid::RunFileChooser( | 125 void TabWebContentsDelegateAndroid::RunFileChooser( |
| 126 content::RenderFrameHost* render_frame_host, | 126 content::RenderFrameHost* render_frame_host, |
| 127 const FileChooserParams& params) { | 127 const FileChooserParams& params) { |
| 128 #if BUILDFLAG(ENABLE_VR) | 128 #if BUILDFLAG(ENABLE_VR) |
| 129 if (vr_shell::VrTabHelper::IsInVr( | 129 if (vr_shell::VrTabHelper::IsInVr( |
| 130 WebContents::FromRenderFrameHost(render_frame_host))) { | 130 WebContents::FromRenderFrameHost(render_frame_host))) |
| 131 return; | 131 return; |
| 132 } | |
| 133 #endif | 132 #endif |
| 134 FileSelectHelper::RunFileChooser(render_frame_host, params); | 133 FileSelectHelper::RunFileChooser(render_frame_host, params); |
| 135 } | 134 } |
| 136 | 135 |
| 137 std::unique_ptr<BluetoothChooser> | 136 std::unique_ptr<BluetoothChooser> |
| 138 TabWebContentsDelegateAndroid::RunBluetoothChooser( | 137 TabWebContentsDelegateAndroid::RunBluetoothChooser( |
| 139 content::RenderFrameHost* frame, | 138 content::RenderFrameHost* frame, |
| 140 const BluetoothChooser::EventHandler& event_handler) { | 139 const BluetoothChooser::EventHandler& event_handler) { |
| 140 #if BUILDFLAG(ENABLE_VR) |
| 141 if (vr_shell::VrTabHelper::IsInVr(WebContents::FromRenderFrameHost(frame))) |
| 142 return nullptr; |
| 143 #endif |
| 141 return base::MakeUnique<BluetoothChooserAndroid>(frame, event_handler); | 144 return base::MakeUnique<BluetoothChooserAndroid>(frame, event_handler); |
| 142 } | 145 } |
| 143 | 146 |
| 144 void TabWebContentsDelegateAndroid::CloseContents( | 147 void TabWebContentsDelegateAndroid::CloseContents( |
| 145 WebContents* web_contents) { | 148 WebContents* web_contents) { |
| 146 // Prevent dangling registrations assigned to closed web contents. | 149 // Prevent dangling registrations assigned to closed web contents. |
| 147 if (notification_registrar_.IsRegistered(this, | 150 if (notification_registrar_.IsRegistered(this, |
| 148 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 151 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
| 149 content::Source<WebContents>(web_contents))) { | 152 content::Source<WebContents>(web_contents))) { |
| 150 notification_registrar_.Remove(this, | 153 notification_registrar_.Remove(this, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 return nullptr; | 275 return nullptr; |
| 273 } | 276 } |
| 274 #endif | 277 #endif |
| 275 return app_modal::JavaScriptDialogManager::GetInstance(); | 278 return app_modal::JavaScriptDialogManager::GetInstance(); |
| 276 } | 279 } |
| 277 | 280 |
| 278 void TabWebContentsDelegateAndroid::RequestMediaAccessPermission( | 281 void TabWebContentsDelegateAndroid::RequestMediaAccessPermission( |
| 279 content::WebContents* web_contents, | 282 content::WebContents* web_contents, |
| 280 const content::MediaStreamRequest& request, | 283 const content::MediaStreamRequest& request, |
| 281 const content::MediaResponseCallback& callback) { | 284 const content::MediaResponseCallback& callback) { |
| 285 #if BUILDFLAG(ENABLE_VR) |
| 286 if (vr_shell::VrTabHelper::IsInVr(web_contents)) |
| 287 return; |
| 288 #endif |
| 282 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( | 289 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( |
| 283 web_contents, request, callback, nullptr); | 290 web_contents, request, callback, nullptr); |
| 284 } | 291 } |
| 285 | 292 |
| 286 bool TabWebContentsDelegateAndroid::CheckMediaAccessPermission( | 293 bool TabWebContentsDelegateAndroid::CheckMediaAccessPermission( |
| 287 content::WebContents* web_contents, | 294 content::WebContents* web_contents, |
| 288 const GURL& security_origin, | 295 const GURL& security_origin, |
| 289 content::MediaStreamType type) { | 296 content::MediaStreamType type) { |
| 290 return MediaCaptureDevicesDispatcher::GetInstance() | 297 return MediaCaptureDevicesDispatcher::GetInstance() |
| 291 ->CheckMediaAccessPermission(web_contents, security_origin, type); | 298 ->CheckMediaAccessPermission(web_contents, security_origin, type); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 void NotifyStopped(JNIEnv* env, | 494 void NotifyStopped(JNIEnv* env, |
| 488 const JavaParamRef<jclass>& clazz, | 495 const JavaParamRef<jclass>& clazz, |
| 489 const JavaParamRef<jobject>& java_web_contents) { | 496 const JavaParamRef<jobject>& java_web_contents) { |
| 490 content::WebContents* web_contents = | 497 content::WebContents* web_contents = |
| 491 content::WebContents::FromJavaWebContents(java_web_contents); | 498 content::WebContents::FromJavaWebContents(java_web_contents); |
| 492 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 499 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
| 493 MediaCaptureDevicesDispatcher::GetInstance() | 500 MediaCaptureDevicesDispatcher::GetInstance() |
| 494 ->GetMediaStreamCaptureIndicator(); | 501 ->GetMediaStreamCaptureIndicator(); |
| 495 indicator->NotifyStopped(web_contents); | 502 indicator->NotifyStopped(web_contents); |
| 496 } | 503 } |
| OLD | NEW |