| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 int routing_id, | 266 int routing_id, |
| 267 const WebContents* base_web_contents, | 267 const WebContents* base_web_contents, |
| 268 const SessionStorageNamespaceMap& session_storage_namespace_map) { | 268 const SessionStorageNamespaceMap& session_storage_namespace_map) { |
| 269 WebContentsImpl* new_contents = new WebContentsImpl(browser_context, NULL); | 269 WebContentsImpl* new_contents = new WebContentsImpl(browser_context, NULL); |
| 270 | 270 |
| 271 for (SessionStorageNamespaceMap::const_iterator it = | 271 for (SessionStorageNamespaceMap::const_iterator it = |
| 272 session_storage_namespace_map.begin(); | 272 session_storage_namespace_map.begin(); |
| 273 it != session_storage_namespace_map.end(); | 273 it != session_storage_namespace_map.end(); |
| 274 ++it) { | 274 ++it) { |
| 275 new_contents->GetController().SetSessionStorageNamespace(it->first, | 275 new_contents->GetController().SetSessionStorageNamespace(it->first, |
| 276 it->second); | 276 it->second.get()); |
| 277 } | 277 } |
| 278 | 278 |
| 279 new_contents->Init(browser_context, site_instance, routing_id, | 279 new_contents->Init(browser_context, site_instance, routing_id, |
| 280 static_cast<const WebContentsImpl*>(base_web_contents)); | 280 static_cast<const WebContentsImpl*>(base_web_contents)); |
| 281 return new_contents; | 281 return new_contents; |
| 282 } | 282 } |
| 283 | 283 |
| 284 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { | 284 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { |
| 285 return rvh->GetDelegate()->GetAsWebContents(); | 285 return rvh->GetDelegate()->GetAsWebContents(); |
| 286 } | 286 } |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 | 1284 |
| 1285 // We must assign the SessionStorageNamespace before calling Init(). | 1285 // We must assign the SessionStorageNamespace before calling Init(). |
| 1286 // | 1286 // |
| 1287 // http://crbug.com/142685 | 1287 // http://crbug.com/142685 |
| 1288 const std::string& partition_id = | 1288 const std::string& partition_id = |
| 1289 GetContentClient()->browser()-> | 1289 GetContentClient()->browser()-> |
| 1290 GetStoragePartitionIdForSite(GetBrowserContext(), | 1290 GetStoragePartitionIdForSite(GetBrowserContext(), |
| 1291 site_instance->GetSiteURL()); | 1291 site_instance->GetSiteURL()); |
| 1292 StoragePartition* partition = | 1292 StoragePartition* partition = |
| 1293 BrowserContext::GetStoragePartition(GetBrowserContext(), | 1293 BrowserContext::GetStoragePartition(GetBrowserContext(), |
| 1294 site_instance); | 1294 site_instance.get()); |
| 1295 DOMStorageContextImpl* dom_storage_context = | 1295 DOMStorageContextImpl* dom_storage_context = |
| 1296 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); | 1296 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); |
| 1297 SessionStorageNamespaceImpl* session_storage_namespace_impl = | 1297 SessionStorageNamespaceImpl* session_storage_namespace_impl = |
| 1298 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); | 1298 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); |
| 1299 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); | 1299 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); |
| 1300 new_contents->GetController().SetSessionStorageNamespace( | 1300 new_contents->GetController().SetSessionStorageNamespace( |
| 1301 partition_id, | 1301 partition_id, |
| 1302 session_storage_namespace); | 1302 session_storage_namespace); |
| 1303 new_contents->Init(GetBrowserContext(), site_instance, route_id, this); | 1303 new_contents->Init(GetBrowserContext(), site_instance.get(), route_id, this); |
| 1304 | 1304 |
| 1305 new_contents->set_opener_web_ui_type(GetWebUITypeForCurrentState()); | 1305 new_contents->set_opener_web_ui_type(GetWebUITypeForCurrentState()); |
| 1306 | 1306 |
| 1307 if (!params.opener_suppressed) { | 1307 if (!params.opener_suppressed) { |
| 1308 WebContentsView* new_view = new_contents->GetView(); | 1308 WebContentsView* new_view = new_contents->GetView(); |
| 1309 | 1309 |
| 1310 // TODO(brettw): It seems bogus that we have to call this function on the | 1310 // TODO(brettw): It seems bogus that we have to call this function on the |
| 1311 // newly created object and give it one of its own member variables. | 1311 // newly created object and give it one of its own member variables. |
| 1312 new_view->CreateViewForWidget(new_contents->GetRenderViewHost()); | 1312 new_view->CreateViewForWidget(new_contents->GetRenderViewHost()); |
| 1313 | 1313 |
| (...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3336 | 3336 |
| 3337 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3337 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3338 return browser_plugin_guest_.get(); | 3338 return browser_plugin_guest_.get(); |
| 3339 } | 3339 } |
| 3340 | 3340 |
| 3341 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3341 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3342 return browser_plugin_embedder_.get(); | 3342 return browser_plugin_embedder_.get(); |
| 3343 } | 3343 } |
| 3344 | 3344 |
| 3345 } // namespace content | 3345 } // namespace content |
| OLD | NEW |