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

Side by Side Diff: ios/web/web_state/ui/crw_wk_navigation_states.h

Issue 2838593002: Allow storing null navigations in CRWWKNavigationStates. (Closed)
Patch Set: Rebased 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 unified diff | Download patch
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_wk_navigation_states.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ 5 #ifndef IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_
6 #define IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ 6 #define IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #import <Foundation/Foundation.h> 10 #import <Foundation/Foundation.h>
(...skipping 23 matching lines...) Expand all
34 COMMITTED, 34 COMMITTED,
35 // WKNavigation passed to |webView:didFinishNavigation:|. 35 // WKNavigation passed to |webView:didFinishNavigation:|.
36 FINISHED, 36 FINISHED,
37 // WKNavigation passed to |webView:didFailNavigation:withError:|. 37 // WKNavigation passed to |webView:didFailNavigation:withError:|.
38 FAILED, 38 FAILED,
39 }; 39 };
40 40
41 } // namespace web 41 } // namespace web
42 42
43 // Stores states and navigation contexts for WKNavigation objects. 43 // Stores states and navigation contexts for WKNavigation objects.
44 // Allows looking up for last added navigation object. 44 // Allows looking up for last added navigation object. null WKNavigation is a
45 // valid navigation and treated as a unique key. WKWebView passes null
46 // WKNavigation to WKNavigationDelegate callbacks if navigation represents
47 // window opening action.
45 @interface CRWWKNavigationStates : NSObject 48 @interface CRWWKNavigationStates : NSObject
46 49
47 // Adds a new navigation if it was not added yet. If navigation was already 50 // Adds a new navigation if it was not added yet. If navigation was already
48 // added then updates state for existing navigation. Updating state does not 51 // added then updates state for existing navigation. Updating state does not
49 // affect the result of |lastAddedNavigation| method. New added navigations 52 // affect the result of |lastAddedNavigation| method. New added navigations
50 // should have WKNavigationState::REQUESTED, WKNavigationState::STARTED or 53 // should have WKNavigationState::REQUESTED, WKNavigationState::STARTED or
51 // WKNavigationState::COMMITTED state. |navigation| will be held as a weak 54 // WKNavigationState::COMMITTED state. |navigation| will be held as a weak
52 // reference and will not be retained. No-op if |navigation| is null. 55 // reference and will not be retained. No-op if |navigation| is null.
53 - (void)setState:(web::WKNavigationState)state 56 - (void)setState:(web::WKNavigationState)state
54 forNavigation:(WKNavigation*)navigation; 57 forNavigation:(WKNavigation*)navigation;
55 58
56 // Removes given |navigation|. Fails if |navigation| does not exist. No-op if 59 // Removes given |navigation|. Fails if |navigation| does not exist.
57 // |navigation| is null. 60 // |navigation| can be null.
58 - (void)removeNavigation:(WKNavigation*)navigation; 61 - (void)removeNavigation:(WKNavigation*)navigation;
59 62
60 // Adds a new navigation if it was not added yet. If navigation was already 63 // Adds a new navigation if it was not added yet. If navigation was already
61 // added then updates context for existing navigation. Updating context does not 64 // added then updates context for existing navigation. Updating context does not
62 // affect the result of |lastAddedNavigation| method. |navigation| will be held 65 // affect the result of |lastAddedNavigation| method. |navigation| will be held
63 // as a weak reference and will not be retained. No-op if |navigation| is null. 66 // as a weak reference and will not be retained. No-op if |navigation| is null.
64 - (void)setContext:(std::unique_ptr<web::NavigationContextImpl>)context 67 - (void)setContext:(std::unique_ptr<web::NavigationContextImpl>)context
65 forNavigation:(WKNavigation*)navigation; 68 forNavigation:(WKNavigation*)navigation;
66 69
67 // Returns context if one was previously associated with given |navigation|. 70 // Returns context if one was previously associated with given |navigation|.
68 // Returns null if |navigation| is null. 71 // Returns null if |navigation| is null.
69 - (web::NavigationContextImpl*)contextForNavigation:(WKNavigation*)navigation; 72 - (web::NavigationContextImpl*)contextForNavigation:(WKNavigation*)navigation;
70 73
71 // WKNavigation which was added the most recently via |setState:forNavigation:|. 74 // WKNavigation which was added the most recently via |setState:forNavigation:|.
72 // Updating navigation state via |setState:forNavigation:| does not change the 75 // Updating navigation state via |setState:forNavigation:| does not change the
73 // last added navigation. Returns nil if there are no stored navigations. 76 // last added navigation. Returns nil if there are no stored navigations or
77 // last navigation was null.
74 - (WKNavigation*)lastAddedNavigation; 78 - (WKNavigation*)lastAddedNavigation;
75 79
76 // State of WKNavigation which was added the most recently via 80 // State of WKNavigation which was added the most recently via
77 // |setState:forNavigation:|. WKNavigationState::NONE if CRWWKNavigationStates 81 // |setState:forNavigation:|. WKNavigationState::NONE if CRWWKNavigationStates
78 // is empty. 82 // is empty.
79 - (web::WKNavigationState)lastAddedNavigationState; 83 - (web::WKNavigationState)lastAddedNavigationState;
80 84
81 @end 85 @end
82 86
83 #endif // IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ 87 #endif // IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_
OLDNEW
« no previous file with comments | « no previous file | 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