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

Unified Diff: ios/web/navigation/navigation_manager_impl.h

Issue 2698773002: [iOS] Refactoring web CRWSessionController user agent code. (Closed)
Patch Set: Fix unit tests and rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/navigation/navigation_item_impl.mm ('k') | ios/web/navigation/navigation_manager_impl.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/navigation_manager_impl.h
diff --git a/ios/web/navigation/navigation_manager_impl.h b/ios/web/navigation/navigation_manager_impl.h
index cf1b29562b7eca3487604784d65e6a613354ca0e..11663bd8a2d402c64e304fc04f87860d430cc48d 100644
--- a/ios/web/navigation/navigation_manager_impl.h
+++ b/ios/web/navigation/navigation_manager_impl.h
@@ -26,6 +26,20 @@ class NavigationManagerDelegate;
class NavigationManagerFacadeDelegate;
class SessionStorageBuilder;
+// Defines the ways how a pending navigation can be initiated.
+enum class NavigationInitiationType {
+ // Navigation was initiated by actual user action.
+ USER_INITIATED = 1,
+
+ // Navigation was initiated by renderer. Examples of renderer-initiated
+ // navigations include:
+ // * <a> link click
+ // * changing window.location.href
+ // * redirect via the <meta http-equiv="refresh"> tag
+ // * using window.history.pushState
+ RENDERER_INITIATED,
+};
+
// Implementation of NavigationManager.
// Generally mirrors upstream's NavigationController.
class NavigationManagerImpl : public NavigationManager {
@@ -82,6 +96,16 @@ class NavigationManagerImpl : public NavigationManager {
const Referrer& referrer,
ui::PageTransition type);
+ // Adds a new item with the given url, referrer, navigation type, and
+ // initiation type, making it the pending item. If pending item is the same as
+ // the current item, this does nothing. |referrer| may be nil if there isn't
+ // one. The item starts out as pending, and will be lost unless
+ // |-commitPendingItem| is called.
+ void AddPendingItem(const GURL& url,
+ const web::Referrer& referrer,
+ ui::PageTransition navigation_type,
+ NavigationInitiationType initiation_type);
+
// Convenience accessors to get the underlying NavigationItems from the
// SessionEntries returned from |session_controller_|'s -lastUserEntry and
// -previousEntry methods.
@@ -119,6 +143,7 @@ class NavigationManagerImpl : public NavigationManager {
void GoForward() override;
void GoToIndex(int index) override;
void Reload(bool check_for_reposts) override;
+ void OverrideDesktopUserAgentForNextPendingItem() override;
// Returns the current list of transient url rewriters, passing ownership to
// the caller.
@@ -150,6 +175,12 @@ class NavigationManagerImpl : public NavigationManager {
// |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK.
bool IsRedirectItemAtIndex(int index) const;
+ // If true, override navigation item's useDesktopUserAgent flag and always
+ // create the pending entry using the desktop user agent.
+ // TODO(crbug.com/692303): Remove this when overriding the user agent doesn't
+ // create a new NavigationItem.
+ bool override_desktop_user_agent_for_next_pending_item_;
+
// The primary delegate for this manager.
NavigationManagerDelegate* delegate_;
« no previous file with comments | « ios/web/navigation/navigation_item_impl.mm ('k') | ios/web/navigation/navigation_manager_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698