| 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 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 if (!dlm) | 2681 if (!dlm) |
| 2680 return; | 2682 return; |
| 2681 int64 post_id = -1; | 2683 int64 post_id = -1; |
| 2682 if (is_main_frame) { | 2684 if (is_main_frame) { |
| 2683 const NavigationEntry* entry = controller_.GetActiveEntry(); | 2685 const NavigationEntry* entry = controller_.GetActiveEntry(); |
| 2684 if (entry) | 2686 if (entry) |
| 2685 post_id = entry->GetPostID(); | 2687 post_id = entry->GetPostID(); |
| 2686 } | 2688 } |
| 2687 content::DownloadSaveInfo save_info; | 2689 content::DownloadSaveInfo save_info; |
| 2688 save_info.prompt_for_save_location = true; | 2690 save_info.prompt_for_save_location = true; |
| 2689 dlm->DownloadUrl(url, | 2691 scoped_ptr<DownloadUrlParameters> params( |
| 2690 referrer, | 2692 DownloadUrlParameters::FromWebContents(this, url, save_info)); |
| 2691 "", | 2693 params->set_referrer(referrer); |
| 2692 true, // prefer_cache | 2694 params->set_post_id(post_id); |
| 2693 post_id, | 2695 params->set_prefer_cache(true); |
| 2694 save_info, | 2696 if (post_id >= 0) |
| 2695 this, | 2697 params->set_method("POST"); |
| 2696 DownloadManager::OnStartedCallback()); | 2698 dlm->DownloadUrl(params.Pass()); |
| 2697 } | 2699 } |
| 2698 | 2700 |
| 2699 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2701 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2700 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2702 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2701 // Can be NULL during tests. | 2703 // Can be NULL during tests. |
| 2702 if (rwh_view) | 2704 if (rwh_view) |
| 2703 rwh_view->SetSize(GetView()->GetContainerSize()); | 2705 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2704 } | 2706 } |
| 2705 | 2707 |
| 2706 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2708 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2707 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2709 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2708 } | 2710 } |
| OLD | NEW |