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_COMMON_PAGE_TRANSITION_TYPES_H_ | 5 #ifndef UI_BASE_PAGE_TRANSITION_TYPES_H_ |
6 #define CONTENT_PUBLIC_COMMON_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 "content/common/content_export.h" | 9 #include "ui/base/ui_base_export.h" |
10 | 10 |
11 namespace content { | 11 namespace ui { |
12 | 12 |
13 enum PageTransition { | 13 enum PageTransition { |
14 | 14 |
15 #define PAGE_TRANSITION(label, value) PAGE_TRANSITION_ ## label = value, | 15 #define PAGE_TRANSITION(label, value) PAGE_TRANSITION_ ## label = value, |
16 #include "content/public/common/page_transition_types_list.h" | 16 #include "ui/base/page_transition_types_list.h" |
17 #undef PAGE_TRANSITION | 17 #undef PAGE_TRANSITION |
18 | 18 |
19 }; | 19 }; |
20 | 20 |
21 // Compares two PageTransition types ignoring qualifiers. |rhs| is taken to | 21 // Compares two PageTransition types ignoring qualifiers. |rhs| is taken to |
22 // be a compile time constant, and hence must not contain any qualifiers. | 22 // be a compile time constant, and hence must not contain any qualifiers. |
23 CONTENT_EXPORT bool PageTransitionCoreTypeIs(PageTransition lhs, | 23 UI_BASE_EXPORT bool PageTransitionCoreTypeIs(PageTransition lhs, |
24 PageTransition rhs); | 24 PageTransition rhs); |
25 | 25 |
26 // Simplifies the provided transition by removing any qualifier | 26 // Simplifies the provided transition by removing any qualifier |
27 CONTENT_EXPORT PageTransition PageTransitionStripQualifier( | 27 UI_BASE_EXPORT PageTransition PageTransitionStripQualifier( |
28 PageTransition type); | 28 PageTransition type); |
29 | 29 |
30 bool PageTransitionIsValidType(int32 type); | 30 bool PageTransitionIsValidType(int32 type); |
31 | 31 |
32 CONTENT_EXPORT PageTransition PageTransitionFromInt(int32 type); | 32 UI_BASE_EXPORT PageTransition PageTransitionFromInt(int32 type); |
33 | 33 |
34 // Returns true if the given transition is a top-level frame transition, or | 34 // Returns true if the given transition is a top-level frame transition, or |
35 // false if the transition was for a subframe. | 35 // false if the transition was for a subframe. |
36 CONTENT_EXPORT bool PageTransitionIsMainFrame(PageTransition type); | 36 UI_BASE_EXPORT bool PageTransitionIsMainFrame(PageTransition type); |
37 | 37 |
38 // Returns whether a transition involves a redirection | 38 // Returns whether a transition involves a redirection |
39 CONTENT_EXPORT bool PageTransitionIsRedirect(PageTransition type); | 39 UI_BASE_EXPORT bool PageTransitionIsRedirect(PageTransition type); |
40 | 40 |
41 // Returns whether a transition is a new navigation (rather than a return | 41 // Returns whether a transition is a new navigation (rather than a return |
42 // to a previously committed navigation). | 42 // to a previously committed navigation). |
43 CONTENT_EXPORT bool PageTransitionIsNewNavigation(PageTransition type); | 43 UI_BASE_EXPORT bool PageTransitionIsNewNavigation(PageTransition type); |
44 | 44 |
45 // Return the qualifier | 45 // Return the qualifier |
46 CONTENT_EXPORT int32 PageTransitionGetQualifier(PageTransition type); | 46 UI_BASE_EXPORT int32 PageTransitionGetQualifier(PageTransition type); |
47 | 47 |
48 // Returns true if the transition can be triggered by the web instead of | 48 // Returns true if the transition can be triggered by the web instead of |
49 // through UI or similar. | 49 // through UI or similar. |
50 CONTENT_EXPORT bool PageTransitionIsWebTriggerable(PageTransition type); | 50 UI_BASE_EXPORT bool PageTransitionIsWebTriggerable(PageTransition type); |
51 | 51 |
52 // Return a string version of the core type values. | 52 // Return a string version of the core type values. |
53 CONTENT_EXPORT const char* PageTransitionGetCoreTransitionString( | 53 UI_BASE_EXPORT const char* PageTransitionGetCoreTransitionString( |
54 PageTransition type); | 54 PageTransition type); |
55 | 55 |
56 // TODO(joth): Remove the #if guard here; requires all chrome layer code to | 56 // TODO(joth): Remove the #if guard here; requires all chrome layer code to |
57 // be fixed up not to use operator== | 57 // be fixed up not to use operator== |
58 #if defined(CONTENT_IMPLEMENTATION) | 58 #if defined(CONTENT_IMPLEMENTATION) |
59 // Declare a dummy class that is intentionally never defined. | 59 // Declare a dummy class that is intentionally never defined. |
60 class DontUseOperatorEquals; | 60 class DontUseOperatorEquals; |
61 | 61 |
62 // Ban operator== as it's way too easy to forget to strip the qualifiers. Use | 62 // Ban operator== as it's way too easy to forget to strip the qualifiers. Use |
63 // PageTransitionCoreTypeIs() instead. | 63 // PageTransitionCoreTypeIs() instead. |
64 DontUseOperatorEquals operator==(PageTransition, PageTransition); | 64 DontUseOperatorEquals operator==(PageTransition, PageTransition); |
65 DontUseOperatorEquals operator==(PageTransition, int); | 65 DontUseOperatorEquals operator==(PageTransition, int); |
66 DontUseOperatorEquals operator==(int, PageTransition); | 66 DontUseOperatorEquals operator==(int, PageTransition); |
67 #endif // defined(CONTENT_IMPLEMENTATION) | 67 #endif // defined(CONTENT_IMPLEMENTATION) |
68 | 68 |
69 } // namespace content | 69 } // namespace ui |
70 | 70 |
71 #endif // CONTENT_PUBLIC_COMMON_PAGE_TRANSITION_TYPES_H_ | 71 #endif // UI_BASE_PAGE_TRANSITION_TYPES_H_ |
OLD | NEW |