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