summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser_tabrestore.cc
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-13 22:50:19 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-13 22:50:19 +0000
commitd1198fdc8cced343476dbe03ebe108fd44d85309 (patch)
treea2013d55fda06c717ffb2ef49400805b529beaad /chrome/browser/ui/browser_tabrestore.cc
parent97d592f740b8da784ca059f96d728ef36cf374c9 (diff)
downloadchromium_src-d1198fdc8cced343476dbe03ebe108fd44d85309.zip
chromium_src-d1198fdc8cced343476dbe03ebe108fd44d85309.tar.gz
chromium_src-d1198fdc8cced343476dbe03ebe108fd44d85309.tar.bz2
Move SessionStorageNamespace entirely into NavigationController and support StoragePartitions.
Previously, WebContents, NavigationController, and RenderViewHost all exposed APIs that allowed one to retrieve the SessionStorageNamespace associated with them. This is confusing because there were too many ways to access the object. After this change, the SessionStorageNamespace is only exposed by the NavigationController. Conceptually a SessionStorageNamespace belongs to a WebContents but we store it in NavigationController because on tab duplication, the NavigationController becomes the authoritative state of the tab. Also, to support StoragePartitions, the NavigationController now maintains a map of partition_id -> SessionStorageNamespace. Someone requesting a SessionStorageNamespace must either know which StoragePartition they are coming from, or which child process they are acting on behalf of. This change also changes the way TabContents and WebContents are created. 1) We now have explicitly separate creation methods for prepopulating with SessionStorage and creating with an opener. 2) Some of the WebContentImpl construct has been moved into an Init() function to avoid accidental calls to virtual functions by subobjects. TBR-ing all the directories where I just remove a NULL. TBR=sky,stevenjb,dominich,brettw,satorux,kalman BUG=85121 Review URL: https://chromiumcodereview.appspot.com/10831116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_tabrestore.cc')
-rw-r--r--chrome/browser/ui/browser_tabrestore.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/chrome/browser/ui/browser_tabrestore.cc b/chrome/browser/ui/browser_tabrestore.cc
index 0162498..cb184a3 100644
--- a/chrome/browser/ui/browser_tabrestore.cc
+++ b/chrome/browser/ui/browser_tabrestore.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/session_storage_namespace.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "ipc/ipc_message.h"
@@ -39,14 +40,21 @@ content::WebContents* AddRestoredTab(
bool select,
bool pin,
bool from_last_session,
- content::SessionStorageNamespace* storage_namespace) {
+ content::SessionStorageNamespace* session_storage_namespace) {
GURL restore_url = navigations.at(selected_navigation).virtual_url();
- TabContents* tab_contents = chrome::TabContentsFactory(
+ // TODO(ajwong): Remove the temporary session_storage_namespace_map when
+ // we teach session restore to understand that one tab can have multiple
+ // SessionStorageNamespace objects. Also remove the
+ // session_storage_namespace.h include since we only need that to assign
+ // into the map.
+ content::SessionStorageNamespaceMap session_storage_namespace_map;
+ session_storage_namespace_map[""] = session_storage_namespace;
+ TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory(
browser->profile(),
tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url),
MSG_ROUTING_NONE,
chrome::GetActiveWebContents(browser),
- storage_namespace);
+ session_storage_namespace_map);
WebContents* new_tab = tab_contents->web_contents();
tab_contents->extension_tab_helper()->SetExtensionAppById(extension_app_id);
std::vector<NavigationEntry*> entries;
@@ -94,12 +102,19 @@ void ReplaceRestoredTab(
const std::string& extension_app_id,
content::SessionStorageNamespace* session_storage_namespace) {
GURL restore_url = navigations.at(selected_navigation).virtual_url();
- TabContents* tab_contents = chrome::TabContentsFactory(
+ // TODO(ajwong): Remove the temporary session_storage_namespace_map when
+ // we teach session restore to understand that one tab can have multiple
+ // SessionStorageNamespace objects. Also remove the
+ // session_storage_namespace.h include since we only need that to assign
+ // into the map.
+ content::SessionStorageNamespaceMap session_storage_namespace_map;
+ session_storage_namespace_map[""] = session_storage_namespace;
+ TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory(
browser->profile(),
tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url),
MSG_ROUTING_NONE,
GetActiveWebContents(browser),
- session_storage_namespace);
+ session_storage_namespace_map);
tab_contents->extension_tab_helper()->SetExtensionAppById(extension_app_id);
WebContents* replacement = tab_contents->web_contents();
std::vector<NavigationEntry*> entries;