Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace web { | 17 namespace web { |
| 18 | 18 |
| 19 struct Credential; | 19 struct Credential; |
| 20 struct FaviconURL; | 20 struct FaviconURL; |
| 21 class NavigationContext; | |
| 21 struct LoadCommittedDetails; | 22 struct LoadCommittedDetails; |
| 22 class WebState; | 23 class WebState; |
| 23 class TestWebState; | 24 class TestWebState; |
| 24 class WebStateImpl; | 25 class WebStateImpl; |
| 25 | 26 |
| 26 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; | 27 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; |
| 27 | 28 |
| 28 // An observer API implemented by classes which are interested in various page | 29 // An observer API implemented by classes which are interested in various page |
| 29 // load events from WebState. | 30 // load events from WebState. |
| 30 class WebStateObserver { | 31 class WebStateObserver { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 41 // This method is invoked when a navigation item has changed. | 42 // This method is invoked when a navigation item has changed. |
| 42 virtual void NavigationItemChanged() {} | 43 virtual void NavigationItemChanged() {} |
| 43 | 44 |
| 44 // This method is invoked when a new non-pending navigation item is created. | 45 // This method is invoked when a new non-pending navigation item is created. |
| 45 // This corresponds to one NavigationManager item being created | 46 // This corresponds to one NavigationManager item being created |
| 46 // (in the case of new navigations) or renavigated to (for back/forward | 47 // (in the case of new navigations) or renavigated to (for back/forward |
| 47 // navigations). | 48 // navigations). |
| 48 virtual void NavigationItemCommitted( | 49 virtual void NavigationItemCommitted( |
| 49 const LoadCommittedDetails& load_details) {} | 50 const LoadCommittedDetails& load_details) {} |
| 50 | 51 |
| 52 // Called when a navigation finished in the WebState. This happens when a | |
| 53 // navigation is committed, aborted or replaced by a new one. To know if the | |
| 54 // navigation has resulted in an error page, use | |
| 55 // NavigationHandle::IsErrorPage. | |
|
rohitrao (ping after 24h)
2017/02/24 01:22:48
What is "NavigationHandle"? I don't see any other
Eugene But (OOO till 7-30)
2017/02/24 01:49:41
Good catch. Done.
| |
| 56 // | |
| 57 // If this is called because the navigation committed, then the document load | |
| 58 // will still be ongoing in the WebState returned by |navigation_handle|. | |
|
rohitrao (ping after 24h)
2017/02/24 01:22:48
And here.
Eugene But (OOO till 7-30)
2017/02/24 01:49:41
Done.
| |
| 59 // Use the document loads events such as DidStopLoading | |
| 60 // and related methods to listen for continued events from this | |
| 61 // WebState. | |
| 62 // | |
| 63 // Note that this is fired by same-page navigations, such as fragment | |
| 64 // navigations or pushState/replaceState, which will not result in a document | |
| 65 // change. To filter these out, use NavigationHandle::IsSamePage. | |
|
rohitrao (ping after 24h)
2017/02/24 01:22:48
And here.
Eugene But (OOO till 7-30)
2017/02/24 01:49:41
Done.
| |
| 66 // | |
| 67 // Note that |navigation_handle| will be destroyed at the end of this call, | |
| 68 // so do not keep a reference to it afterward. | |
| 69 virtual void DidFinishNavigation(NavigationContext* navigation_context) {} | |
| 70 | |
| 51 // Called when the current page has started loading. | 71 // Called when the current page has started loading. |
| 52 virtual void DidStartLoading() {} | 72 virtual void DidStartLoading() {} |
| 53 | 73 |
| 54 // Called when the current page has stopped loading. | 74 // Called when the current page has stopped loading. |
| 55 virtual void DidStopLoading() {} | 75 virtual void DidStopLoading() {} |
| 56 | 76 |
| 57 // Called when the current page is loaded. | 77 // Called when the current page is loaded. |
| 58 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {} | 78 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {} |
| 59 | 79 |
| 60 // Called when the interstitial is dismissed by the user. | 80 // Called when the interstitial is dismissed by the user. |
| 61 virtual void InterstitialDismissed() {} | 81 virtual void InterstitialDismissed() {} |
| 62 | 82 |
| 63 // Called on URL hash change events. | 83 // Called on URL hash change events. |
| 84 // TODO(crbug.com/692331): Remove this method and use |DidFinishNavigation|. | |
| 64 virtual void UrlHashChanged() {} | 85 virtual void UrlHashChanged() {} |
| 65 | 86 |
| 66 // Called on history state change events. | 87 // Called on history state change events. |
| 88 // TODO(crbug.com/692331): Remove this method and use |DidFinishNavigation|. | |
| 67 virtual void HistoryStateChanged() {} | 89 virtual void HistoryStateChanged() {} |
| 68 | 90 |
| 69 // Notifies the observer that the page has made some progress loading. | 91 // Notifies the observer that the page has made some progress loading. |
| 70 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully | 92 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully |
| 71 // loaded). | 93 // loaded). |
| 72 virtual void LoadProgressChanged(double progress) {} | 94 virtual void LoadProgressChanged(double progress) {} |
| 73 | 95 |
| 74 // Called on form submission. |user_initiated| is true if the user | 96 // Called on form submission. |user_initiated| is true if the user |
| 75 // interacted with the page. | 97 // interacted with the page. |
| 76 virtual void DocumentSubmitted(const std::string& form_name, | 98 virtual void DocumentSubmitted(const std::string& form_name, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 void ResetWebState(); | 188 void ResetWebState(); |
| 167 | 189 |
| 168 WebState* web_state_; | 190 WebState* web_state_; |
| 169 | 191 |
| 170 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); | 192 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); |
| 171 }; | 193 }; |
| 172 | 194 |
| 173 } // namespace web | 195 } // namespace web |
| 174 | 196 |
| 175 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 197 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
| OLD | NEW |