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 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
| 12 #include "base/memory/ref_counted.h" |
11 #include "base/string16.h" | 13 #include "base/string16.h" |
12 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
13 #include "content/public/browser/global_request_id.h" | 15 #include "content/public/browser/global_request_id.h" |
14 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
15 | 17 |
16 class GURL; | 18 class GURL; |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 | 21 |
20 class BrowserContext; | 22 class BrowserContext; |
21 class NavigationEntry; | 23 class NavigationEntry; |
22 class SessionStorageNamespace; | 24 class SessionStorageNamespace; |
23 class WebContents; | 25 class WebContents; |
24 struct Referrer; | 26 struct Referrer; |
25 | 27 |
| 28 // Used to store the mapping of a StoragePartition id to |
| 29 // SessionStorageNamespace. |
| 30 typedef std::map<std::string, scoped_refptr<SessionStorageNamespace> > |
| 31 SessionStorageNamespaceMap; |
| 32 |
26 // A NavigationController maintains the back-forward list for a WebContents and | 33 // A NavigationController maintains the back-forward list for a WebContents and |
27 // manages all navigation within that list. | 34 // manages all navigation within that list. |
28 // | 35 // |
29 // Each NavigationController belongs to one WebContents; each WebContents has | 36 // Each NavigationController belongs to one WebContents; each WebContents has |
30 // exactly one NavigationController. | 37 // exactly one NavigationController. |
31 class NavigationController { | 38 class NavigationController { |
32 public: | 39 public: |
33 enum ReloadType { | 40 enum ReloadType { |
34 NO_RELOAD, // Normal load. | 41 NO_RELOAD, // Normal load. |
35 RELOAD, // Normal (cache-validating) reload. | 42 RELOAD, // Normal (cache-validating) reload. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 228 |
222 // Removing of entries ------------------------------------------------------- | 229 // Removing of entries ------------------------------------------------------- |
223 | 230 |
224 // Removes the entry at the specified |index|. This call dicards any pending | 231 // Removes the entry at the specified |index|. This call dicards any pending |
225 // and transient entries. If the index is the last committed index, this does | 232 // and transient entries. If the index is the last committed index, this does |
226 // nothing and returns false. | 233 // nothing and returns false. |
227 virtual void RemoveEntryAtIndex(int index) = 0; | 234 virtual void RemoveEntryAtIndex(int index) = 0; |
228 | 235 |
229 // Random -------------------------------------------------------------------- | 236 // Random -------------------------------------------------------------------- |
230 | 237 |
231 // The session storage namespace that all child render views should use. | 238 // Returns all the SessionStorageNamespace objects that this |
232 virtual SessionStorageNamespace* GetSessionStorageNamespace() const = 0; | 239 // NavigationController knows about. |
| 240 virtual const SessionStorageNamespaceMap& |
| 241 GetSessionStorageNamespaceMap() const = 0; |
| 242 |
| 243 // TODO(ajwong): Remove this once prerendering, instant, and session restore |
| 244 // are migrated. |
| 245 virtual SessionStorageNamespace* GetDefaultSessionStorageNamespace() = 0; |
233 | 246 |
234 // Sets the max restored page ID this NavigationController has seen, if it | 247 // Sets the max restored page ID this NavigationController has seen, if it |
235 // was restored from a previous session. | 248 // was restored from a previous session. |
236 virtual void SetMaxRestoredPageID(int32 max_id) = 0; | 249 virtual void SetMaxRestoredPageID(int32 max_id) = 0; |
237 | 250 |
238 // Returns the largest restored page ID seen in this navigation controller, | 251 // Returns the largest restored page ID seen in this navigation controller, |
239 // if it was restored from a previous session. (-1 otherwise) | 252 // if it was restored from a previous session. (-1 otherwise) |
240 virtual int32 GetMaxRestoredPageID() const = 0; | 253 virtual int32 GetMaxRestoredPageID() const = 0; |
241 | 254 |
242 // Returns true if a reload happens when activated (SetActive(true) is | 255 // Returns true if a reload happens when activated (SetActive(true) is |
(...skipping 28 matching lines...) Expand all Loading... |
271 virtual void CopyStateFromAndPrune(NavigationController* source) = 0; | 284 virtual void CopyStateFromAndPrune(NavigationController* source) = 0; |
272 | 285 |
273 // Removes all the entries except the active entry. If there is a new pending | 286 // Removes all the entries except the active entry. If there is a new pending |
274 // navigation it is preserved. | 287 // navigation it is preserved. |
275 virtual void PruneAllButActive() = 0; | 288 virtual void PruneAllButActive() = 0; |
276 }; | 289 }; |
277 | 290 |
278 } // namespace content | 291 } // namespace content |
279 | 292 |
280 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 293 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
OLD | NEW |