| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Called when a navigation started in the WebContents. |navigation_handle| | 136 // Called when a navigation started in the WebContents. |navigation_handle| |
| 137 // is unique to a specific navigation. The same |navigation_handle| will be | 137 // is unique to a specific navigation. The same |navigation_handle| will be |
| 138 // provided on subsequent calls to DidRedirectNavigation, DidFinishNavigation, | 138 // provided on subsequent calls to DidRedirectNavigation, DidFinishNavigation, |
| 139 // and ReadyToCommitNavigation when related to this navigation. Observers | 139 // and ReadyToCommitNavigation when related to this navigation. Observers |
| 140 // should clear any references to |navigation_handle| in DidFinishNavigation, | 140 // should clear any references to |navigation_handle| in DidFinishNavigation, |
| 141 // just before it is destroyed. | 141 // just before it is destroyed. |
| 142 // | 142 // |
| 143 // Note that this is fired by navigations in any frame of the WebContents, | 143 // Note that this is fired by navigations in any frame of the WebContents, |
| 144 // not just the main frame. | 144 // not just the main frame. |
| 145 // | 145 // |
| 146 // Note that this is fired by same-page navigations, such as fragment |
| 147 // navigations or pushState/replaceState, which will not result in a document |
| 148 // change. To filter these out, use NavigationHandle::IsSamePage. |
| 149 // |
| 146 // Note that more than one navigation can be ongoing in the same frame at the | 150 // Note that more than one navigation can be ongoing in the same frame at the |
| 147 // same time (including the main frame). Each will get its own | 151 // same time (including the main frame). Each will get its own |
| 148 // NavigationHandle. | 152 // NavigationHandle. |
| 149 // | 153 // |
| 150 // Note that there is no guarantee that DidFinishNavigation will be called | 154 // Note that there is no guarantee that DidFinishNavigation will be called |
| 151 // for any particular navigation before DidStartNavigation is called on the | 155 // for any particular navigation before DidStartNavigation is called on the |
| 152 // next. | 156 // next. |
| 153 virtual void DidStartNavigation(NavigationHandle* navigation_handle) {} | 157 virtual void DidStartNavigation(NavigationHandle* navigation_handle) {} |
| 154 | 158 |
| 155 // Called when a navigation encountered a server redirect. | 159 // Called when a navigation encountered a server redirect. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 171 // navigation has committed, use NavigationHandle::HasCommitted; use | 175 // navigation has committed, use NavigationHandle::HasCommitted; use |
| 172 // NavigationHandle::IsErrorPage to know if the navigation resulted in an | 176 // NavigationHandle::IsErrorPage to know if the navigation resulted in an |
| 173 // error page. | 177 // error page. |
| 174 // | 178 // |
| 175 // If this is called because the navigation committed, then the document load | 179 // If this is called because the navigation committed, then the document load |
| 176 // will still be ongoing in the RenderFrameHost returned by | 180 // will still be ongoing in the RenderFrameHost returned by |
| 177 // |navigation_handle|. Use the document loads events such as DidStopLoading | 181 // |navigation_handle|. Use the document loads events such as DidStopLoading |
| 178 // and related methods to listen for continued events from this | 182 // and related methods to listen for continued events from this |
| 179 // RenderFrameHost. | 183 // RenderFrameHost. |
| 180 // | 184 // |
| 185 // Note that this is fired by same-page navigations, such as fragment |
| 186 // navigations or pushState/replaceState, which will not result in a document |
| 187 // change. To filter these out, use NavigationHandle::IsSamePage. |
| 188 // |
| 181 // Note that |navigation_handle| will be destroyed at the end of this call, | 189 // Note that |navigation_handle| will be destroyed at the end of this call, |
| 182 // so do not keep a reference to it afterward. | 190 // so do not keep a reference to it afterward. |
| 183 virtual void DidFinishNavigation(NavigationHandle* navigation_handle) {} | 191 virtual void DidFinishNavigation(NavigationHandle* navigation_handle) {} |
| 184 | 192 |
| 185 // Navigation (obsolete and deprecated) -------------------------------------- | 193 // Navigation (obsolete and deprecated) -------------------------------------- |
| 186 | 194 |
| 187 // This method is invoked after the browser process starts a navigation to a | 195 // This method is invoked after the browser process starts a navigation to a |
| 188 // pending NavigationEntry. It is not called for renderer-initiated | 196 // pending NavigationEntry. It is not called for renderer-initiated |
| 189 // navigations unless they are sent to the browser process via OpenURL. It may | 197 // navigations unless they are sent to the browser process via OpenURL. It may |
| 190 // be called multiple times for a given navigation, such as a typed URL | 198 // be called multiple times for a given navigation, such as a typed URL |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 void ResetWebContents(); | 521 void ResetWebContents(); |
| 514 | 522 |
| 515 WebContentsImpl* web_contents_; | 523 WebContentsImpl* web_contents_; |
| 516 | 524 |
| 517 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 525 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
| 518 }; | 526 }; |
| 519 | 527 |
| 520 } // namespace content | 528 } // namespace content |
| 521 | 529 |
| 522 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 530 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |