| 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 24 matching lines...) Expand all Loading... |
| 35 #include "content/browser/webui/web_ui_impl.h" | 35 #include "content/browser/webui/web_ui_impl.h" |
| 36 #include "content/common/intents_messages.h" | 36 #include "content/common/intents_messages.h" |
| 37 #include "content/common/ssl_status_serialization.h" | 37 #include "content/common/ssl_status_serialization.h" |
| 38 #include "content/common/view_messages.h" | 38 #include "content/common/view_messages.h" |
| 39 #include "content/port/browser/render_widget_host_view_port.h" | 39 #include "content/port/browser/render_widget_host_view_port.h" |
| 40 #include "content/public/browser/browser_context.h" | 40 #include "content/public/browser/browser_context.h" |
| 41 #include "content/public/browser/color_chooser.h" | 41 #include "content/public/browser/color_chooser.h" |
| 42 #include "content/public/browser/content_browser_client.h" | 42 #include "content/public/browser/content_browser_client.h" |
| 43 #include "content/public/browser/devtools_agent_host_registry.h" | 43 #include "content/public/browser/devtools_agent_host_registry.h" |
| 44 #include "content/public/browser/download_manager.h" | 44 #include "content/public/browser/download_manager.h" |
| 45 #include "content/public/browser/download_url_parameters.h" |
| 45 #include "content/public/browser/invalidate_type.h" | 46 #include "content/public/browser/invalidate_type.h" |
| 46 #include "content/public/browser/javascript_dialogs.h" | 47 #include "content/public/browser/javascript_dialogs.h" |
| 47 #include "content/public/browser/load_notification_details.h" | 48 #include "content/public/browser/load_notification_details.h" |
| 48 #include "content/public/browser/navigation_details.h" | 49 #include "content/public/browser/navigation_details.h" |
| 49 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
| 50 #include "content/public/browser/resource_request_details.h" | 51 #include "content/public/browser/resource_request_details.h" |
| 51 #include "content/public/browser/user_metrics.h" | 52 #include "content/public/browser/user_metrics.h" |
| 52 #include "content/public/browser/web_contents_delegate.h" | 53 #include "content/public/browser/web_contents_delegate.h" |
| 53 #include "content/public/browser/web_contents_observer.h" | 54 #include "content/public/browser/web_contents_observer.h" |
| 54 #include "content/public/browser/web_contents_view.h" | 55 #include "content/public/browser/web_contents_view.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // pending RVH. | 120 // pending RVH. |
| 120 // - The previous renderer is kept swapped out in RenderViewHostManager in case | 121 // - The previous renderer is kept swapped out in RenderViewHostManager in case |
| 121 // the user goes back. The process only stays live if another tab is using | 122 // the user goes back. The process only stays live if another tab is using |
| 122 // it, but if so, the existing frame relationships will be maintained. | 123 // it, but if so, the existing frame relationships will be maintained. |
| 123 | 124 |
| 124 using content::DevToolsAgentHost; | 125 using content::DevToolsAgentHost; |
| 125 using content::DevToolsAgentHostRegistry; | 126 using content::DevToolsAgentHostRegistry; |
| 126 using content::DevToolsManagerImpl; | 127 using content::DevToolsManagerImpl; |
| 127 using content::DownloadItem; | 128 using content::DownloadItem; |
| 128 using content::DownloadManager; | 129 using content::DownloadManager; |
| 130 using content::DownloadUrlParameters; |
| 129 using content::GlobalRequestID; | 131 using content::GlobalRequestID; |
| 130 using content::HostZoomMap; | 132 using content::HostZoomMap; |
| 131 using content::InterstitialPage; | 133 using content::InterstitialPage; |
| 132 using content::LoadNotificationDetails; | 134 using content::LoadNotificationDetails; |
| 133 using content::NavigationController; | 135 using content::NavigationController; |
| 134 using content::NavigationEntry; | 136 using content::NavigationEntry; |
| 135 using content::NavigationEntryImpl; | 137 using content::NavigationEntryImpl; |
| 136 using content::OpenURLParams; | 138 using content::OpenURLParams; |
| 137 using content::RenderViewHost; | 139 using content::RenderViewHost; |
| 138 using content::RenderViewHostDelegate; | 140 using content::RenderViewHostDelegate; |
| 139 using content::RenderViewHostImpl; | 141 using content::RenderViewHostImpl; |
| 140 using content::RenderWidgetHost; | 142 using content::RenderWidgetHost; |
| 141 using content::RenderWidgetHostView; | 143 using content::RenderWidgetHostView; |
| 142 using content::RenderWidgetHostViewPort; | 144 using content::RenderWidgetHostViewPort; |
| 143 using content::ResourceDispatcherHostImpl; | 145 using content::ResourceDispatcherHostImpl; |
| 146 using content::SSLStatus; |
| 144 using content::SessionStorageNamespace; | 147 using content::SessionStorageNamespace; |
| 145 using content::SiteInstance; | 148 using content::SiteInstance; |
| 146 using content::SSLStatus; | |
| 147 using content::UserMetricsAction; | 149 using content::UserMetricsAction; |
| 148 using content::WebContents; | 150 using content::WebContents; |
| 149 using content::WebContentsObserver; | 151 using content::WebContentsObserver; |
| 150 using content::WebUI; | 152 using content::WebUI; |
| 151 using content::WebUIController; | 153 using content::WebUIController; |
| 152 using content::WebUIControllerFactory; | 154 using content::WebUIControllerFactory; |
| 153 | 155 |
| 154 namespace { | 156 namespace { |
| 155 | 157 |
| 156 // Amount of time we wait between when a key event is received and the renderer | 158 // Amount of time we wait between when a key event is received and the renderer |
| (...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 if (!dlm) | 2608 if (!dlm) |
| 2607 return; | 2609 return; |
| 2608 int64 post_id = -1; | 2610 int64 post_id = -1; |
| 2609 if (is_main_frame) { | 2611 if (is_main_frame) { |
| 2610 const NavigationEntry* entry = controller_.GetActiveEntry(); | 2612 const NavigationEntry* entry = controller_.GetActiveEntry(); |
| 2611 if (entry) | 2613 if (entry) |
| 2612 post_id = entry->GetPostID(); | 2614 post_id = entry->GetPostID(); |
| 2613 } | 2615 } |
| 2614 content::DownloadSaveInfo save_info; | 2616 content::DownloadSaveInfo save_info; |
| 2615 save_info.prompt_for_save_location = true; | 2617 save_info.prompt_for_save_location = true; |
| 2616 dlm->DownloadUrl(url, | 2618 DownloadUrlParameters* params = DownloadUrlParameters::FromWebContents( |
| 2617 referrer, | 2619 this, url, save_info); |
| 2618 "", | 2620 params->set_referrer(referrer); |
| 2619 true, // prefer_cache | 2621 params->set_post_id(post_id); |
| 2620 post_id, | 2622 params->set_prefer_cache(true); |
| 2621 save_info, | 2623 dlm->DownloadUrl(params); |
| 2622 this, | |
| 2623 DownloadManager::OnStartedCallback()); | |
| 2624 } | 2624 } |
| 2625 | 2625 |
| 2626 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2626 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2627 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2627 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2628 // Can be NULL during tests. | 2628 // Can be NULL during tests. |
| 2629 if (rwh_view) | 2629 if (rwh_view) |
| 2630 rwh_view->SetSize(GetView()->GetContainerSize()); | 2630 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2631 } | 2631 } |
| 2632 | 2632 |
| 2633 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2633 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2634 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2634 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2635 } | 2635 } |
| OLD | NEW |