| 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_NAVIGATION_TYPE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPE_H_ |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 | 9 |
| 10 // Indicates different types of navigations that can occur that we will handle | 10 // Indicates different types of navigations that can occur that we will handle |
| 11 // separately. | 11 // separately. |
| 12 enum NavigationType { | 12 enum NavigationType { |
| 13 // Unknown type. | 13 // Unknown type. |
| 14 NAVIGATION_TYPE_UNKNOWN, | 14 NAVIGATION_TYPE_UNKNOWN, |
| 15 | 15 |
| 16 // A new page was navigated in the main frame. | 16 // A new page was navigated to in the main frame. This covers all cases where |
| 17 // the main frame navigated and a new navigation entry was created. This means |
| 18 // cases like navigations to a hash on the same page are NEW_PAGE, not |
| 19 // IN_PAGE. (Navigation entries created by subframe navigations are |
| 20 // NEW_SUBFRAME.) |
| 17 NAVIGATION_TYPE_NEW_PAGE, | 21 NAVIGATION_TYPE_NEW_PAGE, |
| 18 | 22 |
| 19 // Renavigating to an existing navigation entry. The entry is guaranteed to | 23 // Renavigating to an existing navigation entry. This is the case for history |
| 20 // exist in the list, or else it would be a new page or IGNORE navigation. | 24 // navigation, reloads, and location.replace(). |
| 21 NAVIGATION_TYPE_EXISTING_PAGE, | 25 NAVIGATION_TYPE_EXISTING_PAGE, |
| 22 | 26 |
| 23 // The same page has been reloaded as a result of the user requesting | 27 // The same page has been reloaded as a result of the user requesting |
| 24 // navigation to that same page (like pressing Enter in the URL bar). This | 28 // navigation to that same page (like pressing Enter in the URL bar). This |
| 25 // is not the same as an in-page navigation because we'll actually have a | 29 // is not the same as an in-page navigation because we'll actually have a |
| 26 // pending entry for the load, which is then meaningless. | 30 // pending entry for the load, which is then meaningless. |
| 27 NAVIGATION_TYPE_SAME_PAGE, | 31 NAVIGATION_TYPE_SAME_PAGE, |
| 28 | 32 |
| 29 // In page navigations are when the reference fragment changes. This will | 33 // The navigation was in the main frame, to a different navigation entry, but |
| 30 // be in the main frame only (we won't even get notified of in-page | 34 // appearing to the user to be a navigation within the same page. This is the |
| 31 // subframe navigations). It may be for any page, not necessarily the last | 35 // case for history.replaceState(), as well as back and forward across |
| 32 // committed one (for example, whey going back to a page with a ref). | 36 // fragment entries and history.pushState() entries. |
| 33 NAVIGATION_TYPE_IN_PAGE, | 37 NAVIGATION_TYPE_IN_PAGE, |
| 34 | 38 |
| 35 // A new subframe was manually navigated by the user. We will create a new | 39 // A new subframe was manually navigated by the user. We will create a new |
| 36 // NavigationEntry so they can go back to the previous subframe content | 40 // NavigationEntry so they can go back to the previous subframe content |
| 37 // using the back button. | 41 // using the back button. |
| 38 NAVIGATION_TYPE_NEW_SUBFRAME, | 42 NAVIGATION_TYPE_NEW_SUBFRAME, |
| 39 | 43 |
| 40 // A subframe in the page was automatically loaded or navigated to such that | 44 // A subframe in the page was automatically loaded or navigated to such that |
| 41 // a new navigation entry should not be created. There are two cases: | 45 // a new navigation entry should not be created. There are two cases: |
| 42 // 1. Stuff like iframes containing ads that the page loads automatically. | 46 // 1. Stuff like iframes containing ads that the page loads automatically. |
| 43 // The user doesn't want to see these, so we just update the existing | 47 // The user doesn't want to see these, so we just update the existing |
| 44 // navigation entry. | 48 // navigation entry. |
| 45 // 2. Going back/forward to previous subframe navigations. We don't create | 49 // 2. Going back/forward to previous subframe navigations. We don't create |
| 46 // a new entry here either, just update the last committed entry. | 50 // a new entry here either, just update the last committed entry. |
| 47 // These two cases are actually pretty different, they just happen to | 51 // These two cases are actually pretty different, they just happen to |
| 48 // require almost the same code to handle. | 52 // require almost the same code to handle. |
| 49 NAVIGATION_TYPE_AUTO_SUBFRAME, | 53 NAVIGATION_TYPE_AUTO_SUBFRAME, |
| 50 | 54 |
| 51 // Nothing happened. This happens when we get information about a page we | 55 // Nothing happened. This happens when we get information about a page we |
| 52 // don't know anything about. It can also happen when an iframe in a popup | 56 // don't know anything about. It can also happen when an iframe in a popup |
| 53 // navigated to about:blank is navigated. Nothing needs to be done. | 57 // navigated to about:blank is navigated. Nothing needs to be done. |
| 54 NAVIGATION_TYPE_NAV_IGNORE, | 58 NAVIGATION_TYPE_NAV_IGNORE, |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 } // namespace content | 61 } // namespace content |
| 58 | 62 |
| 59 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPE_H_ | 63 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPE_H_ |
| OLD | NEW |