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

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: mac win compile fixes 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;
90 virtual content::SessionStorageNamespace* 88 virtual const content::SessionStorageNamespaceMap&
91 GetSessionStorageNamespace() const OVERRIDE; 89 GetSessionStorageNamespaceMap() const OVERRIDE;
92 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE; 90 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE;
93 virtual int32 GetMaxRestoredPageID() const OVERRIDE; 91 virtual int32 GetMaxRestoredPageID() const OVERRIDE;
94 virtual bool NeedsReload() const OVERRIDE; 92 virtual bool NeedsReload() const OVERRIDE;
95 virtual void CancelPendingReload() OVERRIDE; 93 virtual void CancelPendingReload() OVERRIDE;
96 virtual void ContinuePendingReload() OVERRIDE; 94 virtual void ContinuePendingReload() OVERRIDE;
97 virtual bool IsInitialNavigation() OVERRIDE; 95 virtual bool IsInitialNavigation() OVERRIDE;
98 virtual void Reload(bool check_for_repost) OVERRIDE; 96 virtual void Reload(bool check_for_repost) OVERRIDE;
99 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE; 97 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE;
100 virtual void NotifyEntryChanged(const content::NavigationEntry* entry, 98 virtual void NotifyEntryChanged(const content::NavigationEntry* entry,
101 int index) OVERRIDE; 99 int index) OVERRIDE;
102 virtual void CopyStateFrom( 100 virtual void CopyStateFrom(
103 const content::NavigationController& source) OVERRIDE; 101 const content::NavigationController& source) OVERRIDE;
104 virtual void CopyStateFromAndPrune( 102 virtual void CopyStateFromAndPrune(
105 content::NavigationController* source) OVERRIDE; 103 content::NavigationController* source) OVERRIDE;
106 virtual void PruneAllButActive() OVERRIDE; 104 virtual void PruneAllButActive() OVERRIDE;
107 105
108 // NavigationControllerWebView implementation. 106 // NavigationControllerWebView implementation.
109 virtual void LoadDataWithBaseURL( 107 virtual void LoadDataWithBaseURL(
110 const GURL& data_url, 108 const GURL& data_url,
111 const content::Referrer& referrer, 109 const content::Referrer& referrer,
112 const GURL& base_url, 110 const GURL& base_url,
113 const GURL& history_url, 111 const GURL& history_url,
114 bool is_overriding_user_agent) OVERRIDE; 112 bool is_overriding_user_agent) OVERRIDE;
115 virtual void PostURL(const GURL& url, 113 virtual void PostURL(const GURL& url,
116 const content::Referrer& referrer, 114 const content::Referrer& referrer,
117 const base::RefCountedMemory& http_body, 115 const base::RefCountedMemory& http_body,
118 bool is_overriding_user_agent) OVERRIDE; 116 bool is_overriding_user_agent) OVERRIDE;
119 117
118 // The session storage namespace that all child RenderViews in the renderer
119 // process with the given ID should use.
120 content::SessionStorageNamespace* GetSessionStorageNamespace(
121 content::SiteInstance* instance);
122
120 // Returns the index of the specified entry, or -1 if entry is not contained 123 // Returns the index of the specified entry, or -1 if entry is not contained
121 // in this NavigationController. 124 // in this NavigationController.
122 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const; 125 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const;
123 126
124 // Return the index of the entry with the corresponding instance and page_id, 127 // Return the index of the entry with the corresponding instance and page_id,
125 // or -1 if not found. 128 // or -1 if not found.
126 int GetEntryIndexWithPageID(content::SiteInstance* instance, 129 int GetEntryIndexWithPageID(content::SiteInstance* instance,
127 int32 page_id) const; 130 int32 page_id) const;
128 131
129 // Return the entry with the corresponding instance and page_id, or NULL if 132 // Return the entry with the corresponding instance and page_id, or NULL if
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // is no last committed entry, then nothing will be in-page. 181 // is no last committed entry, then nothing will be in-page.
179 // 182 //
180 // Special note: if the URLs are the same, it does NOT count as an in-page 183 // Special note: if the URLs are the same, it does NOT count as an in-page
181 // navigation. Neither does an input URL that has no ref, even if the rest is 184 // navigation. Neither does an input URL that has no ref, even if the rest is
182 // the same. This may seem weird, but when we're considering whether a 185 // the same. This may seem weird, but when we're considering whether a
183 // navigation happened without loading anything, the same URL would be a 186 // navigation happened without loading anything, the same URL would be a
184 // reload, while only a different ref would be in-page (pages can't clear 187 // reload, while only a different ref would be in-page (pages can't clear
185 // refs without reload, only change to "#" which we don't count as empty). 188 // refs without reload, only change to "#" which we don't count as empty).
186 bool IsURLInPageNavigation(const GURL& url) const; 189 bool IsURLInPageNavigation(const GURL& url) const;
187 190
191 // Sets the SessionStorageNamespace for the given |partition_id|. This is
192 // used during initialization of a new NavigationController to allow
193 // pre-population of the SessionStorageNamespace objects. Session restore,
194 // prerendering, and the implementaion of window.open() are the primary users
195 // of this API.
196 //
197 // Calling this function when a SessionStorageNamespace has already been
198 // associated with a |partition_id| will CHECK() fail.
199 void SetSessionStorageNamespace(
200 const std::string& partition_id,
201 content::SessionStorageNamespace* session_storage_namespace);
202
188 // Random data --------------------------------------------------------------- 203 // Random data ---------------------------------------------------------------
189 204
190 SSLManager* ssl_manager() { return &ssl_manager_; } 205 SSLManager* ssl_manager() { return &ssl_manager_; }
191 206
192 // Maximum number of entries before we start removing entries from the front. 207 // Maximum number of entries before we start removing entries from the front.
193 static void set_max_entry_count_for_testing(size_t max_entry_count) { 208 static void set_max_entry_count_for_testing(size_t max_entry_count) {
194 max_entry_count_for_testing_ = max_entry_count; 209 max_entry_count_for_testing_ = max_entry_count;
195 } 210 }
196 static size_t max_entry_count(); 211 static size_t max_entry_count();
197 212
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 347
333 // Manages the SSL security UI 348 // Manages the SSL security UI
334 SSLManager ssl_manager_; 349 SSLManager ssl_manager_;
335 350
336 // Whether we need to be reloaded when made active. 351 // Whether we need to be reloaded when made active.
337 bool needs_reload_; 352 bool needs_reload_;
338 353
339 // The time ticks at which the last document was loaded. 354 // The time ticks at which the last document was loaded.
340 base::TimeTicks last_document_loaded_; 355 base::TimeTicks last_document_loaded_;
341 356
342 // The session storage id that any (indirectly) owned RenderView should use. 357 // Used to find the appropriate SessionStorageNamespace for the storage
343 scoped_refptr<SessionStorageNamespaceImpl> session_storage_namespace_; 358 // partition of a NavigationEntry.
359 //
360 // A NavigationController may contain NavigationEntries that correspond to
361 // different StoragePartitions. Even though they are part of the same
362 // NavigationController, only entries in the same StoragePartition may
363 // share session storage state with one another.
364 content::SessionStorageNamespaceMap session_storage_namespace_map_;
344 365
345 // The maximum number of entries that a navigation controller can store. 366 // The maximum number of entries that a navigation controller can store.
346 static size_t max_entry_count_for_testing_; 367 static size_t max_entry_count_for_testing_;
347 368
348 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), 369 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
349 // NO_RELOAD otherwise. 370 // NO_RELOAD otherwise.
350 ReloadType pending_reload_; 371 ReloadType pending_reload_;
351 372
352 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); 373 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
353 }; 374 };
354 375
355 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 376 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698