| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/public/browser/global_request_id.h" | 19 #include "content/public/browser/global_request_id.h" |
| 19 #include "content/public/browser/session_storage_namespace.h" | 20 #include "content/public/browser/session_storage_namespace.h" |
| 20 #include "content/public/browser/site_instance.h" | 21 #include "content/public/browser/site_instance.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 RESTORE_CURRENT_SESSION, | 104 RESTORE_CURRENT_SESSION, |
| 104 | 105 |
| 105 // Restore from the previous session. | 106 // Restore from the previous session. |
| 106 RESTORE_LAST_SESSION_EXITED_CLEANLY, | 107 RESTORE_LAST_SESSION_EXITED_CLEANLY, |
| 107 RESTORE_LAST_SESSION_CRASHED, | 108 RESTORE_LAST_SESSION_CRASHED, |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 // Creates a navigation entry and translates the virtual url to a real one. | 111 // Creates a navigation entry and translates the virtual url to a real one. |
| 111 // This is a general call; prefer LoadURL[FromRenderer]/TransferURL below. | 112 // This is a general call; prefer LoadURL[FromRenderer]/TransferURL below. |
| 112 // Extra headers are separated by \n. | 113 // Extra headers are separated by \n. |
| 113 CONTENT_EXPORT static scoped_ptr<NavigationEntry> CreateNavigationEntry( | 114 CONTENT_EXPORT static std::unique_ptr<NavigationEntry> CreateNavigationEntry( |
| 114 const GURL& url, | 115 const GURL& url, |
| 115 const Referrer& referrer, | 116 const Referrer& referrer, |
| 116 ui::PageTransition transition, | 117 ui::PageTransition transition, |
| 117 bool is_renderer_initiated, | 118 bool is_renderer_initiated, |
| 118 const std::string& extra_headers, | 119 const std::string& extra_headers, |
| 119 BrowserContext* browser_context); | 120 BrowserContext* browser_context); |
| 120 | 121 |
| 121 // Extra optional parameters for LoadURLWithParams. | 122 // Extra optional parameters for LoadURLWithParams. |
| 122 struct CONTENT_EXPORT LoadURLParams { | 123 struct CONTENT_EXPORT LoadURLParams { |
| 123 // The url to load. This field is required. | 124 // The url to load. This field is required. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // Get/set the browser context for this controller. It can never be nullptr. | 233 // Get/set the browser context for this controller. It can never be nullptr. |
| 233 virtual BrowserContext* GetBrowserContext() const = 0; | 234 virtual BrowserContext* GetBrowserContext() const = 0; |
| 234 virtual void SetBrowserContext(BrowserContext* browser_context) = 0; | 235 virtual void SetBrowserContext(BrowserContext* browser_context) = 0; |
| 235 | 236 |
| 236 // Initializes this NavigationController with the given saved navigations, | 237 // Initializes this NavigationController with the given saved navigations, |
| 237 // using |selected_navigation| as the currently loaded entry. Before this call | 238 // using |selected_navigation| as the currently loaded entry. Before this call |
| 238 // the controller should be unused (there should be no current entry). |type| | 239 // the controller should be unused (there should be no current entry). |type| |
| 239 // indicates where the restor comes from. This takes ownership of the | 240 // indicates where the restor comes from. This takes ownership of the |
| 240 // NavigationEntrys in |entries| and clears it out. This is used for session | 241 // NavigationEntrys in |entries| and clears it out. This is used for session |
| 241 // restore. | 242 // restore. |
| 242 virtual void Restore(int selected_navigation, | 243 virtual void Restore( |
| 243 RestoreType type, | 244 int selected_navigation, |
| 244 std::vector<scoped_ptr<NavigationEntry>>* entries) = 0; | 245 RestoreType type, |
| 246 std::vector<std::unique_ptr<NavigationEntry>>* entries) = 0; |
| 245 | 247 |
| 246 // Entries ------------------------------------------------------------------- | 248 // Entries ------------------------------------------------------------------- |
| 247 | 249 |
| 248 // There are two basic states for entries: pending and committed. When an | 250 // There are two basic states for entries: pending and committed. When an |
| 249 // entry is navigated to, a request is sent to the server. While that request | 251 // entry is navigated to, a request is sent to the server. While that request |
| 250 // has not been responded to, the NavigationEntry is pending. Once data is | 252 // has not been responded to, the NavigationEntry is pending. Once data is |
| 251 // received for that entry, that NavigationEntry is committed. | 253 // received for that entry, that NavigationEntry is committed. |
| 252 | 254 |
| 253 // A transient entry is an entry that, when the user navigates away, is | 255 // A transient entry is an entry that, when the user navigates away, is |
| 254 // removed and discarded rather than being added to the back-forward list. | 256 // removed and discarded rather than being added to the back-forward list. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // by the navigation controller and may be deleted at any time. | 325 // by the navigation controller and may be deleted at any time. |
| 324 virtual NavigationEntry* GetTransientEntry() const = 0; | 326 virtual NavigationEntry* GetTransientEntry() const = 0; |
| 325 | 327 |
| 326 // Adds an entry that is returned by GetActiveEntry(). The entry is | 328 // Adds an entry that is returned by GetActiveEntry(). The entry is |
| 327 // transient: any navigation causes it to be removed and discarded. The | 329 // transient: any navigation causes it to be removed and discarded. The |
| 328 // NavigationController becomes the owner of |entry| and deletes it when | 330 // NavigationController becomes the owner of |entry| and deletes it when |
| 329 // it discards it. This is useful with interstitial pages that need to be | 331 // it discards it. This is useful with interstitial pages that need to be |
| 330 // represented as an entry, but should go away when the user navigates away | 332 // represented as an entry, but should go away when the user navigates away |
| 331 // from them. | 333 // from them. |
| 332 // Note that adding a transient entry does not change the active contents. | 334 // Note that adding a transient entry does not change the active contents. |
| 333 virtual void SetTransientEntry(scoped_ptr<NavigationEntry> entry) = 0; | 335 virtual void SetTransientEntry(std::unique_ptr<NavigationEntry> entry) = 0; |
| 334 | 336 |
| 335 // New navigations ----------------------------------------------------------- | 337 // New navigations ----------------------------------------------------------- |
| 336 | 338 |
| 337 // Loads the specified URL, specifying extra http headers to add to the | 339 // Loads the specified URL, specifying extra http headers to add to the |
| 338 // request. Extra headers are separated by \n. | 340 // request. Extra headers are separated by \n. |
| 339 virtual void LoadURL(const GURL& url, | 341 virtual void LoadURL(const GURL& url, |
| 340 const Referrer& referrer, | 342 const Referrer& referrer, |
| 341 ui::PageTransition type, | 343 ui::PageTransition type, |
| 342 const std::string& extra_headers) = 0; | 344 const std::string& extra_headers) = 0; |
| 343 | 345 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 495 |
| 494 private: | 496 private: |
| 495 // This interface should only be implemented inside content. | 497 // This interface should only be implemented inside content. |
| 496 friend class NavigationControllerImpl; | 498 friend class NavigationControllerImpl; |
| 497 NavigationController() {} | 499 NavigationController() {} |
| 498 }; | 500 }; |
| 499 | 501 |
| 500 } // namespace content | 502 } // namespace content |
| 501 | 503 |
| 502 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 504 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
| OLD | NEW |