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

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: 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 unified diff | Download patch
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. Passed |navigation| will be help as weak 54 // WKNavigationState::COMMITTED state. Passed |navigation| will be help as weak
52 // reference and will not be retained. No-op if |navigation| is null. 55 // reference and will not be retained. |navigation| can be 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. Passed |navigation| will 65 // affect the result of |lastAddedNavigation| method. Passed |navigation| will
63 // be held as weak reference and will not be retained. No-op if |navigation| is 66 // be held as weak reference and will not be retained. No-op if |navigation| is
64 // null. 67 // null.
65 - (void)setContext:(std::unique_ptr<web::NavigationContextImpl>)context 68 - (void)setContext:(std::unique_ptr<web::NavigationContextImpl>)context
66 forNavigation:(WKNavigation*)navigation; 69 forNavigation:(WKNavigation*)navigation;
67 70
68 // Returns context if one was previously associated with given |navigation|. 71 // Returns context if one was previously associated with given |navigation|.
69 // Returns null if |navigation| is null. 72 // Returns null if |navigation| is null.
70 - (web::NavigationContextImpl*)contextForNavigation:(WKNavigation*)navigation; 73 - (web::NavigationContextImpl*)contextForNavigation:(WKNavigation*)navigation;
71 74
72 // WKNavigation which was added the most recently via |setState:forNavigation:|. 75 // WKNavigation which was added the most recently via |setState:forNavigation:|.
73 // Updating navigation state via |setState:forNavigation:| does not change the 76 // Updating navigation state via |setState:forNavigation:| does not change the
74 // last added navigation. Returns nil if there are no stored navigations. 77 // last added navigation. Returns nil if there are no stored navigations or
78 // last navigation was null.
75 - (WKNavigation*)lastAddedNavigation; 79 - (WKNavigation*)lastAddedNavigation;
76 80
77 // State of WKNavigation which was added the most recently via 81 // State of WKNavigation which was added the most recently via
78 // |setState:forNavigation:|. WKNavigationState::NONE if CRWWKNavigationStates 82 // |setState:forNavigation:|. WKNavigationState::NONE if CRWWKNavigationStates
79 // is empty. 83 // is empty.
80 - (web::WKNavigationState)lastAddedNavigationState; 84 - (web::WKNavigationState)lastAddedNavigationState;
81 85
82 @end 86 @end
83 87
84 #endif // IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ 88 #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') | ios/web/web_state/ui/crw_wk_navigation_states.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698