Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: content/browser/web_contents/navigation_controller_impl.h

Issue 10831116: Move SessionStorageNamespace entirely into NavigationController and support StoragePartitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "content/browser/ssl/ssl_manager.h" 12 #include "content/browser/ssl/ssl_manager.h"
13 #include "content/public/browser/android/navigation_controller_webview.h" 13 #include "content/public/browser/android/navigation_controller_webview.h"
14 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
15 #include "content/public/browser/navigation_type.h" 15 #include "content/public/browser/navigation_type.h"
16 16
17 class SessionStorageNamespaceImpl;
18 struct ViewHostMsg_FrameNavigate_Params; 17 struct ViewHostMsg_FrameNavigate_Params;
19 class WebContentsImpl; 18 class WebContentsImpl;
20 19
21 namespace content { 20 namespace content {
22 class NavigationEntryImpl; 21 class NavigationEntryImpl;
23 struct LoadCommittedDetails; 22 struct LoadCommittedDetails;
24 class SiteInstance; 23 class SiteInstance;
25 } 24 }
26 25
27 class CONTENT_EXPORT NavigationControllerImpl 26 class CONTENT_EXPORT NavigationControllerImpl
28 : public NON_EXPORTED_BASE(content::NavigationController), 27 : public NON_EXPORTED_BASE(content::NavigationController),
29 public NON_EXPORTED_BASE(content::NavigationControllerWebView) { 28 public NON_EXPORTED_BASE(content::NavigationControllerWebView) {
30 public: 29 public:
31 NavigationControllerImpl( 30 NavigationControllerImpl(
32 WebContentsImpl* web_contents, 31 WebContentsImpl* web_contents,
33 content::BrowserContext* browser_context, 32 content::BrowserContext* browser_context);
34 SessionStorageNamespaceImpl* session_storage_namespace);
35 virtual ~NavigationControllerImpl(); 33 virtual ~NavigationControllerImpl();
36 34
37 // NavigationController implementation: 35 // NavigationController implementation:
38 virtual content::WebContents* GetWebContents() const OVERRIDE; 36 virtual content::WebContents* GetWebContents() const OVERRIDE;
39 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; 37 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE;
40 virtual void SetBrowserContext( 38 virtual void SetBrowserContext(
41 content::BrowserContext* browser_context) OVERRIDE; 39 content::BrowserContext* browser_context) OVERRIDE;
42 virtual void Restore( 40 virtual void Restore(
43 int selected_navigation, 41 int selected_navigation,
44 bool from_last_session, 42 bool from_last_session,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool is_renderer_initiated) OVERRIDE; 78 bool is_renderer_initiated) OVERRIDE;
81 virtual void LoadIfNecessary() OVERRIDE; 79 virtual void LoadIfNecessary() OVERRIDE;
82 virtual bool CanGoBack() const OVERRIDE; 80 virtual bool CanGoBack() const OVERRIDE;
83 virtual bool CanGoForward() const OVERRIDE; 81 virtual bool CanGoForward() const OVERRIDE;
84 virtual bool CanGoToOffset(int offset) const OVERRIDE; 82 virtual bool CanGoToOffset(int offset) const OVERRIDE;
85 virtual void GoBack() OVERRIDE; 83 virtual void GoBack() OVERRIDE;
86 virtual void GoForward() OVERRIDE; 84 virtual void GoForward() OVERRIDE;
87 virtual void GoToIndex(int index) OVERRIDE; 85 virtual void GoToIndex(int index) OVERRIDE;
88 virtual void GoToOffset(int offset) OVERRIDE; 86 virtual void GoToOffset(int offset) OVERRIDE;
89 virtual void RemoveEntryAtIndex(int index) OVERRIDE; 87 virtual void RemoveEntryAtIndex(int index) OVERRIDE;
88 virtual const content::SessionStorageNamespaceMap&
89 GetSessionStorageNamespaceMap() const OVERRIDE;
90 virtual content::SessionStorageNamespace* 90 virtual content::SessionStorageNamespace*
91 GetSessionStorageNamespace() const OVERRIDE; 91 GetDefaultSessionStorageNamespace() OVERRIDE;
92 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE; 92 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE;
93 virtual int32 GetMaxRestoredPageID() const OVERRIDE; 93 virtual int32 GetMaxRestoredPageID() const OVERRIDE;
94 virtual bool NeedsReload() const OVERRIDE; 94 virtual bool NeedsReload() const OVERRIDE;
95 virtual void CancelPendingReload() OVERRIDE; 95 virtual void CancelPendingReload() OVERRIDE;
96 virtual void ContinuePendingReload() OVERRIDE; 96 virtual void ContinuePendingReload() OVERRIDE;
97 virtual bool IsInitialNavigation() OVERRIDE; 97 virtual bool IsInitialNavigation() OVERRIDE;
98 virtual void Reload(bool check_for_repost) OVERRIDE; 98 virtual void Reload(bool check_for_repost) OVERRIDE;
99 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE; 99 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE;
100 virtual void NotifyEntryChanged(const content::NavigationEntry* entry, 100 virtual void NotifyEntryChanged(const content::NavigationEntry* entry,
101 int index) OVERRIDE; 101 int index) OVERRIDE;
102 virtual void CopyStateFrom( 102 virtual void CopyStateFrom(
103 const content::NavigationController& source) OVERRIDE; 103 const content::NavigationController& source) OVERRIDE;
104 virtual void CopyStateFromAndPrune( 104 virtual void CopyStateFromAndPrune(
105 content::NavigationController* source) OVERRIDE; 105 content::NavigationController* source) OVERRIDE;
106 virtual void PruneAllButActive() OVERRIDE; 106 virtual void PruneAllButActive() OVERRIDE;
107 107
108 // NavigationControllerWebView implementation. 108 // NavigationControllerWebView implementation.
109 virtual void LoadDataWithBaseURL( 109 virtual void LoadDataWithBaseURL(
110 const GURL& data_url, 110 const GURL& data_url,
111 const content::Referrer& referrer, 111 const content::Referrer& referrer,
112 const GURL& base_url, 112 const GURL& base_url,
113 const GURL& history_url, 113 const GURL& history_url,
114 bool is_overriding_user_agent) OVERRIDE; 114 bool is_overriding_user_agent) OVERRIDE;
115 virtual void PostURL(const GURL& url, 115 virtual void PostURL(const GURL& url,
116 const content::Referrer& referrer, 116 const content::Referrer& referrer,
117 const base::RefCountedMemory& http_body, 117 const base::RefCountedMemory& http_body,
118 bool is_overriding_user_agent) OVERRIDE; 118 bool is_overriding_user_agent) OVERRIDE;
119 119
120 // The session storage namespace that all child RenderViews in the renderer
121 // process with the given ID should use.
Charlie Reis 2012/08/13 19:39:22 This comment is stale, since we now use the SiteIn
awong 2012/08/13 21:29:19 Done.
122 content::SessionStorageNamespace* GetSessionStorageNamespace(
123 content::SiteInstance* instance);
124
120 // Returns the index of the specified entry, or -1 if entry is not contained 125 // Returns the index of the specified entry, or -1 if entry is not contained
121 // in this NavigationController. 126 // in this NavigationController.
122 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const; 127 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const;
123 128
124 // Return the index of the entry with the corresponding instance and page_id, 129 // Return the index of the entry with the corresponding instance and page_id,
125 // or -1 if not found. 130 // or -1 if not found.
126 int GetEntryIndexWithPageID(content::SiteInstance* instance, 131 int GetEntryIndexWithPageID(content::SiteInstance* instance,
127 int32 page_id) const; 132 int32 page_id) const;
128 133
129 // Return the entry with the corresponding instance and page_id, or NULL if 134 // Return the entry with the corresponding instance and page_id, or NULL if
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // is no last committed entry, then nothing will be in-page. 188 // is no last committed entry, then nothing will be in-page.
184 // 189 //
185 // Special note: if the URLs are the same, it does NOT count as an in-page 190 // Special note: if the URLs are the same, it does NOT count as an in-page
186 // navigation. Neither does an input URL that has no ref, even if the rest is 191 // navigation. Neither does an input URL that has no ref, even if the rest is
187 // the same. This may seem weird, but when we're considering whether a 192 // the same. This may seem weird, but when we're considering whether a
188 // navigation happened without loading anything, the same URL would be a 193 // navigation happened without loading anything, the same URL would be a
189 // reload, while only a different ref would be in-page (pages can't clear 194 // reload, while only a different ref would be in-page (pages can't clear
190 // refs without reload, only change to "#" which we don't count as empty). 195 // refs without reload, only change to "#" which we don't count as empty).
191 bool IsURLInPageNavigation(const GURL& url) const; 196 bool IsURLInPageNavigation(const GURL& url) const;
192 197
198 // Sets the SessionStorageNamespace for the given |partition_id|. This is
199 // used during initialization of a new NavigationController to allow
200 // pre-population of the SessionStorageNamespace objects. Session restore,
201 // prerendering, and the implementaion of window.open() are the primary users
202 // of this API.
203 //
204 // Calling this function when a SessionStorageNamespace has already been
205 // associated with a |partition_id| will CHECK() fail.
206 void SetSessionStorageNamespace(
207 const std::string& partition_id,
208 content::SessionStorageNamespace* session_storage_namespace);
209
193 // Random data --------------------------------------------------------------- 210 // Random data ---------------------------------------------------------------
194 211
195 SSLManager* ssl_manager() { return &ssl_manager_; } 212 SSLManager* ssl_manager() { return &ssl_manager_; }
196 213
197 // Maximum number of entries before we start removing entries from the front. 214 // Maximum number of entries before we start removing entries from the front.
198 static void set_max_entry_count_for_testing(size_t max_entry_count) { 215 static void set_max_entry_count_for_testing(size_t max_entry_count) {
199 max_entry_count_for_testing_ = max_entry_count; 216 max_entry_count_for_testing_ = max_entry_count;
200 } 217 }
201 static size_t max_entry_count(); 218 static size_t max_entry_count();
202 219
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 354
338 // Manages the SSL security UI 355 // Manages the SSL security UI
339 SSLManager ssl_manager_; 356 SSLManager ssl_manager_;
340 357
341 // Whether we need to be reloaded when made active. 358 // Whether we need to be reloaded when made active.
342 bool needs_reload_; 359 bool needs_reload_;
343 360
344 // The time ticks at which the last document was loaded. 361 // The time ticks at which the last document was loaded.
345 base::TimeTicks last_document_loaded_; 362 base::TimeTicks last_document_loaded_;
346 363
347 // The session storage id that any (indirectly) owned RenderView should use. 364 // Used to find the appropriate SessionStorageNamespace for the storage
348 scoped_refptr<SessionStorageNamespaceImpl> session_storage_namespace_; 365 // partition of a NavigationEntry.
366 //
367 // A NavigationController may contain NavigationEntries that correspond to
368 // different StoragePartitions. Even though they are part of the same
369 // NavigationController, only entries in the same StoragePartition may
370 // share session storage state with one another.
371 content::SessionStorageNamespaceMap session_storage_namespace_map_;
349 372
350 // The maximum number of entries that a navigation controller can store. 373 // The maximum number of entries that a navigation controller can store.
351 static size_t max_entry_count_for_testing_; 374 static size_t max_entry_count_for_testing_;
352 375
353 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), 376 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
354 // NO_RELOAD otherwise. 377 // NO_RELOAD otherwise.
355 ReloadType pending_reload_; 378 ReloadType pending_reload_;
356 379
357 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); 380 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
358 }; 381 };
359 382
360 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 383 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698