| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "content/browser/child_process_security_policy_impl.h" | 21 #include "content/browser/child_process_security_policy_impl.h" |
| 22 #include "content/browser/devtools/devtools_manager_impl.h" | 22 #include "content/browser/devtools/devtools_manager_impl.h" |
| 23 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 23 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 24 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 24 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 25 #include "content/browser/download/download_stats.h" | 25 #include "content/browser/download/download_stats.h" |
| 26 #include "content/browser/download/mhtml_generation_manager.h" | 26 #include "content/browser/download/mhtml_generation_manager.h" |
| 27 #include "content/browser/download/save_package.h" | 27 #include "content/browser/download/save_package.h" |
| 28 #include "content/browser/gpu/gpu_data_manager_impl.h" | 28 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 29 #include "content/browser/gpu/gpu_process_host.h" | 29 #include "content/browser/gpu/gpu_process_host.h" |
| 30 #include "content/browser/host_zoom_map_impl.h" | 30 #include "content/browser/host_zoom_map_impl.h" |
| 31 #include "content/browser/intents/web_intents_dispatcher_impl.h" | |
| 32 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 31 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 33 #include "content/browser/renderer_host/render_process_host_impl.h" | 32 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 34 #include "content/browser/renderer_host/render_view_host_impl.h" | 33 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 34 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 36 #include "content/browser/site_instance_impl.h" | 35 #include "content/browser/site_instance_impl.h" |
| 37 #include "content/browser/web_contents/interstitial_page_impl.h" | 36 #include "content/browser/web_contents/interstitial_page_impl.h" |
| 38 #include "content/browser/web_contents/navigation_entry_impl.h" | 37 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 39 #include "content/browser/web_contents/web_contents_view_guest.h" | 38 #include "content/browser/web_contents/web_contents_view_guest.h" |
| 40 #include "content/browser/webui/generic_handler.h" | 39 #include "content/browser/webui/generic_handler.h" |
| 41 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 40 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 42 #include "content/browser/webui/web_ui_impl.h" | 41 #include "content/browser/webui/web_ui_impl.h" |
| 43 #include "content/common/browser_plugin_messages.h" | 42 #include "content/common/browser_plugin_messages.h" |
| 44 #include "content/common/icon_messages.h" | 43 #include "content/common/icon_messages.h" |
| 45 #include "content/common/intents_messages.h" | |
| 46 #include "content/common/ssl_status_serialization.h" | 44 #include "content/common/ssl_status_serialization.h" |
| 47 #include "content/common/view_messages.h" | 45 #include "content/common/view_messages.h" |
| 48 #include "content/port/browser/render_view_host_delegate_view.h" | 46 #include "content/port/browser/render_view_host_delegate_view.h" |
| 49 #include "content/port/browser/render_widget_host_view_port.h" | 47 #include "content/port/browser/render_widget_host_view_port.h" |
| 50 #include "content/public/browser/browser_context.h" | 48 #include "content/public/browser/browser_context.h" |
| 51 #include "content/public/browser/color_chooser.h" | 49 #include "content/public/browser/color_chooser.h" |
| 52 #include "content/public/browser/compositor_util.h" | 50 #include "content/public/browser/compositor_util.h" |
| 53 #include "content/public/browser/content_browser_client.h" | 51 #include "content/public/browser/content_browser_client.h" |
| 54 #include "content/public/browser/devtools_agent_host.h" | 52 #include "content/public/browser/devtools_agent_host.h" |
| 55 #include "content/public/browser/download_manager.h" | 53 #include "content/public/browser/download_manager.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 76 #include "net/base/net_util.h" | 74 #include "net/base/net_util.h" |
| 77 #include "net/base/network_change_notifier.h" | 75 #include "net/base/network_change_notifier.h" |
| 78 #include "net/url_request/url_request_context_getter.h" | 76 #include "net/url_request/url_request_context_getter.h" |
| 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 77 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 80 #include "ui/base/layout.h" | 78 #include "ui/base/layout.h" |
| 81 #include "ui/base/touch/touch_device.h" | 79 #include "ui/base/touch/touch_device.h" |
| 82 #include "ui/base/ui_base_switches.h" | 80 #include "ui/base/ui_base_switches.h" |
| 83 #include "ui/gfx/display.h" | 81 #include "ui/gfx/display.h" |
| 84 #include "ui/gfx/screen.h" | 82 #include "ui/gfx/screen.h" |
| 85 #include "ui/gl/gl_switches.h" | 83 #include "ui/gl/gl_switches.h" |
| 86 #include "webkit/glue/web_intent_data.h" | |
| 87 #include "webkit/glue/web_intent_service_data.h" | |
| 88 #include "webkit/glue/webpreferences.h" | 84 #include "webkit/glue/webpreferences.h" |
| 89 | 85 |
| 90 #if defined(OS_ANDROID) | 86 #if defined(OS_ANDROID) |
| 91 #include "content/browser/android/date_time_chooser_android.h" | 87 #include "content/browser/android/date_time_chooser_android.h" |
| 92 #endif | 88 #endif |
| 93 | 89 |
| 94 #if defined(OS_MACOSX) | 90 #if defined(OS_MACOSX) |
| 95 #include "base/mac/foundation_util.h" | 91 #include "base/mac/foundation_util.h" |
| 96 #include "ui/surface/io_surface_support_mac.h" | 92 #include "ui/surface/io_surface_support_mac.h" |
| 97 #endif | 93 #endif |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 while ((observer = it.GetNext()) != NULL) | 705 while ((observer = it.GetNext()) != NULL) |
| 710 if (observer->OnMessageReceived(message)) | 706 if (observer->OnMessageReceived(message)) |
| 711 return true; | 707 return true; |
| 712 | 708 |
| 713 // Message handlers should be aware of which RenderViewHost sent the | 709 // Message handlers should be aware of which RenderViewHost sent the |
| 714 // message, which is temporarily stored in message_source_. | 710 // message, which is temporarily stored in message_source_. |
| 715 message_source_ = render_view_host; | 711 message_source_ = render_view_host; |
| 716 bool handled = true; | 712 bool handled = true; |
| 717 bool message_is_ok = true; | 713 bool message_is_ok = true; |
| 718 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) | 714 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) |
| 719 #if defined(ENABLE_WEB_INTENTS) | |
| 720 IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, | |
| 721 OnRegisterIntentService) | |
| 722 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, | |
| 723 OnWebIntentDispatch) | |
| 724 #endif | |
| 725 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 715 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| 726 OnDidLoadResourceFromMemoryCache) | 716 OnDidLoadResourceFromMemoryCache) |
| 727 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 717 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
| 728 OnDidDisplayInsecureContent) | 718 OnDidDisplayInsecureContent) |
| 729 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 719 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
| 730 OnDidRunInsecureContent) | 720 OnDidRunInsecureContent) |
| 731 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, | 721 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |
| 732 OnDocumentLoadedInFrame) | 722 OnDocumentLoadedInFrame) |
| 733 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 723 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 734 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, | 724 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) | 2052 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) |
| 2063 return true; | 2053 return true; |
| 2064 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); | 2054 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); |
| 2065 } | 2055 } |
| 2066 | 2056 |
| 2067 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { | 2057 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
| 2068 if (delegate_) | 2058 if (delegate_) |
| 2069 delegate_->SetFocusToLocationBar(select_all); | 2059 delegate_->SetFocusToLocationBar(select_all); |
| 2070 } | 2060 } |
| 2071 | 2061 |
| 2072 #if defined(ENABLE_WEB_INTENTS) | |
| 2073 void WebContentsImpl::OnRegisterIntentService( | |
| 2074 const webkit_glue::WebIntentServiceData& data, | |
| 2075 bool user_gesture) { | |
| 2076 if (delegate_) | |
| 2077 delegate_->RegisterIntentHandler(this, data, user_gesture); | |
| 2078 } | |
| 2079 | |
| 2080 void WebContentsImpl::OnWebIntentDispatch( | |
| 2081 const webkit_glue::WebIntentData& intent, | |
| 2082 int intent_id) { | |
| 2083 if (!delegate_) | |
| 2084 return; | |
| 2085 | |
| 2086 WebIntentsDispatcherImpl* intents_dispatcher = | |
| 2087 new WebIntentsDispatcherImpl(this, intent, intent_id); | |
| 2088 delegate_->WebIntentDispatch(this, intents_dispatcher); | |
| 2089 } | |
| 2090 #endif | |
| 2091 | |
| 2092 void WebContentsImpl::DidStartProvisionalLoadForFrame( | 2062 void WebContentsImpl::DidStartProvisionalLoadForFrame( |
| 2093 RenderViewHost* render_view_host, | 2063 RenderViewHost* render_view_host, |
| 2094 int64 frame_id, | 2064 int64 frame_id, |
| 2095 int64 parent_frame_id, | 2065 int64 parent_frame_id, |
| 2096 bool is_main_frame, | 2066 bool is_main_frame, |
| 2097 const GURL& url) { | 2067 const GURL& url) { |
| 2098 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 2068 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 2099 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); | 2069 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); |
| 2100 GURL validated_url(url); | 2070 GURL validated_url(url); |
| 2101 RenderProcessHost* render_process_host = | 2071 RenderProcessHost* render_process_host = |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3536 | 3506 |
| 3537 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 3507 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
| 3538 return browser_plugin_guest_.get(); | 3508 return browser_plugin_guest_.get(); |
| 3539 } | 3509 } |
| 3540 | 3510 |
| 3541 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3511 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 3542 return browser_plugin_embedder_.get(); | 3512 return browser_plugin_embedder_.get(); |
| 3543 } | 3513 } |
| 3544 | 3514 |
| 3545 } // namespace content | 3515 } // namespace content |
| OLD | NEW |