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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 WebContents* WebContents::CreateWithSessionStorage( | 265 WebContents* WebContents::CreateWithSessionStorage( |
266 const WebContents::CreateParams& params, | 266 const WebContents::CreateParams& params, |
267 const SessionStorageNamespaceMap& session_storage_namespace_map) { | 267 const SessionStorageNamespaceMap& session_storage_namespace_map) { |
268 WebContentsImpl* new_contents = new WebContentsImpl( | 268 WebContentsImpl* new_contents = new WebContentsImpl( |
269 params.browser_context, NULL); | 269 params.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() |
276 it->second); | 276 .SetSessionStorageNamespace(it->first, it->second.get()); |
277 } | 277 } |
278 | 278 |
279 new_contents->Init(params); | 279 new_contents->Init(params); |
280 return new_contents; | 280 return new_contents; |
281 } | 281 } |
282 | 282 |
283 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { | 283 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { |
284 return rvh->GetDelegate()->GetAsWebContents(); | 284 return rvh->GetDelegate()->GetAsWebContents(); |
285 } | 285 } |
286 | 286 |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 new WebContentsImpl(GetBrowserContext(), | 1408 new WebContentsImpl(GetBrowserContext(), |
1409 params.opener_suppressed ? NULL : this); | 1409 params.opener_suppressed ? NULL : this); |
1410 | 1410 |
1411 // We must assign the SessionStorageNamespace before calling Init(). | 1411 // We must assign the SessionStorageNamespace before calling Init(). |
1412 // | 1412 // |
1413 // http://crbug.com/142685 | 1413 // http://crbug.com/142685 |
1414 const std::string& partition_id = | 1414 const std::string& partition_id = |
1415 GetContentClient()->browser()-> | 1415 GetContentClient()->browser()-> |
1416 GetStoragePartitionIdForSite(GetBrowserContext(), | 1416 GetStoragePartitionIdForSite(GetBrowserContext(), |
1417 site_instance->GetSiteURL()); | 1417 site_instance->GetSiteURL()); |
1418 StoragePartition* partition = | 1418 StoragePartition* partition = BrowserContext::GetStoragePartition( |
1419 BrowserContext::GetStoragePartition(GetBrowserContext(), | 1419 GetBrowserContext(), site_instance.get()); |
1420 site_instance); | |
1421 DOMStorageContextImpl* dom_storage_context = | 1420 DOMStorageContextImpl* dom_storage_context = |
1422 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); | 1421 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); |
1423 SessionStorageNamespaceImpl* session_storage_namespace_impl = | 1422 SessionStorageNamespaceImpl* session_storage_namespace_impl = |
1424 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); | 1423 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); |
1425 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); | 1424 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); |
1426 new_contents->GetController().SetSessionStorageNamespace( | 1425 new_contents->GetController().SetSessionStorageNamespace( |
1427 partition_id, | 1426 partition_id, |
1428 session_storage_namespace); | 1427 session_storage_namespace); |
1429 CreateParams create_params(GetBrowserContext(), site_instance); | 1428 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
1430 create_params.routing_id = route_id; | 1429 create_params.routing_id = route_id; |
1431 create_params.main_frame_routing_id = main_frame_route_id; | 1430 create_params.main_frame_routing_id = main_frame_route_id; |
1432 if (!is_guest) { | 1431 if (!is_guest) { |
1433 create_params.context = view_->GetNativeView(); | 1432 create_params.context = view_->GetNativeView(); |
1434 create_params.initial_size = view_->GetContainerSize(); | 1433 create_params.initial_size = view_->GetContainerSize(); |
1435 } else { | 1434 } else { |
1436 // This makes |new_contents| act as a guest. | 1435 // This makes |new_contents| act as a guest. |
1437 // For more info, see comment above class BrowserPluginGuest. | 1436 // For more info, see comment above class BrowserPluginGuest. |
1438 int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); | 1437 int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); |
1439 WebContentsImpl* new_contents_impl = | 1438 WebContentsImpl* new_contents_impl = |
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3580 } | 3579 } |
3581 | 3580 |
3582 BrowserPluginGuestManager* | 3581 BrowserPluginGuestManager* |
3583 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3582 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3584 return static_cast<BrowserPluginGuestManager*>( | 3583 return static_cast<BrowserPluginGuestManager*>( |
3585 GetBrowserContext()->GetUserData( | 3584 GetBrowserContext()->GetUserData( |
3586 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3585 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3587 } | 3586 } |
3588 | 3587 |
3589 } // namespace content | 3588 } // namespace content |
OLD | NEW |