summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 04:50:34 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 04:50:34 +0000
commit4e6419cf5374adda16f97be965b8b7e5b225224f (patch)
tree594ced66460efaedf1071dd7468ba7012d0a6280 /chrome/browser/tab_contents
parentfc105849740379470c96501032e377668a2f5e7e (diff)
downloadchromium_src-4e6419cf5374adda16f97be965b8b7e5b225224f.zip
chromium_src-4e6419cf5374adda16f97be965b8b7e5b225224f.tar.gz
chromium_src-4e6419cf5374adda16f97be965b8b7e5b225224f.tar.bz2
Introduce all the plumbing for Session Storage. This mostly consists of creating and tracking namespace ids in conjunction with the tabs. This is essentially just a bunch of dead code at the moment, but the next patch will get rid of the old way of generating/cloning IDs (initiated by the renderer) and instead use these IDs.
TEST=none BUG=none Review URL: http://codereview.chromium.org/550017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc3
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc10
-rw-r--r--chrome/browser/tab_contents/navigation_controller.h8
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager.cc6
4 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 55972f3..f6db824 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/bindings_policy.h"
+#include "chrome/common/dom_storage_common.h"
#if defined(TOOLKIT_GTK)
#include "chrome/browser/gtk/gtk_theme_provider.h"
#endif
@@ -383,7 +384,7 @@ void InterstitialPage::DomOperationResponse(const std::string& json_string,
RenderViewHost* InterstitialPage::CreateRenderViewHost() {
RenderViewHost* render_view_host = new RenderViewHost(
SiteInstance::CreateSiteInstance(tab()->profile()),
- this, MSG_ROUTING_NONE);
+ this, MSG_ROUTING_NONE, kInvalidSessionStorageNamespaceId);
return render_view_host;
}
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index fa4c783..3cbe29c 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -12,6 +12,8 @@
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_url_handler.h"
+#include "chrome/browser/in_process_webkit/dom_storage_context.h"
+#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/sessions/session_types.h"
@@ -133,7 +135,9 @@ NavigationController::NavigationController(TabContents* contents,
max_restored_page_id_(-1),
ALLOW_THIS_IN_INITIALIZER_LIST(ssl_manager_(this)),
needs_reload_(false),
- user_gesture_observed_(false) {
+ user_gesture_observed_(false),
+ session_storage_namespace_id_(profile->GetWebKitContext()->
+ dom_storage_context()->AllocateSessionStorageNamespaceId()) {
DCHECK(profile_);
}
@@ -856,6 +860,10 @@ void NavigationController::CopyStateFrom(const NavigationController& source) {
new NavigationEntry(*source.entries_[i])));
}
+ session_storage_namespace_id_ =
+ profile_->GetWebKitContext()->dom_storage_context()->CloneSessionStorage(
+ source.session_storage_namespace_id_);
+
FinishRestore(source.last_committed_entry_index_, false);
}
diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h
index 59af542..5378546 100644
--- a/chrome/browser/tab_contents/navigation_controller.h
+++ b/chrome/browser/tab_contents/navigation_controller.h
@@ -374,6 +374,11 @@ class NavigationController {
// if it was restored from a previous session. (-1 otherwise)
int max_restored_page_id() const { return max_restored_page_id_; }
+ // The session storage namespace id that all child render views should use.
+ int64 session_storage_namespace_id() const {
+ return session_storage_namespace_id_;
+ }
+
// Disables checking for a repost and prompting the user. This is used during
// testing.
static void DisablePromptOnRepost();
@@ -528,6 +533,9 @@ class NavigationController {
// Whether a user gesture has been observed since the last navigation.
bool user_gesture_observed_;
+ // The session storage id that any (indirectly) owned RenderView should use.
+ int64 session_storage_namespace_id_;
+
// Should Reload check for post data? The default is true, but is set to false
// when testing.
static bool check_for_repost_;
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index 8622f39..6fec169 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -55,7 +55,8 @@ void RenderViewHostManager::Init(Profile* profile,
if (!site_instance)
site_instance = SiteInstance::CreateSiteInstance(profile);
render_view_host_ = RenderViewHostFactory::Create(
- site_instance, render_view_delegate_, routing_id);
+ site_instance, render_view_delegate_, routing_id, delegate_->
+ GetControllerForRenderManager().session_storage_namespace_id());
NotificationService::current()->Notify(
NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB,
Source<RenderViewHostManager>(this),
@@ -412,7 +413,8 @@ bool RenderViewHostManager::CreatePendingRenderView(SiteInstance* instance) {
}
pending_render_view_host_ = RenderViewHostFactory::Create(
- instance, render_view_delegate_, MSG_ROUTING_NONE);
+ instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_->
+ GetControllerForRenderManager().session_storage_namespace_id());
NotificationService::current()->Notify(
NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB,
Source<RenderViewHostManager>(this),