| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Used when navigating to a new URL using LoadURL. Extra headers are | 42 // Used when navigating to a new URL using LoadURL. Extra headers are |
| 43 // separated by \n. | 43 // separated by \n. |
| 44 CONTENT_EXPORT static NavigationEntry* CreateNavigationEntry( | 44 CONTENT_EXPORT static NavigationEntry* CreateNavigationEntry( |
| 45 const GURL& url, | 45 const GURL& url, |
| 46 const Referrer& referrer, | 46 const Referrer& referrer, |
| 47 PageTransition transition, | 47 PageTransition transition, |
| 48 bool is_renderer_initiated, | 48 bool is_renderer_initiated, |
| 49 const std::string& extra_headers, | 49 const std::string& extra_headers, |
| 50 BrowserContext* browser_context); | 50 BrowserContext* browser_context); |
| 51 | 51 |
| 52 // Disables checking for a repost and prompting the user. This is used during |
| 53 // testing. |
| 54 static void DisablePromptOnRepost(); |
| 55 |
| 52 virtual ~NavigationController() {} | 56 virtual ~NavigationController() {} |
| 53 | 57 |
| 54 // Returns the web contents associated with this controller. Non-NULL except | 58 // Returns the web contents associated with this controller. Non-NULL except |
| 55 // during set-up of the tab. | 59 // during set-up of the tab. |
| 56 virtual WebContents* GetWebContents() const = 0; | 60 virtual WebContents* GetWebContents() const = 0; |
| 57 | 61 |
| 58 // Returns the browser context for this controller. It can never be NULL. | 62 // Get/set the browser context for this controller. It can never be NULL. |
| 59 virtual BrowserContext* GetBrowserContext() const = 0; | 63 virtual BrowserContext* GetBrowserContext() const = 0; |
| 64 virtual void SetBrowserContext(BrowserContext* browser_context) = 0; |
| 60 | 65 |
| 61 // Initializes this NavigationController with the given saved navigations, | 66 // Initializes this NavigationController with the given saved navigations, |
| 62 // using selected_navigation as the currently loaded entry. Before this call | 67 // using selected_navigation as the currently loaded entry. Before this call |
| 63 // the controller should be unused (there should be no current entry). If | 68 // the controller should be unused (there should be no current entry). If |
| 64 // from_last_session is true, navigations are from the previous session, | 69 // from_last_session is true, navigations are from the previous session, |
| 65 // otherwise they are from the current session (undo tab close). This takes | 70 // otherwise they are from the current session (undo tab close). This takes |
| 66 // ownership of the NavigationEntrys in |entries| and clears it out. | 71 // ownership of the NavigationEntrys in |entries| and clears it out. |
| 67 // This is used for session restore. | 72 // This is used for session restore. |
| 68 virtual void Restore(int selected_navigation, | 73 virtual void Restore(int selected_navigation, |
| 69 bool from_last_session, | 74 bool from_last_session, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 virtual void ContinuePendingReload() = 0; | 230 virtual void ContinuePendingReload() = 0; |
| 226 | 231 |
| 227 // Returns true if we are navigating to the URL the tab is opened with. | 232 // Returns true if we are navigating to the URL the tab is opened with. |
| 228 virtual bool IsInitialNavigation() = 0; | 233 virtual bool IsInitialNavigation() = 0; |
| 229 | 234 |
| 230 // Broadcasts the NOTIFY_NAV_ENTRY_CHANGED notification for the given entry | 235 // Broadcasts the NOTIFY_NAV_ENTRY_CHANGED notification for the given entry |
| 231 // (which must be at the given index). This will keep things in sync like | 236 // (which must be at the given index). This will keep things in sync like |
| 232 // the saved session. | 237 // the saved session. |
| 233 virtual void NotifyEntryChanged(const NavigationEntry* entry, int index) = 0; | 238 virtual void NotifyEntryChanged(const NavigationEntry* entry, int index) = 0; |
| 234 | 239 |
| 240 // Copies the navigation state from the given controller to this one. This |
| 241 // one should be empty (just created). |
| 242 virtual void CopyStateFrom(const NavigationController& source) = 0; |
| 243 |
| 235 // A variant of CopyStateFrom. Removes all entries from this except the last | 244 // A variant of CopyStateFrom. Removes all entries from this except the last |
| 236 // entry, inserts all entries from |source| before and including the active | 245 // entry, inserts all entries from |source| before and including the active |
| 237 // entry. This method is intended for use when the last entry of |this| is the | 246 // entry. This method is intended for use when the last entry of |this| is the |
| 238 // active entry. For example: | 247 // active entry. For example: |
| 239 // source: A B *C* D | 248 // source: A B *C* D |
| 240 // this: E F *G* (last must be active or pending) | 249 // this: E F *G* (last must be active or pending) |
| 241 // result: A B *G* | 250 // result: A B *G* |
| 242 // This ignores the transient index of the source and honors that of 'this'. | 251 // This ignores the transient index of the source and honors that of 'this'. |
| 243 virtual void CopyStateFromAndPrune(NavigationController* source) = 0; | 252 virtual void CopyStateFromAndPrune(NavigationController* source) = 0; |
| 244 | 253 |
| 245 // Removes all the entries except the active entry. If there is a new pending | 254 // Removes all the entries except the active entry. If there is a new pending |
| 246 // navigation it is preserved. | 255 // navigation it is preserved. |
| 247 virtual void PruneAllButActive() = 0; | 256 virtual void PruneAllButActive() = 0; |
| 248 }; | 257 }; |
| 249 | 258 |
| 250 } // namespace content | 259 } // namespace content |
| 251 | 260 |
| 252 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 261 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
| OLD | NEW |