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

Unified Diff: ios/web/web_state/ui/crw_wk_navigation_states.h

Issue 2838593002: Allow storing null navigations in CRWWKNavigationStates. (Closed)
Patch Set: Created 3 years, 8 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
Index: ios/web/web_state/ui/crw_wk_navigation_states.h
diff --git a/ios/web/web_state/ui/crw_wk_navigation_states.h b/ios/web/web_state/ui/crw_wk_navigation_states.h
index 84eb44c6b570465e58c62d8ea60842084554ac09..0fca4d8f94bad4a3865c297a0ca7d0af01dd1b32 100644
--- a/ios/web/web_state/ui/crw_wk_navigation_states.h
+++ b/ios/web/web_state/ui/crw_wk_navigation_states.h
@@ -41,7 +41,10 @@ enum class WKNavigationState : int {
} // namespace web
// Stores states and navigation contexts for WKNavigation objects.
-// Allows looking up for last added navigation object.
+// Allows looking up for last added navigation object. null WKNavigation is a
+// valid navigation and treated as a unique key. WKWebView passes null
+// WKNavigation to WKNavigationDelegate callbacks if navigation represents
+// window opening action.
@interface CRWWKNavigationStates : NSObject
// Adds a new navigation if it was not added yet. If navigation was already
@@ -49,12 +52,12 @@ enum class WKNavigationState : int {
// affect the result of |lastAddedNavigation| method. New added navigations
// should have WKNavigationState::REQUESTED, WKNavigationState::STARTED or
// WKNavigationState::COMMITTED state. Passed |navigation| will be help as weak
-// reference and will not be retained. No-op if |navigation| is null.
+// reference and will not be retained. |navigation| can be null.
- (void)setState:(web::WKNavigationState)state
forNavigation:(WKNavigation*)navigation;
-// Removes given |navigation|. Fails if |navigation| does not exist. No-op if
-// |navigation| is null.
+// Removes given |navigation|. Fails if |navigation| does not exist.
+// |navigation| can be null.
- (void)removeNavigation:(WKNavigation*)navigation;
// Adds a new navigation if it was not added yet. If navigation was already
@@ -71,7 +74,8 @@ enum class WKNavigationState : int {
// WKNavigation which was added the most recently via |setState:forNavigation:|.
// Updating navigation state via |setState:forNavigation:| does not change the
-// last added navigation. Returns nil if there are no stored navigations.
+// last added navigation. Returns nil if there are no stored navigations or
+// last navigation was null.
- (WKNavigation*)lastAddedNavigation;
// State of WKNavigation which was added the most recently via
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_wk_navigation_states.mm » ('j') | ios/web/web_state/ui/crw_wk_navigation_states.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698