| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "content/public/browser/download_manager.h" | 47 #include "content/public/browser/download_manager.h" |
| 48 #include "content/public/browser/download_url_parameters.h" | 48 #include "content/public/browser/download_url_parameters.h" |
| 49 #include "content/public/browser/invalidate_type.h" | 49 #include "content/public/browser/invalidate_type.h" |
| 50 #include "content/public/browser/javascript_dialogs.h" | 50 #include "content/public/browser/javascript_dialogs.h" |
| 51 #include "content/public/browser/load_from_memory_cache_details.h" | 51 #include "content/public/browser/load_from_memory_cache_details.h" |
| 52 #include "content/public/browser/load_notification_details.h" | 52 #include "content/public/browser/load_notification_details.h" |
| 53 #include "content/public/browser/navigation_details.h" | 53 #include "content/public/browser/navigation_details.h" |
| 54 #include "content/public/browser/notification_details.h" | 54 #include "content/public/browser/notification_details.h" |
| 55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/resource_request_details.h" | 56 #include "content/public/browser/resource_request_details.h" |
| 57 #include "content/public/browser/storage_partition.h" |
| 57 #include "content/public/browser/user_metrics.h" | 58 #include "content/public/browser/user_metrics.h" |
| 58 #include "content/public/browser/web_contents_delegate.h" | 59 #include "content/public/browser/web_contents_delegate.h" |
| 59 #include "content/public/browser/web_contents_observer.h" | 60 #include "content/public/browser/web_contents_observer.h" |
| 60 #include "content/public/browser/web_contents_view.h" | 61 #include "content/public/browser/web_contents_view.h" |
| 61 #include "content/public/browser/web_ui_controller_factory.h" | 62 #include "content/public/browser/web_ui_controller_factory.h" |
| 62 #include "content/public/common/bindings_policy.h" | 63 #include "content/public/common/bindings_policy.h" |
| 63 #include "content/public/common/content_constants.h" | 64 #include "content/public/common/content_constants.h" |
| 64 #include "content/public/common/content_restriction.h" | 65 #include "content/public/common/content_restriction.h" |
| 65 #include "content/public/common/content_switches.h" | 66 #include "content/public/common/content_switches.h" |
| 66 #include "content/public/common/url_constants.h" | 67 #include "content/public/common/url_constants.h" |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 SiteInstance::Create(GetBrowserContext()) : | 1238 SiteInstance::Create(GetBrowserContext()) : |
| 1238 GetSiteInstance(); | 1239 GetSiteInstance(); |
| 1239 | 1240 |
| 1240 // Create the new web contents. This will automatically create the new | 1241 // Create the new web contents. This will automatically create the new |
| 1241 // WebContentsView. In the future, we may want to create the view separately. | 1242 // WebContentsView. In the future, we may want to create the view separately. |
| 1242 WebContentsImpl* new_contents = | 1243 WebContentsImpl* new_contents = |
| 1243 new WebContentsImpl(GetBrowserContext(), | 1244 new WebContentsImpl(GetBrowserContext(), |
| 1244 params.opener_suppressed ? NULL : this); | 1245 params.opener_suppressed ? NULL : this); |
| 1245 | 1246 |
| 1246 // We must assign the SessionStorageNamespace before calling Init(). | 1247 // We must assign the SessionStorageNamespace before calling Init(). |
| 1248 // |
| 1249 // http://crbug.com/142685 |
| 1247 const std::string& partition_id = | 1250 const std::string& partition_id = |
| 1248 content::GetContentClient()->browser()-> | 1251 content::GetContentClient()->browser()-> |
| 1249 GetStoragePartitionIdForSiteInstance(GetBrowserContext(), | 1252 GetStoragePartitionIdForSiteInstance(GetBrowserContext(), |
| 1250 site_instance); | 1253 site_instance); |
| 1254 content::StoragePartition* partition = |
| 1255 BrowserContext::GetStoragePartition(GetBrowserContext(), |
| 1256 site_instance); |
| 1251 DOMStorageContextImpl* dom_storage_context = | 1257 DOMStorageContextImpl* dom_storage_context = |
| 1252 static_cast<DOMStorageContextImpl*>( | 1258 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); |
| 1253 BrowserContext::GetDOMStorageContextByPartitionId( | |
| 1254 GetBrowserContext(), partition_id)); | |
| 1255 SessionStorageNamespaceImpl* session_storage_namespace_impl = | 1259 SessionStorageNamespaceImpl* session_storage_namespace_impl = |
| 1256 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); | 1260 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); |
| 1257 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); | 1261 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); |
| 1258 new_contents->GetController().SetSessionStorageNamespace( | 1262 new_contents->GetController().SetSessionStorageNamespace( |
| 1259 partition_id, | 1263 partition_id, |
| 1260 session_storage_namespace); | 1264 session_storage_namespace); |
| 1261 new_contents->Init(GetBrowserContext(), site_instance, route_id, this); | 1265 new_contents->Init(GetBrowserContext(), site_instance, route_id, this); |
| 1262 | 1266 |
| 1263 new_contents->set_opener_web_ui_type(GetWebUITypeForCurrentState()); | 1267 new_contents->set_opener_web_ui_type(GetWebUITypeForCurrentState()); |
| 1264 | 1268 |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3204 old_browser_plugin_host()->embedder_render_process_host(); | 3208 old_browser_plugin_host()->embedder_render_process_host(); |
| 3205 *embedder_container_id = old_browser_plugin_host()->instance_id(); | 3209 *embedder_container_id = old_browser_plugin_host()->instance_id(); |
| 3206 int embedder_process_id = | 3210 int embedder_process_id = |
| 3207 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; | 3211 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; |
| 3208 if (embedder_process_id != -1) { | 3212 if (embedder_process_id != -1) { |
| 3209 *embedder_channel_name = | 3213 *embedder_channel_name = |
| 3210 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), | 3214 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), |
| 3211 embedder_process_id); | 3215 embedder_process_id); |
| 3212 } | 3216 } |
| 3213 } | 3217 } |
| OLD | NEW |