OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
7 | 7 |
8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 // been replaced is in |old_host|, which is nullptr if the old RVH was shut | 115 // been replaced is in |old_host|, which is nullptr if the old RVH was shut |
116 // down. | 116 // down. |
117 virtual void RenderViewHostChanged(RenderViewHost* old_host, | 117 virtual void RenderViewHostChanged(RenderViewHost* old_host, |
118 RenderViewHost* new_host) {} | 118 RenderViewHost* new_host) {} |
119 | 119 |
120 // Navigation related events ------------------------------------------------ | 120 // Navigation related events ------------------------------------------------ |
121 | 121 |
122 // Called when a navigation started in the WebContents. |navigation_handle| | 122 // Called when a navigation started in the WebContents. |navigation_handle| |
123 // is unique to a specific navigation. The same |navigation_handle| will be | 123 // is unique to a specific navigation. The same |navigation_handle| will be |
124 // provided on subsequent calls to | 124 // provided on subsequent calls to |
125 // DidRedirect/Commit/FinishNavigation/ReadyToCommitNavigation related to | 125 // DidRedirect/FinishNavigation/ReadyToCommitNavigation related to this |
126 // this navigation. | 126 // navigation. |
127 // | 127 // |
128 // Note that this is fired by navigations in any frame of the WebContents, | 128 // Note that this is fired by navigations in any frame of the WebContents, |
129 // not just the main frame. | 129 // not just the main frame. |
130 // | 130 // |
131 // Note that more than one navigation can be ongoing in the same frame at the | 131 // Note that more than one navigation can be ongoing in the same frame at the |
132 // same time (including the main frame). Each will get its own | 132 // same time (including the main frame). Each will get its own |
133 // NavigationHandle. | 133 // NavigationHandle. |
134 // | 134 // |
135 // Note that there is no guarantee that DidFinishNavigation will be called | 135 // Note that there is no guarantee that DidFinishNavigation will be called |
136 // for any particular navigation before DidStartNavigation is called on the | 136 // for any particular navigation before DidStartNavigation is called on the |
137 // next. | 137 // next. |
138 virtual void DidStartNavigation(NavigationHandle* navigation_handle) {} | 138 virtual void DidStartNavigation(NavigationHandle* navigation_handle) {} |
139 | 139 |
140 // Called when a navigation encountered a server redirect. | 140 // Called when a navigation encountered a server redirect. |
141 virtual void DidRedirectNavigation(NavigationHandle* navigation_handle) {} | 141 virtual void DidRedirectNavigation(NavigationHandle* navigation_handle) {} |
142 | 142 |
143 // PlzNavigate | 143 // PlzNavigate |
144 // Called when the navigation is ready to be committed in a renderer. This is | 144 // Called when the navigation is ready to be committed in a renderer. This is |
145 // the first point in time where a RenderFrameHost is associated with the | 145 // the first point in time where a RenderFrameHost is associated with the |
146 // navigation. Observers that want to initialize any renderer side | 146 // navigation. Observers that want to initialize any renderer side |
147 // structures/state before the RenderFrame is navigated, should use this | 147 // structures/state before the RenderFrame is navigated, should use this |
Charlie Reis
2015/09/18 17:05:21
nit: Drop comma.
clamy
2015/09/18 20:37:33
Done.
| |
148 // method as opposed to DidCommitNavigation, which is after the fact. | 148 // method as opposed to DidCommitNavigation, which is after the fact. Other |
Charlie Reis
2015/09/18 17:05:21
DidCommitNavigation is gone now.
clamy
2015/09/18 20:37:33
Done.
| |
149 // observers should implement DidFinishNavigation instead. | |
nasko
2015/09/18 16:42:16
Let's use a bit stronger language, something like
Charlie Reis
2015/09/18 17:05:21
I'd reorder the whole thing to emphasize this poin
clamy
2015/09/18 20:37:34
Done.
| |
149 virtual void ReadyToCommitNavigation(NavigationHandle* navigation_handle) {} | 150 virtual void ReadyToCommitNavigation(NavigationHandle* navigation_handle) {} |
150 | 151 |
151 // Called when a navigation was committed. | 152 // Called when a navigation finished in the WebContents. This happens when a |
152 virtual void DidCommitNavigation(NavigationHandle* navigation_handle) {} | 153 // navigation is either committed, aborted or replaced by a new one. Note |
nasko
2015/09/18 16:42:16
nit: drop "either"
clamy
2015/09/18 20:37:33
Done.
| |
153 | 154 // that |navigation_handle| will be destroyed at the end of this call, so do |
154 // Called when a navigation stopped in the WebContents. This happens when a | 155 // not keep a reference to it afterward. |
155 // navigation is either aborted, replaced by a new one, or the document load | 156 // If this called because the navigation committed, then the document load |
Charlie Reis
2015/09/18 17:05:21
nit: this is
clamy
2015/09/18 20:37:34
Done.
| |
156 // finishes. Note that |navigation_handle| will be destroyed at the end of | 157 // will still be ongoing in the RenderFrameHost returned by |
157 // this call, so do not keep a reference to it afterward. | 158 // |navigation_handle|. |
Charlie Reis
2015/09/18 17:05:21
Add something like: "Use DidStopLoading and relate
clamy
2015/09/18 20:37:34
Done.
| |
158 virtual void DidFinishNavigation(NavigationHandle* navigation_handle) {} | 159 virtual void DidFinishNavigation(NavigationHandle* navigation_handle) {} |
159 | 160 |
nasko
2015/09/18 16:48:44
Let's also organize the document loading notificat
clamy
2015/09/18 20:37:34
Done. I did not include the DidNavigateMainFrame a
| |
160 // --------------------------------------------------------------------------- | 161 // --------------------------------------------------------------------------- |
161 | 162 |
162 // This method is invoked after the WebContents decides which RenderFrameHost | 163 // This method is invoked after the WebContents decides which RenderFrameHost |
163 // to use for the next browser-initiated navigation, but before the navigation | 164 // to use for the next browser-initiated navigation, but before the navigation |
164 // starts. It is not called for most renderer-initiated navigations, and it | 165 // starts. It is not called for most renderer-initiated navigations, and it |
165 // does not guarantee that the navigation will commit (e.g., 204s, downloads). | 166 // does not guarantee that the navigation will commit (e.g., 204s, downloads). |
166 // | 167 // |
167 // DEPRECATED. This method is difficult to use correctly and should be | 168 // DEPRECATED. This method is difficult to use correctly and should be |
168 // removed. TODO(creis): Remove in http://crbug.com/424641. | 169 // removed. TODO(creis): Remove in http://crbug.com/424641. |
169 virtual void AboutToNavigateRenderFrame(RenderFrameHost* old_host, | 170 virtual void AboutToNavigateRenderFrame(RenderFrameHost* old_host, |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 void ResetWebContents(); | 454 void ResetWebContents(); |
454 | 455 |
455 WebContentsImpl* web_contents_; | 456 WebContentsImpl* web_contents_; |
456 | 457 |
457 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 458 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
458 }; | 459 }; |
459 | 460 |
460 } // namespace content | 461 } // namespace content |
461 | 462 |
462 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 463 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |