Chromium Code Reviews| 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 f18713c62c7064ae5efcca1c53ce971a08285083..84eb44c6b570465e58c62d8ea60842084554ac09 100644 |
| --- a/ios/web/web_state/ui/crw_wk_navigation_states.h |
| +++ b/ios/web/web_state/ui/crw_wk_navigation_states.h |
| @@ -5,11 +5,15 @@ |
| #ifndef IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ |
| #define IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ |
| +#include <memory> |
| + |
| #import <Foundation/Foundation.h> |
| #import <WebKit/WebKit.h> |
| namespace web { |
| +class NavigationContextImpl; |
| + |
| // State of in-flight WKNavigation objects. |
| enum class WKNavigationState : int { |
| // Navigation does not exist. |
| @@ -36,8 +40,8 @@ enum class WKNavigationState : int { |
| } // namespace web |
| -// Stores states for WKNavigation objects. Allows lookign up for last added |
| -// navigation object. |
| +// Stores states and navigation contexts for WKNavigation objects. |
| +// Allows looking up for last added navigation object. |
| @interface CRWWKNavigationStates : NSObject |
| // Adds a new navigation if it was not added yet. If navigation was already |
| @@ -53,6 +57,18 @@ enum class WKNavigationState : int { |
| // |navigation| is null. |
| - (void)removeNavigation:(WKNavigation*)navigation; |
| +// Adds a new navigation if it was not added yet. If navigation was already |
| +// added then updates context for existing navigation. Updating context does not |
| +// affect the result of |lastAddedNavigation| method. Passed |navigation| will |
|
kkhorimoto
2017/04/25 13:29:55
Optional: I don't think "Passed" is really necessa
Eugene But (OOO till 7-30)
2017/04/25 21:02:58
Done.
|
| +// be held as weak reference and will not be retained. No-op if |navigation| is |
| +// null. |
| +- (void)setContext:(std::unique_ptr<web::NavigationContextImpl>)context |
| + forNavigation:(WKNavigation*)navigation; |
| + |
| +// Returns context if one was previously associated with given |navigation|. |
| +// Returns null if |navigation| is null. |
| +- (web::NavigationContextImpl*)contextForNavigation:(WKNavigation*)navigation; |
| + |
| // 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. |