1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_
6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_
8 #include "ios/web/public/browser_url_rewriter.h"
16 // A NavigationManager maintains the back-forward list for a WebState and
17 // manages all navigation within that list.
19 // Each NavigationManager belongs to one WebState; each WebState has
20 // exactly one NavigationManager.
21 class NavigationManager
{
23 virtual ~NavigationManager() {}
25 // Gets the BrowserState associated with this NavigationManager. Can never
27 virtual BrowserState
* GetBrowserState() const = 0;
29 // Gets the WebState associated with this NavigationManager.
30 virtual WebState
* GetWebState() const = 0;
32 // Returns the NavigationItem that should be used when displaying info about
33 // the current entry to the user. It ignores certain pending entries, to
34 // prevent spoofing attacks using slow-loading navigations.
35 virtual NavigationItem
* GetVisibleItem() const = 0;
37 // Returns the last committed NavigationItem, which may be null if there
38 // are no committed entries.
39 virtual NavigationItem
* GetLastCommittedItem() const = 0;
41 // Returns the pending entry corresponding to the navigation that is
42 // currently in progress, or null if there is none.
43 virtual NavigationItem
* GetPendingItem() const = 0;
45 // Removes the transient and pending NavigationItems.
46 virtual void DiscardNonCommittedItems() = 0;
48 // Adds |rewriter| to a transient list of URL rewriters. Transient URL
49 // rewriters will be executed before the rewriters already added to the
50 // BrowserURLRewriter singleton, and the list will be cleared after the next
51 // attempted page load. |rewriter| must not be null.
52 virtual void AddTransientURLRewriter(
53 BrowserURLRewriter::URLRewriter rewriter
) = 0;
58 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_