| 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 while ((observer = it.GetNext()) != NULL) | 696 while ((observer = it.GetNext()) != NULL) |
| 701 if (observer->OnMessageReceived(message)) | 697 if (observer->OnMessageReceived(message)) |
| 702 return true; | 698 return true; |
| 703 | 699 |
| 704 // Message handlers should be aware of which RenderViewHost sent the | 700 // Message handlers should be aware of which RenderViewHost sent the |
| 705 // message, which is temporarily stored in message_source_. | 701 // message, which is temporarily stored in message_source_. |
| 706 message_source_ = render_view_host; | 702 message_source_ = render_view_host; |
| 707 bool handled = true; | 703 bool handled = true; |
| 708 bool message_is_ok = true; | 704 bool message_is_ok = true; |
| 709 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) | 705 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) |
| 710 #if defined(ENABLE_WEB_INTENTS) | |
| 711 IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, | |
| 712 OnRegisterIntentService) | |
| 713 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, | |
| 714 OnWebIntentDispatch) | |
| 715 #endif | |
| 716 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 706 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| 717 OnDidLoadResourceFromMemoryCache) | 707 OnDidLoadResourceFromMemoryCache) |
| 718 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 708 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
| 719 OnDidDisplayInsecureContent) | 709 OnDidDisplayInsecureContent) |
| 720 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 710 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
| 721 OnDidRunInsecureContent) | 711 OnDidRunInsecureContent) |
| 722 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, | 712 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |
| 723 OnDocumentLoadedInFrame) | 713 OnDocumentLoadedInFrame) |
| 724 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 714 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 725 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, | 715 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 return web_ui->ShouldFocusLocationBarByDefault(); | 2009 return web_ui->ShouldFocusLocationBarByDefault(); |
| 2020 NavigationEntry* entry = controller_.GetActiveEntry(); | 2010 NavigationEntry* entry = controller_.GetActiveEntry(); |
| 2021 return (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)); | 2011 return (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)); |
| 2022 } | 2012 } |
| 2023 | 2013 |
| 2024 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { | 2014 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
| 2025 if (delegate_) | 2015 if (delegate_) |
| 2026 delegate_->SetFocusToLocationBar(select_all); | 2016 delegate_->SetFocusToLocationBar(select_all); |
| 2027 } | 2017 } |
| 2028 | 2018 |
| 2029 #if defined(ENABLE_WEB_INTENTS) | |
| 2030 void WebContentsImpl::OnRegisterIntentService( | |
| 2031 const webkit_glue::WebIntentServiceData& data, | |
| 2032 bool user_gesture) { | |
| 2033 if (delegate_) | |
| 2034 delegate_->RegisterIntentHandler(this, data, user_gesture); | |
| 2035 } | |
| 2036 | |
| 2037 void WebContentsImpl::OnWebIntentDispatch( | |
| 2038 const webkit_glue::WebIntentData& intent, | |
| 2039 int intent_id) { | |
| 2040 if (!delegate_) | |
| 2041 return; | |
| 2042 | |
| 2043 WebIntentsDispatcherImpl* intents_dispatcher = | |
| 2044 new WebIntentsDispatcherImpl(this, intent, intent_id); | |
| 2045 delegate_->WebIntentDispatch(this, intents_dispatcher); | |
| 2046 } | |
| 2047 #endif | |
| 2048 | |
| 2049 void WebContentsImpl::DidStartProvisionalLoadForFrame( | 2019 void WebContentsImpl::DidStartProvisionalLoadForFrame( |
| 2050 RenderViewHost* render_view_host, | 2020 RenderViewHost* render_view_host, |
| 2051 int64 frame_id, | 2021 int64 frame_id, |
| 2052 int64 parent_frame_id, | 2022 int64 parent_frame_id, |
| 2053 bool is_main_frame, | 2023 bool is_main_frame, |
| 2054 const GURL& url) { | 2024 const GURL& url) { |
| 2055 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 2025 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 2056 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); | 2026 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); |
| 2057 GURL validated_url(url); | 2027 GURL validated_url(url); |
| 2058 RenderProcessHost* render_process_host = | 2028 RenderProcessHost* render_process_host = |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3483 | 3453 |
| 3484 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 3454 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
| 3485 return browser_plugin_guest_.get(); | 3455 return browser_plugin_guest_.get(); |
| 3486 } | 3456 } |
| 3487 | 3457 |
| 3488 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3458 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 3489 return browser_plugin_embedder_.get(); | 3459 return browser_plugin_embedder_.get(); |
| 3490 } | 3460 } |
| 3491 | 3461 |
| 3492 } // namespace content | 3462 } // namespace content |
| OLD | NEW |