| 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/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" // Temporary | 9 #include "base/string_number_conversions.h" // Temporary |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "content/browser/browser_url_handler_impl.h" | 13 #include "content/browser/browser_url_handler_impl.h" |
| 14 #include "content/browser/child_process_security_policy_impl.h" | 14 #include "content/browser/child_process_security_policy_impl.h" |
| 15 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 15 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 17 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary | 17 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary |
| 18 #include "content/browser/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
| 19 #include "content/browser/web_contents/debug_urls.h" | 19 #include "content/browser/web_contents/debug_urls.h" |
| 20 #include "content/browser/web_contents/interstitial_page_impl.h" | 20 #include "content/browser/web_contents/interstitial_page_impl.h" |
| 21 #include "content/browser/web_contents/navigation_entry_impl.h" | 21 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 22 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| 23 #include "content/common/view_messages.h" | 23 #include "content/common/view_messages.h" |
| 24 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
| 26 #include "content/public/browser/invalidate_type.h" | 26 #include "content/public/browser/invalidate_type.h" |
| 27 #include "content/public/browser/navigation_details.h" | 27 #include "content/public/browser/navigation_details.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
| 30 #include "content/public/browser/storage_partition.h" |
| 30 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
| 31 #include "content/public/browser/web_contents_delegate.h" | 32 #include "content/public/browser/web_contents_delegate.h" |
| 32 #include "content/public/common/content_client.h" | 33 #include "content/public/common/content_client.h" |
| 33 #include "content/public/common/content_constants.h" | 34 #include "content/public/common/content_constants.h" |
| 34 #include "content/public/common/url_constants.h" | 35 #include "content/public/common/url_constants.h" |
| 35 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
| 36 #include "net/base/mime_util.h" | 37 #include "net/base/mime_util.h" |
| 37 #include "net/base/net_util.h" | 38 #include "net/base/net_util.h" |
| 38 #include "webkit/glue/webkit_glue.h" | 39 #include "webkit/glue/webkit_glue.h" |
| 39 | 40 |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 GetContentClient()->browser()->GetStoragePartitionIdForSiteInstance( | 1263 GetContentClient()->browser()->GetStoragePartitionIdForSiteInstance( |
| 1263 browser_context_, instance); | 1264 browser_context_, instance); |
| 1264 } | 1265 } |
| 1265 | 1266 |
| 1266 SessionStorageNamespaceMap::const_iterator it = | 1267 SessionStorageNamespaceMap::const_iterator it = |
| 1267 session_storage_namespace_map_.find(partition_id); | 1268 session_storage_namespace_map_.find(partition_id); |
| 1268 if (it != session_storage_namespace_map_.end()) | 1269 if (it != session_storage_namespace_map_.end()) |
| 1269 return it->second.get(); | 1270 return it->second.get(); |
| 1270 | 1271 |
| 1271 // Create one if no one has accessed session storage for this partition yet. | 1272 // Create one if no one has accessed session storage for this partition yet. |
| 1273 // |
| 1274 // TODO(ajwong): Should this use the |partition_id| directly rather than |
| 1275 // re-lookup via |instance|? http://crbug.com/142685 |
| 1276 content::StoragePartition* partition = |
| 1277 BrowserContext::GetStoragePartition(browser_context_, instance); |
| 1272 SessionStorageNamespaceImpl* session_storage_namespace = | 1278 SessionStorageNamespaceImpl* session_storage_namespace = |
| 1273 new SessionStorageNamespaceImpl( | 1279 new SessionStorageNamespaceImpl( |
| 1274 static_cast<DOMStorageContextImpl*>( | 1280 static_cast<DOMStorageContextImpl*>( |
| 1275 BrowserContext::GetDOMStorageContextByPartitionId( | 1281 partition->GetDOMStorageContext())); |
| 1276 browser_context_, partition_id))); | |
| 1277 session_storage_namespace_map_[partition_id] = session_storage_namespace; | 1282 session_storage_namespace_map_[partition_id] = session_storage_namespace; |
| 1278 | 1283 |
| 1279 return session_storage_namespace; | 1284 return session_storage_namespace; |
| 1280 } | 1285 } |
| 1281 | 1286 |
| 1282 SessionStorageNamespace* | 1287 SessionStorageNamespace* |
| 1283 NavigationControllerImpl::GetDefaultSessionStorageNamespace() { | 1288 NavigationControllerImpl::GetDefaultSessionStorageNamespace() { |
| 1284 // TODO(ajwong): Remove if statement in GetSessionStorageNamespace(). | 1289 // TODO(ajwong): Remove if statement in GetSessionStorageNamespace(). |
| 1285 return GetSessionStorageNamespace(NULL); | 1290 return GetSessionStorageNamespace(NULL); |
| 1286 } | 1291 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 for (int i = 0; i < max_index; i++) { | 1546 for (int i = 0; i < max_index; i++) { |
| 1542 // When cloning a tab, copy all entries except interstitial pages | 1547 // When cloning a tab, copy all entries except interstitial pages |
| 1543 if (source.entries_[i].get()->GetPageType() != | 1548 if (source.entries_[i].get()->GetPageType() != |
| 1544 content::PAGE_TYPE_INTERSTITIAL) { | 1549 content::PAGE_TYPE_INTERSTITIAL) { |
| 1545 entries_.insert(entries_.begin() + insert_index++, | 1550 entries_.insert(entries_.begin() + insert_index++, |
| 1546 linked_ptr<NavigationEntryImpl>( | 1551 linked_ptr<NavigationEntryImpl>( |
| 1547 new NavigationEntryImpl(*source.entries_[i]))); | 1552 new NavigationEntryImpl(*source.entries_[i]))); |
| 1548 } | 1553 } |
| 1549 } | 1554 } |
| 1550 } | 1555 } |
| OLD | NEW |