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

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

Issue 2835463002: Store NavigationIntext in CRWWKNavigationStates. (Closed)
Patch Set: Fixed compilation. Created 3 years, 7 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/web_state/navigation_context_impl.mm ('k') | ios/web/web_state/ui/crw_wk_navigation_states.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..adbffccc9769a2ab681755468dfd20b0b8b354c3 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,15 +40,15 @@ 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
// added then updates state for existing navigation. Updating state does not
// 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
+// WKNavigationState::COMMITTED state. |navigation| will be held as a weak
// reference and will not be retained. No-op if |navigation| is null.
- (void)setState:(web::WKNavigationState)state
forNavigation:(WKNavigation*)navigation;
@@ -53,6 +57,17 @@ 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. |navigation| will be held
+// as a 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.
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | ios/web/web_state/ui/crw_wk_navigation_states.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698