OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ | |
6 #define IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ | |
7 | |
8 #import <Foundation/Foundation.h> | |
9 #import <WebKit/WebKit.h> | |
10 | |
11 namespace web { | |
12 | |
13 // State of in-flight WKNavigation objects. | |
14 enum class WKNavigationState : int { | |
15 // WKNavigation returned from |loadRequest:|, |goToBackForwardListItem:|, | |
16 // |loadFileURL:allowingReadAccessToURL:|, |loadHTMLString:baseURL:|, | |
17 // |loadData:MIMEType:characterEncodingName:baseURL:|, |goBack|, |goForward|, | |
18 // |reload| or |reloadFromOrigin|. | |
19 REQUESTED = 1, | |
20 // WKNavigation passed to |webView:didStartProvisionalNavigation:|. | |
21 STARTED, | |
22 // WKNavigation passed to | |
23 // |webView:didReceiveServerRedirectForProvisionalNavigation:|. | |
24 REDIRECTED, | |
25 // WKNavigation passed to |webView:didFailProvisionalNavigation:|. | |
26 PROVISIONALY_FAILED, | |
27 // WKNavigation passed to |webView:didCommitNavigation:|. | |
28 COMMITTED, | |
29 // WKNavigation passed to |webView:didFinishNavigation:|. | |
30 FINISHED, | |
31 // WKNavigation passed to |webView:didFailNavigation:withError:|. | |
32 FAILED, | |
33 }; | |
34 | |
35 } // namespace web | |
36 | |
37 // Stores states for WKNavigation objects. Allows lookign up for last added | |
38 // navigation object. | |
39 @interface CRWWKNavigationStates : NSObject | |
40 | |
41 // Adds a new navigation if it was not added yet. If navigation was already | |
42 // added then updates state for existing navigation. Updating state does not | |
43 // affect the result of |lastAddedNavigation| method. New added navigations | |
44 // should have either WKNavigationState::REQUESTED or WKNavigationState::STARTED | |
kkhorimoto
2017/01/04 00:13:57
Just noticed now, but this should be updated to al
Eugene But (OOO till 7-30)
2017/01/04 00:20:11
Done.
| |
45 // state. Passed |navigation| will be help as weak reference and will not be | |
46 // retained. No-op if |navigation| is null. | |
47 - (void)setState:(web::WKNavigationState)state | |
48 forNavigation:(WKNavigation*)navigation; | |
49 | |
50 // WKNavigation which was added the most recently via |setState:forNavigation:|. | |
51 // Updating navigation state via |setState:forNavigation:| does not change the | |
52 // last added navigation. Returns nil if there are no stored navigations. | |
53 - (WKNavigation*)lastAddedNavigation; | |
54 | |
55 // Returns state of the given navigation or 0 if navigation does not exist. | |
kkhorimoto
2017/01/04 00:13:57
What is returned here using enum classes? Not sur
Eugene But (OOO till 7-30)
2017/01/04 00:20:11
0 of int type. Added |NONE = 0|.
| |
56 - (web::WKNavigationState)stateForNavigation:(WKNavigation*)navigation; | |
57 | |
58 @end | |
59 | |
60 #endif // IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_ | |
OLD | NEW |