OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/common/page_transition_types.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 // static | |
10 PageTransition::Type PageTransition::FromInt(int32 type) { | |
11 if (!ValidType(type)) { | |
12 NOTREACHED() << "Invalid transition type " << type; | |
13 | |
14 // Return a safe default so we don't have corrupt data in release mode. | |
15 return LINK; | |
16 } | |
17 return static_cast<Type>(type); | |
18 } | |
19 | |
20 // static | |
21 const char* PageTransition::CoreTransitionString(Type type) { | |
22 switch (type & PageTransition::CORE_MASK) { | |
23 case 0: return "link"; | |
24 case 1: return "typed"; | |
25 case 2: return "auto_bookmark"; | |
26 case 3: return "auto_subframe"; | |
27 case 4: return "manual_subframe"; | |
28 case 5: return "generated"; | |
29 case 6: return "start_page"; | |
30 case 7: return "form_submit"; | |
31 case 8: return "reload"; | |
32 case 9: return "keyword"; | |
33 case 10: return "keyword_generated"; | |
34 } | |
35 return NULL; | |
36 } | |
OLD | NEW |