| 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 "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/android/hung_renderer_infobar_delegate.h" | 11 #include "chrome/browser/android/hung_renderer_infobar_delegate.h" |
| 12 #include "chrome/browser/android/media/media_throttle_infobar_delegate.h" | 12 #include "chrome/browser/android/media/media_throttle_infobar_delegate.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/file_select_helper.h" | 14 #include "chrome/browser/file_select_helper.h" |
| 15 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 16 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 16 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 17 #include "chrome/browser/media/media_stream_capture_indicator.h" | 17 #include "chrome/browser/media/media_stream_capture_indicator.h" |
| 18 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 18 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 19 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" | 19 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" |
| 20 #include "chrome/browser/prerender/prerender_manager.h" | 20 #include "chrome/browser/prerender/prerender_manager.h" |
| 21 #include "chrome/browser/prerender/prerender_manager_factory.h" | 21 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/android/bluetooth_chooser_android.h" | 23 #include "chrome/browser/ui/android/bluetooth_chooser_android.h" |
| 24 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 24 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 25 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 25 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
| 26 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 26 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 27 #include "chrome/browser/ui/tab_helpers.h" | 27 #include "chrome/browser/ui/tab_helpers.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/url_constants.h" |
| 29 #include "components/app_modal/javascript_dialog_manager.h" | 30 #include "components/app_modal/javascript_dialog_manager.h" |
| 30 #include "components/infobars/core/infobar.h" | 31 #include "components/infobars/core/infobar.h" |
| 32 #include "content/public/browser/navigation_entry.h" |
| 31 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
| 32 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 34 #include "content/public/browser/render_process_host.h" | 36 #include "content/public/browser/render_process_host.h" |
| 35 #include "content/public/browser/render_view_host.h" | 37 #include "content/public/browser/render_view_host.h" |
| 36 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 37 #include "content/public/common/file_chooser_params.h" | 39 #include "content/public/common/file_chooser_params.h" |
| 38 #include "jni/TabWebContentsDelegateAndroid_jni.h" | 40 #include "jni/TabWebContentsDelegateAndroid_jni.h" |
| 39 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 41 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
| 40 #include "ui/gfx/geometry/rect.h" | 42 #include "ui/gfx/geometry/rect.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 136 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
| 135 content::Source<WebContents>(web_contents))) { | 137 content::Source<WebContents>(web_contents))) { |
| 136 notification_registrar_.Remove(this, | 138 notification_registrar_.Remove(this, |
| 137 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 139 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
| 138 content::Source<WebContents>(web_contents)); | 140 content::Source<WebContents>(web_contents)); |
| 139 } | 141 } |
| 140 | 142 |
| 141 WebContentsDelegateAndroid::CloseContents(web_contents); | 143 WebContentsDelegateAndroid::CloseContents(web_contents); |
| 142 } | 144 } |
| 143 | 145 |
| 146 bool TabWebContentsDelegateAndroid::ShouldFocusLocationBarByDefault( |
| 147 WebContents* source) { |
| 148 const content::NavigationEntry* entry = |
| 149 source->GetController().GetActiveEntry(); |
| 150 if (entry) { |
| 151 GURL url = entry->GetURL(); |
| 152 GURL virtual_url = entry->GetVirtualURL(); |
| 153 if ((url.SchemeIs(chrome::kChromeUINativeScheme) && |
| 154 url.host() == chrome::kChromeUINewTabHost) || |
| 155 (virtual_url.SchemeIs(chrome::kChromeUINativeScheme) && |
| 156 virtual_url.host() == chrome::kChromeUINewTabHost)) { |
| 157 return true; |
| 158 } |
| 159 } |
| 160 return false; |
| 161 } |
| 162 |
| 163 |
| 144 void TabWebContentsDelegateAndroid::Observe( | 164 void TabWebContentsDelegateAndroid::Observe( |
| 145 int type, | 165 int type, |
| 146 const content::NotificationSource& source, | 166 const content::NotificationSource& source, |
| 147 const content::NotificationDetails& details) { | 167 const content::NotificationDetails& details) { |
| 148 switch (type) { | 168 switch (type) { |
| 149 case chrome::NOTIFICATION_FIND_RESULT_AVAILABLE: | 169 case chrome::NOTIFICATION_FIND_RESULT_AVAILABLE: |
| 150 OnFindResultAvailable( | 170 OnFindResultAvailable( |
| 151 content::Source<WebContents>(source).ptr(), | 171 content::Source<WebContents>(source).ptr(), |
| 152 content::Details<FindNotificationDetails>(details).ptr()); | 172 content::Details<FindNotificationDetails>(details).ptr()); |
| 153 break; | 173 break; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 jboolean IsCapturingVideo(JNIEnv* env, | 473 jboolean IsCapturingVideo(JNIEnv* env, |
| 454 const JavaParamRef<jclass>& clazz, | 474 const JavaParamRef<jclass>& clazz, |
| 455 const JavaParamRef<jobject>& java_web_contents) { | 475 const JavaParamRef<jobject>& java_web_contents) { |
| 456 content::WebContents* web_contents = | 476 content::WebContents* web_contents = |
| 457 content::WebContents::FromJavaWebContents(java_web_contents); | 477 content::WebContents::FromJavaWebContents(java_web_contents); |
| 458 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 478 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
| 459 MediaCaptureDevicesDispatcher::GetInstance()-> | 479 MediaCaptureDevicesDispatcher::GetInstance()-> |
| 460 GetMediaStreamCaptureIndicator(); | 480 GetMediaStreamCaptureIndicator(); |
| 461 return indicator->IsCapturingVideo(web_contents); | 481 return indicator->IsCapturingVideo(web_contents); |
| 462 } | 482 } |
| OLD | NEW |