| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // pending RVH. | 119 // pending RVH. |
| 120 // - The previous renderer is kept swapped out in RenderViewHostManager in case | 120 // - 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 | 121 // 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. | 122 // it, but if so, the existing frame relationships will be maintained. |
| 123 | 123 |
| 124 using content::DevToolsAgentHost; | 124 using content::DevToolsAgentHost; |
| 125 using content::DevToolsAgentHostRegistry; | 125 using content::DevToolsAgentHostRegistry; |
| 126 using content::DevToolsManagerImpl; | 126 using content::DevToolsManagerImpl; |
| 127 using content::DownloadItem; | 127 using content::DownloadItem; |
| 128 using content::DownloadManager; | 128 using content::DownloadManager; |
| 129 using content::DownloadUrlParameters; |
| 129 using content::GlobalRequestID; | 130 using content::GlobalRequestID; |
| 130 using content::HostZoomMap; | 131 using content::HostZoomMap; |
| 131 using content::InterstitialPage; | 132 using content::InterstitialPage; |
| 132 using content::LoadNotificationDetails; | 133 using content::LoadNotificationDetails; |
| 133 using content::NavigationController; | 134 using content::NavigationController; |
| 134 using content::NavigationEntry; | 135 using content::NavigationEntry; |
| 135 using content::NavigationEntryImpl; | 136 using content::NavigationEntryImpl; |
| 136 using content::OpenURLParams; | 137 using content::OpenURLParams; |
| 137 using content::RenderViewHost; | 138 using content::RenderViewHost; |
| 138 using content::RenderViewHostDelegate; | 139 using content::RenderViewHostDelegate; |
| 139 using content::RenderViewHostImpl; | 140 using content::RenderViewHostImpl; |
| 140 using content::RenderWidgetHost; | 141 using content::RenderWidgetHost; |
| 141 using content::RenderWidgetHostView; | 142 using content::RenderWidgetHostView; |
| 142 using content::RenderWidgetHostViewPort; | 143 using content::RenderWidgetHostViewPort; |
| 143 using content::ResourceDispatcherHostImpl; | 144 using content::ResourceDispatcherHostImpl; |
| 145 using content::SSLStatus; |
| 144 using content::SessionStorageNamespace; | 146 using content::SessionStorageNamespace; |
| 145 using content::SiteInstance; | 147 using content::SiteInstance; |
| 146 using content::SSLStatus; | |
| 147 using content::UserMetricsAction; | 148 using content::UserMetricsAction; |
| 148 using content::WebContents; | 149 using content::WebContents; |
| 149 using content::WebContentsObserver; | 150 using content::WebContentsObserver; |
| 150 using content::WebUI; | 151 using content::WebUI; |
| 151 using content::WebUIController; | 152 using content::WebUIController; |
| 152 using content::WebUIControllerFactory; | 153 using content::WebUIControllerFactory; |
| 153 | 154 |
| 154 namespace { | 155 namespace { |
| 155 | 156 |
| 156 // Amount of time we wait between when a key event is received and the renderer | 157 // 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) | 2607 if (!dlm) |
| 2607 return; | 2608 return; |
| 2608 int64 post_id = -1; | 2609 int64 post_id = -1; |
| 2609 if (is_main_frame) { | 2610 if (is_main_frame) { |
| 2610 const NavigationEntry* entry = controller_.GetActiveEntry(); | 2611 const NavigationEntry* entry = controller_.GetActiveEntry(); |
| 2611 if (entry) | 2612 if (entry) |
| 2612 post_id = entry->GetPostID(); | 2613 post_id = entry->GetPostID(); |
| 2613 } | 2614 } |
| 2614 content::DownloadSaveInfo save_info; | 2615 content::DownloadSaveInfo save_info; |
| 2615 save_info.prompt_for_save_location = true; | 2616 save_info.prompt_for_save_location = true; |
| 2616 dlm->DownloadUrl(url, | 2617 DownloadUrlParameters* params = DownloadUrlParameters::FromWebContents( |
| 2617 referrer, | 2618 this, url, save_info); |
| 2618 "", | 2619 params->set_referrer(referrer); |
| 2619 true, // prefer_cache | 2620 params->set_post_id(post_id); |
| 2620 post_id, | 2621 dlm->DownloadUrl(params); |
| 2621 save_info, | |
| 2622 this, | |
| 2623 DownloadManager::OnStartedCallback()); | |
| 2624 } | 2622 } |
| 2625 | 2623 |
| 2626 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2624 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2627 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2625 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2628 // Can be NULL during tests. | 2626 // Can be NULL during tests. |
| 2629 if (rwh_view) | 2627 if (rwh_view) |
| 2630 rwh_view->SetSize(GetView()->GetContainerSize()); | 2628 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2631 } | 2629 } |
| 2632 | 2630 |
| 2633 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2631 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2634 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2632 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2635 } | 2633 } |
| OLD | NEW |