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

Side by Side Diff: ios/web/public/web_state/web_state_observer.h

Issue 2698413004: Implemented WebStateObserver::DidFinishNavigation(NavigationHandle*). (Closed)
Patch Set: Self review Created 3 years, 10 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 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 NavigationHandle;
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
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.
kkhorimoto 2017/02/22 01:42:38 IsErrorPage()
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 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|.
kkhorimoto 2017/02/22 01:42:38 This comment should be updated if we remove Naviga
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 Acknowledged.
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
kkhorimoto 2017/02/22 01:42:38 NIT: s/Note that this is fired/This is also fired/
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 Done.
64 // navigations or pushState/replaceState, which will not result in a document
65 // change. To filter these out, use NavigationHandle::IsSamePage.
kkhorimoto 2017/02/22 01:42:38 IsSameDocument()
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 Done.
66 //
67 // Note that |navigation_handle| will be destroyed at the end of this call,
kkhorimoto 2017/02/22 01:42:38 Same comment about "Note that"
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 Done.
68 // so do not keep a reference to it afterward.
69 virtual void DidFinishNavigation(NavigationHandle* navigation_handle) {}
kkhorimoto 2017/02/22 01:42:38 Should we use a "const NavigationHandle&" here?
kkhorimoto 2017/02/22 21:55:44 Can you address the comments in this file as well?
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 Pointer is used here, so clients can hold a pointe
Eugene But (OOO till 7-30) 2017/02/22 22:08:32 Sorry, I missed those.
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698