| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e1758c05b6d03e88a4a12d60741e31ad40ddf66f
|
| --- /dev/null
|
| +++ b/ios/web/web_state/ui/crw_wk_navigation_states.h
|
| @@ -0,0 +1,60 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_
|
| +#define IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_
|
| +
|
| +#import <Foundation/Foundation.h>
|
| +#import <WebKit/WebKit.h>
|
| +
|
| +namespace web {
|
| +
|
| +// State of in-flight WKNavigation objects.
|
| +enum WKNavigationState {
|
| + // WKNavigation returned from |loadRequest:|, |goToBackForwardListItem:|,
|
| + // |loadFileURL:allowingReadAccessToURL:|, |loadHTMLString:baseURL:|,
|
| + // |loadData:MIMEType:characterEncodingName:baseURL:|, |goBack|, |goForward|,
|
| + // |reload| or |reloadFromOrigin|.
|
| + WK_NAVIGATION_STATE_REQUESTED = 1,
|
| + // WKNavigation passed to |webView:didStartProvisionalNavigation:|.
|
| + WK_NAVIGATION_STATE_STARTED,
|
| + // WKNavigation passed to
|
| + // |webView:didReceiveServerRedirectForProvisionalNavigation:|.
|
| + WK_NAVIGATION_STATE_REDIRECTED,
|
| + // WKNavigation passed to |webView:didFailProvisionalNavigation:|.
|
| + WK_NAVIGATION_STATE_PROVISIONALY_FAILED,
|
| + // WKNavigation passed to |webView:didCommitNavigation:|.
|
| + WK_NAVIGATION_STATE_COMMITTED,
|
| + // WKNavigation passed to |webView:didFinishNavigation:|.
|
| + WK_NAVIGATION_STATE_FINISHED,
|
| + // WKNavigation passed to |webView:didFailNavigation:withError:|.
|
| + WK_NAVIGATION_STATE_FAILED,
|
| +};
|
| +
|
| +} // namespace web
|
| +
|
| +// Stores states for WKNavigation objects. Allows lookign 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 either WK_NAVIGATION_STATE_REQUESTED or
|
| +// WK_NAVIGATION_STATE_STARTED state. Passed |navigation| will be help as weak
|
| +// reference and will not be retained. No-op if |navigation| is null.
|
| +- (void)addNavigation:(WKNavigation*)navigation
|
| + forState:(web::WKNavigationState)state;
|
| +
|
| +// WKNavigation which was added the most recently via |addNavigation:forState:|.
|
| +// Updating navigation state via |addNavigation:forState:| does not change the
|
| +// last added navigation. Returns nil if there are no stored navigations.
|
| +- (WKNavigation*)lastAddedNavigation;
|
| +
|
| +// Returns state of the given navigation or 0 if navigation does not exist.
|
| +- (web::WKNavigationState)stateForNavigation:(WKNavigation*)navigation;
|
| +
|
| +@end
|
| +
|
| +#endif // IOS_WEB_WEB_STATE_UI_CRW_WK_NAVIGATION_STATES_H_
|
|
|