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 UI_BASE_PAGE_TRANSITION_TYPES_H_ | 5 #ifndef UI_BASE_PAGE_TRANSITION_TYPES_H_ |
6 #define UI_BASE_PAGE_TRANSITION_TYPES_H_ | 6 #define UI_BASE_PAGE_TRANSITION_TYPES_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/base/ui_base_export.h" | 9 #include "ui/base/ui_base_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
| 13 // Types of transitions between pages. These are stored in the history |
| 14 // database to separate visits, and are reported by the renderer for page |
| 15 // navigations. |
| 16 // |
| 17 // WARNING: don't change these numbers. They are written directly into the |
| 18 // history database, so future versions will need the same values to match |
| 19 // the enums. |
| 20 // |
| 21 // A type is made of a core value and a set of qualifiers. A type has one |
| 22 // core value and 0 or or more qualifiers. |
| 23 // |
| 24 // A Java counterpart will be generated for this enum. |
| 25 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.base |
13 enum PageTransition { | 26 enum PageTransition { |
| 27 // User got to this page by clicking a link on another page. |
| 28 PAGE_TRANSITION_LINK = 0, |
14 | 29 |
15 #define PAGE_TRANSITION(label, value) PAGE_TRANSITION_ ## label = value, | 30 // User got this page by typing the URL in the URL bar. This should not be |
16 #include "ui/base/page_transition_types_list.h" | 31 // used for cases where the user selected a choice that didn't look at all |
17 #undef PAGE_TRANSITION | 32 // like a URL; see GENERATED below. |
| 33 // |
| 34 // We also use this for other "explicit" navigation actions. |
| 35 PAGE_TRANSITION_TYPED = 1, |
18 | 36 |
| 37 // User got to this page through a suggestion in the UI, for example) |
| 38 // through the destinations page. |
| 39 PAGE_TRANSITION_AUTO_BOOKMARK = 2, |
| 40 |
| 41 // This is a subframe navigation. This is any content that is automatically |
| 42 // loaded in a non-toplevel frame. For example, if a page consists of |
| 43 // several frames containing ads, those ad URLs will have this transition |
| 44 // type. The user may not even realize the content in these pages is a |
| 45 // separate frame, so may not care about the URL (see MANUAL below). |
| 46 PAGE_TRANSITION_AUTO_SUBFRAME = 3, |
| 47 |
| 48 // For subframe navigations that are explicitly requested by the user and |
| 49 // generate new navigation entries in the back/forward list. These are |
| 50 // probably more important than frames that were automatically loaded in |
| 51 // the background because the user probably cares about the fact that this |
| 52 // link was loaded. |
| 53 PAGE_TRANSITION_MANUAL_SUBFRAME = 4, |
| 54 |
| 55 // User got to this page by typing in the URL bar and selecting an entry |
| 56 // that did not look like a URL. For example, a match might have the URL |
| 57 // of a Google search result page, but appear like "Search Google for ...". |
| 58 // These are not quite the same as TYPED navigations because the user |
| 59 // didn't type or see the destination URL. |
| 60 // See also KEYWORD. |
| 61 PAGE_TRANSITION_GENERATED = 5, |
| 62 |
| 63 // This is a toplevel navigation. This is any content that is automatically |
| 64 // loaded in a toplevel frame. For example, opening a tab to show the ASH |
| 65 // screen saver, opening the devtools window, opening the NTP after the safe |
| 66 // browsing warning, opening web-based dialog boxes are examples of |
| 67 // AUTO_TOPLEVEL navigations. |
| 68 PAGE_TRANSITION_AUTO_TOPLEVEL = 6, |
| 69 |
| 70 // The user filled out values in a form and submitted it. NOTE that in |
| 71 // some situations submitting a form does not result in this transition |
| 72 // type. This can happen if the form uses script to submit the contents. |
| 73 PAGE_TRANSITION_FORM_SUBMIT = 7, |
| 74 |
| 75 // The user "reloaded" the page, either by hitting the reload button or by |
| 76 // hitting enter in the address bar. NOTE: This is distinct from the |
| 77 // concept of whether a particular load uses "reload semantics" (i.e. |
| 78 // bypasses cached data). For this reason, lots of code needs to pass |
| 79 // around the concept of whether a load should be treated as a "reload" |
| 80 // separately from their tracking of this transition type, which is mainly |
| 81 // used for proper scoring for consumers who care about how frequently a |
| 82 // user typed/visited a particular URL. |
| 83 // |
| 84 // SessionRestore and undo tab close use this transition type too. |
| 85 PAGE_TRANSITION_RELOAD = 8, |
| 86 |
| 87 // The url was generated from a replaceable keyword other than the default |
| 88 // search provider. If the user types a keyword (which also applies to |
| 89 // tab-to-search) in the omnibox this qualifier is applied to the transition |
| 90 // type of the generated url. TemplateURLModel then may generate an |
| 91 // additional visit with a transition type of KEYWORD_GENERATED against the |
| 92 // url 'http://' + keyword. For example, if you do a tab-to-search against |
| 93 // wikipedia the generated url has a transition qualifer of KEYWORD, and |
| 94 // TemplateURLModel generates a visit for 'wikipedia.org' with a transition |
| 95 // type of KEYWORD_GENERATED. |
| 96 PAGE_TRANSITION_KEYWORD = 9, |
| 97 |
| 98 // Corresponds to a visit generated for a keyword. See description of |
| 99 // KEYWORD for more details. |
| 100 PAGE_TRANSITION_KEYWORD_GENERATED = 10, |
| 101 |
| 102 // ADDING NEW CORE VALUE? Be sure to update the LAST_CORE and CORE_MASK |
| 103 // values below. Also update CoreTransitionString(). |
| 104 PAGE_TRANSITION_LAST_CORE = PAGE_TRANSITION_KEYWORD_GENERATED, |
| 105 PAGE_TRANSITION_CORE_MASK = 0xFF, |
| 106 |
| 107 // Qualifiers |
| 108 // Any of the core values above can be augmented by one or more qualifiers. |
| 109 // These qualifiers further define the transition. |
| 110 |
| 111 // A managed user attempted to visit a URL but was blocked. |
| 112 PAGE_TRANSITION_BLOCKED = 0x00800000, |
| 113 |
| 114 // User used the Forward or Back button to navigate among browsing history. |
| 115 PAGE_TRANSITION_FORWARD_BACK = 0x01000000, |
| 116 |
| 117 // User used the address bar to trigger this navigation. |
| 118 PAGE_TRANSITION_FROM_ADDRESS_BAR = 0x02000000, |
| 119 |
| 120 // User is navigating to the home page. |
| 121 PAGE_TRANSITION_HOME_PAGE = 0x04000000, |
| 122 |
| 123 // The transition originated from an external application; the exact |
| 124 // definition of this is embedder dependent. |
| 125 PAGE_TRANSITION_FROM_API = 0x08000000, |
| 126 |
| 127 // The beginning of a navigation chain. |
| 128 PAGE_TRANSITION_CHAIN_START = 0x10000000, |
| 129 |
| 130 // The last transition in a redirect chain. |
| 131 PAGE_TRANSITION_CHAIN_END = 0x20000000, |
| 132 |
| 133 // Redirects caused by JavaScript or a meta refresh tag on the page. |
| 134 PAGE_TRANSITION_CLIENT_REDIRECT = 0x40000000, |
| 135 |
| 136 // Redirects sent from the server by HTTP headers. It might be nice to |
| 137 // break this out into 2 types in the future, permanent or temporary, if we |
| 138 // can get that information from WebKit. |
| 139 PAGE_TRANSITION_SERVER_REDIRECT = 0x80000000, |
| 140 |
| 141 // Used to test whether a transition involves a redirect. |
| 142 PAGE_TRANSITION_IS_REDIRECT_MASK = 0xC0000000, |
| 143 |
| 144 // General mask defining the bits used for the qualifiers. |
| 145 PAGE_TRANSITION_QUALIFIER_MASK = 0xFFFFFF00, |
19 }; | 146 }; |
20 | 147 |
21 // Compares two PageTransition types ignoring qualifiers. |rhs| is taken to | 148 // Compares two PageTransition types ignoring qualifiers. |rhs| is taken to |
22 // be a compile time constant, and hence must not contain any qualifiers. | 149 // be a compile time constant, and hence must not contain any qualifiers. |
23 UI_BASE_EXPORT bool PageTransitionCoreTypeIs(PageTransition lhs, | 150 UI_BASE_EXPORT bool PageTransitionCoreTypeIs(PageTransition lhs, |
24 PageTransition rhs); | 151 PageTransition rhs); |
25 | 152 |
26 // Simplifies the provided transition by removing any qualifier | 153 // Simplifies the provided transition by removing any qualifier |
27 UI_BASE_EXPORT PageTransition PageTransitionStripQualifier( | 154 UI_BASE_EXPORT PageTransition PageTransitionStripQualifier( |
28 PageTransition type); | 155 PageTransition type); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Ban operator== as it's way too easy to forget to strip the qualifiers. Use | 189 // Ban operator== as it's way too easy to forget to strip the qualifiers. Use |
63 // PageTransitionCoreTypeIs() instead. | 190 // PageTransitionCoreTypeIs() instead. |
64 DontUseOperatorEquals operator==(PageTransition, PageTransition); | 191 DontUseOperatorEquals operator==(PageTransition, PageTransition); |
65 DontUseOperatorEquals operator==(PageTransition, int); | 192 DontUseOperatorEquals operator==(PageTransition, int); |
66 DontUseOperatorEquals operator==(int, PageTransition); | 193 DontUseOperatorEquals operator==(int, PageTransition); |
67 #endif // defined(CONTENT_IMPLEMENTATION) | 194 #endif // defined(CONTENT_IMPLEMENTATION) |
68 | 195 |
69 } // namespace ui | 196 } // namespace ui |
70 | 197 |
71 #endif // UI_BASE_PAGE_TRANSITION_TYPES_H_ | 198 #endif // UI_BASE_PAGE_TRANSITION_TYPES_H_ |
OLD | NEW |