| 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "content/browser/media/session/media_session_impl.h" | 66 #include "content/browser/media/session/media_session_impl.h" |
| 67 #include "content/browser/message_port_message_filter.h" | 67 #include "content/browser/message_port_message_filter.h" |
| 68 #include "content/browser/plugin_content_origin_whitelist.h" | 68 #include "content/browser/plugin_content_origin_whitelist.h" |
| 69 #include "content/browser/renderer_host/render_process_host_impl.h" | 69 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 70 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 70 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 71 #include "content/browser/renderer_host/render_view_host_impl.h" | 71 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 72 #include "content/browser/renderer_host/render_widget_host_impl.h" | 72 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 73 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 73 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 74 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 74 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 75 #include "content/browser/renderer_host/text_input_manager.h" | 75 #include "content/browser/renderer_host/text_input_manager.h" |
| 76 #include "content/browser/screen_orientation/screen_orientation.h" | 76 #include "content/browser/screen_orientation/screen_orientation_provider.h" |
| 77 #include "content/browser/site_instance_impl.h" | 77 #include "content/browser/site_instance_impl.h" |
| 78 #include "content/browser/web_contents/web_contents_view_child_frame.h" | 78 #include "content/browser/web_contents/web_contents_view_child_frame.h" |
| 79 #include "content/browser/web_contents/web_contents_view_guest.h" | 79 #include "content/browser/web_contents/web_contents_view_guest.h" |
| 80 #include "content/browser/webui/generic_handler.h" | 80 #include "content/browser/webui/generic_handler.h" |
| 81 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 81 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 82 #include "content/browser/webui/web_ui_impl.h" | 82 #include "content/browser/webui/web_ui_impl.h" |
| 83 #include "content/common/browser_plugin/browser_plugin_constants.h" | 83 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 84 #include "content/common/browser_plugin/browser_plugin_messages.h" | 84 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 85 #include "content/common/drag_messages.h" | 85 #include "content/common/drag_messages.h" |
| 86 #include "content/common/frame_messages.h" | 86 #include "content/common/frame_messages.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 100 #include "content/public/browser/guest_mode.h" | 100 #include "content/public/browser/guest_mode.h" |
| 101 #include "content/public/browser/invalidate_type.h" | 101 #include "content/public/browser/invalidate_type.h" |
| 102 #include "content/public/browser/javascript_dialog_manager.h" | 102 #include "content/public/browser/javascript_dialog_manager.h" |
| 103 #include "content/public/browser/load_notification_details.h" | 103 #include "content/public/browser/load_notification_details.h" |
| 104 #include "content/public/browser/navigation_details.h" | 104 #include "content/public/browser/navigation_details.h" |
| 105 #include "content/public/browser/notification_details.h" | 105 #include "content/public/browser/notification_details.h" |
| 106 #include "content/public/browser/notification_service.h" | 106 #include "content/public/browser/notification_service.h" |
| 107 #include "content/public/browser/notification_types.h" | 107 #include "content/public/browser/notification_types.h" |
| 108 #include "content/public/browser/render_widget_host_iterator.h" | 108 #include "content/public/browser/render_widget_host_iterator.h" |
| 109 #include "content/public/browser/resource_request_details.h" | 109 #include "content/public/browser/resource_request_details.h" |
| 110 #include "content/public/browser/screen_orientation_provider.h" | |
| 111 #include "content/public/browser/security_style_explanations.h" | 110 #include "content/public/browser/security_style_explanations.h" |
| 112 #include "content/public/browser/ssl_status.h" | 111 #include "content/public/browser/ssl_status.h" |
| 113 #include "content/public/browser/storage_partition.h" | 112 #include "content/public/browser/storage_partition.h" |
| 114 #include "content/public/browser/user_metrics.h" | 113 #include "content/public/browser/user_metrics.h" |
| 115 #include "content/public/browser/web_contents_binding_set.h" | 114 #include "content/public/browser/web_contents_binding_set.h" |
| 116 #include "content/public/browser/web_contents_delegate.h" | 115 #include "content/public/browser/web_contents_delegate.h" |
| 117 #include "content/public/browser/web_contents_unresponsive_state.h" | 116 #include "content/public/browser/web_contents_unresponsive_state.h" |
| 118 #include "content/public/common/bindings_policy.h" | 117 #include "content/public/common/bindings_policy.h" |
| 119 #include "content/public/common/browser_side_navigation_policy.h" | 118 #include "content/public/common/browser_side_navigation_policy.h" |
| 120 #include "content/public/common/child_process_host.h" | 119 #include "content/public/common/child_process_host.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 316 } |
| 318 | 317 |
| 319 WebContents* WebContents::FromFrameTreeNodeId(int frame_tree_node_id) { | 318 WebContents* WebContents::FromFrameTreeNodeId(int frame_tree_node_id) { |
| 320 FrameTreeNode* frame_tree_node = | 319 FrameTreeNode* frame_tree_node = |
| 321 FrameTreeNode::GloballyFindByID(frame_tree_node_id); | 320 FrameTreeNode::GloballyFindByID(frame_tree_node_id); |
| 322 if (!frame_tree_node) | 321 if (!frame_tree_node) |
| 323 return nullptr; | 322 return nullptr; |
| 324 return FromRenderFrameHost(frame_tree_node->current_frame_host()); | 323 return FromRenderFrameHost(frame_tree_node->current_frame_host()); |
| 325 } | 324 } |
| 326 | 325 |
| 326 void WebContents::SetScreenOrientationDelegate( |
| 327 ScreenOrientationDelegate* delegate) { |
| 328 ScreenOrientationProvider::SetDelegate(delegate); |
| 329 } |
| 330 |
| 327 // WebContentsImpl::DestructionObserver ---------------------------------------- | 331 // WebContentsImpl::DestructionObserver ---------------------------------------- |
| 328 | 332 |
| 329 class WebContentsImpl::DestructionObserver : public WebContentsObserver { | 333 class WebContentsImpl::DestructionObserver : public WebContentsObserver { |
| 330 public: | 334 public: |
| 331 DestructionObserver(WebContentsImpl* owner, WebContents* watched_contents) | 335 DestructionObserver(WebContentsImpl* owner, WebContents* watched_contents) |
| 332 : WebContentsObserver(watched_contents), | 336 : WebContentsObserver(watched_contents), |
| 333 owner_(owner) { | 337 owner_(owner) { |
| 334 } | 338 } |
| 335 | 339 |
| 336 // WebContentsObserver: | 340 // WebContentsObserver: |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 const { | 926 const { |
| 923 if (auto widget_host = GetFullscreenRenderWidgetHost()) | 927 if (auto widget_host = GetFullscreenRenderWidgetHost()) |
| 924 return widget_host->GetView(); | 928 return widget_host->GetView(); |
| 925 return nullptr; | 929 return nullptr; |
| 926 } | 930 } |
| 927 | 931 |
| 928 WebContentsView* WebContentsImpl::GetView() const { | 932 WebContentsView* WebContentsImpl::GetView() const { |
| 929 return view_.get(); | 933 return view_.get(); |
| 930 } | 934 } |
| 931 | 935 |
| 936 void WebContentsImpl::OnScreenOrientationChange() { |
| 937 DCHECK(screen_orientation_provider_); |
| 938 return screen_orientation_provider_->OnOrientationChange(); |
| 939 } |
| 940 |
| 932 SkColor WebContentsImpl::GetThemeColor() const { | 941 SkColor WebContentsImpl::GetThemeColor() const { |
| 933 return theme_color_; | 942 return theme_color_; |
| 934 } | 943 } |
| 935 | 944 |
| 936 void WebContentsImpl::SetAccessibilityMode(AccessibilityMode mode) { | 945 void WebContentsImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| 937 if (mode == accessibility_mode_) | 946 if (mode == accessibility_mode_) |
| 938 return; | 947 return; |
| 939 | 948 |
| 940 // Don't allow accessibility to be enabled for WebContents that are never | 949 // Don't allow accessibility to be enabled for WebContents that are never |
| 941 // visible, like background pages. | 950 // visible, like background pages. |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 | 1591 |
| 1583 #if BUILDFLAG(ENABLE_PLUGINS) | 1592 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1584 plugin_content_origin_whitelist_.reset( | 1593 plugin_content_origin_whitelist_.reset( |
| 1585 new PluginContentOriginWhitelist(this)); | 1594 new PluginContentOriginWhitelist(this)); |
| 1586 #endif | 1595 #endif |
| 1587 | 1596 |
| 1588 registrar_.Add(this, | 1597 registrar_.Add(this, |
| 1589 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1598 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 1590 NotificationService::AllBrowserContextsAndSources()); | 1599 NotificationService::AllBrowserContextsAndSources()); |
| 1591 | 1600 |
| 1592 screen_orientation_.reset(new ScreenOrientation(this)); | 1601 screen_orientation_provider_.reset(new ScreenOrientationProvider(this)); |
| 1593 | 1602 |
| 1594 manifest_manager_host_.reset(new ManifestManagerHost(this)); | 1603 manifest_manager_host_.reset(new ManifestManagerHost(this)); |
| 1595 | 1604 |
| 1596 #if defined(OS_ANDROID) | 1605 #if defined(OS_ANDROID) |
| 1597 date_time_chooser_.reset(new DateTimeChooserAndroid()); | 1606 date_time_chooser_.reset(new DateTimeChooserAndroid()); |
| 1598 #endif | 1607 #endif |
| 1599 | 1608 |
| 1600 // BrowserPluginGuest::Init needs to be called after this WebContents has | 1609 // BrowserPluginGuest::Init needs to be called after this WebContents has |
| 1601 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. | 1610 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. |
| 1602 if (browser_plugin_guest_) | 1611 if (browser_plugin_guest_) |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 | 2440 |
| 2432 device::GeolocationServiceContext* | 2441 device::GeolocationServiceContext* |
| 2433 WebContentsImpl::GetGeolocationServiceContext() { | 2442 WebContentsImpl::GetGeolocationServiceContext() { |
| 2434 return geolocation_service_context_.get(); | 2443 return geolocation_service_context_.get(); |
| 2435 } | 2444 } |
| 2436 | 2445 |
| 2437 device::WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() { | 2446 device::WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() { |
| 2438 return wake_lock_service_context_.get(); | 2447 return wake_lock_service_context_.get(); |
| 2439 } | 2448 } |
| 2440 | 2449 |
| 2441 ScreenOrientationProvider* WebContentsImpl::GetScreenOrientationProvider() { | |
| 2442 return screen_orientation_.get()->GetScreenOrientationProvider(); | |
| 2443 } | |
| 2444 | |
| 2445 void WebContentsImpl::OnShowValidationMessage( | 2450 void WebContentsImpl::OnShowValidationMessage( |
| 2446 RenderViewHostImpl* source, | 2451 RenderViewHostImpl* source, |
| 2447 const gfx::Rect& anchor_in_root_view, | 2452 const gfx::Rect& anchor_in_root_view, |
| 2448 const base::string16& main_text, | 2453 const base::string16& main_text, |
| 2449 const base::string16& sub_text) { | 2454 const base::string16& sub_text) { |
| 2450 // TODO(nick): Should we consider |source| here or pass it to the delegate? | 2455 // TODO(nick): Should we consider |source| here or pass it to the delegate? |
| 2451 if (delegate_) | 2456 if (delegate_) |
| 2452 delegate_->ShowValidationMessage( | 2457 delegate_->ShowValidationMessage( |
| 2453 this, anchor_in_root_view, main_text, sub_text); | 2458 this, anchor_in_root_view, main_text, sub_text); |
| 2454 } | 2459 } |
| (...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5408 GetMainFrame()->AddMessageToConsole( | 5413 GetMainFrame()->AddMessageToConsole( |
| 5409 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5414 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 5410 base::StringPrintf("This site does not have a valid SSL " | 5415 base::StringPrintf("This site does not have a valid SSL " |
| 5411 "certificate! Without SSL, your site's and " | 5416 "certificate! Without SSL, your site's and " |
| 5412 "visitors' data is vulnerable to theft and " | 5417 "visitors' data is vulnerable to theft and " |
| 5413 "tampering. Get a valid SSL certificate before" | 5418 "tampering. Get a valid SSL certificate before" |
| 5414 " releasing your website to the public.")); | 5419 " releasing your website to the public.")); |
| 5415 } | 5420 } |
| 5416 | 5421 |
| 5417 } // namespace content | 5422 } // namespace content |
| OLD | NEW |