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 #include "chrome/browser/prerender/prerender_final_status.h" | 5 #include "chrome/browser/prerender/prerender_final_status.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "chrome/browser/prerender/prerender_manager.h" | 8 #include "chrome/browser/prerender/prerender_manager.h" |
9 | 9 |
10 namespace prerender { | 10 namespace prerender { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const char* kFinalStatusNames[] = { | 14 const char* kFinalStatusNames[] = { |
15 "Used", | 15 "Used", |
16 "Timed Out", | 16 "Timed Out", |
17 "Evicted", | 17 "Evicted", |
18 "Manager Shutdown", | 18 "Manager Shutdown", |
19 "Closed", | 19 "Closed", |
20 "Create New Window", | 20 "Create New Window", |
21 "Profile Destroyed", | 21 "Profile Destroyed", |
22 "App Terminating", | 22 "App Terminating", |
23 "Javascript Alert", | 23 "Javascript Alert", |
24 "Auth Needed", | 24 "Auth Needed", |
25 "HTTPS", | 25 "HTTPS", |
26 "Download", | 26 "Download", |
27 "Memory Limit Exceeded", | 27 "Memory Limit Exceeded", |
28 "JS Out Of Memory", | 28 "JS Out Of Memory", |
29 "Renderer Unresponsive", | 29 "Renderer Unresponsive", |
30 "Too many processes", | 30 "Too many processes", |
31 "Rate Limit Exceeded", | 31 "Rate Limit Exceeded", |
32 "Pending Skipped", | 32 "Pending Skipped", |
33 "Control Group", | 33 "Control Group", |
34 "HTML5 Media", | 34 "HTML5 Media", |
35 "Source Render View Closed", | 35 "Source Render View Closed", |
36 "Renderer Crashed", | 36 "Renderer Crashed", |
37 "Unsupported Scheme", | 37 "Unsupported Scheme", |
38 "Invalid HTTP Method", | 38 "Invalid HTTP Method", |
39 "window.print", | 39 "window.print", |
40 "Recently Visited", | 40 "Recently Visited", |
41 "window.opener", | 41 "window.opener", |
42 "Page ID Conflict", | 42 "Page ID Conflict", |
43 "Safe Browsing", | 43 "Safe Browsing", |
44 "Fragment Mismatch", | 44 "Fragment Mismatch", |
45 "SSL Client Certificate Requested", | 45 "SSL Client Certificate Requested", |
46 "Cache or History Cleared", | 46 "Cache or History Cleared", |
47 "Cancelled", | 47 "Cancelled", |
48 "SSL Error", | 48 "SSL Error", |
49 "Cross-Site Navigation Pending", | 49 "Cross-Site Navigation Pending", |
50 "DevTools Attached To The Tab", | 50 "DevTools Attached To The Tab", |
51 "Session Storage Namespace Mismatch", | 51 "Session Storage Namespace Mismatch", |
52 "No Use Group", | 52 "No Use Group", |
53 "Match Complete Dummy", | 53 "Match Complete Dummy", |
54 "Duplicate", | 54 "Duplicate", |
55 "OpenURL", | 55 "OpenURL", |
56 "WouldHaveBeenUsed", | 56 "WouldHaveBeenUsed", |
57 "Register Protocol Handler", | 57 "Register Protocol Handler", |
58 "Creating Audio Stream", | 58 "Creating Audio Stream", |
59 "Page Being Captured", | 59 "Page Being Captured", |
60 "Bad Deferred Redirect", | 60 "Bad Deferred Redirect", |
61 "Navigation Uncommitted", | 61 "Navigation Uncommitted", |
62 "New Navigation Entry", | 62 "New Navigation Entry", |
63 "Cookie Store Not Loaded", | 63 "Cookie Store Not Loaded", |
64 "Cookie Conflict", | 64 "Cookie Conflict", |
65 "Non-Empty Browsing Instance", | 65 "Non-Empty Browsing Instance", |
66 "Navigation Intercepted", | 66 "Navigation Intercepted", |
67 "Prerendering Disabled", | 67 "Prerendering Disabled", |
68 "Cellular Network", | 68 "Cellular Network", |
69 "Block Third Party Cookies", | 69 "Block Third Party Cookies", |
70 "Credential Manager API", | 70 "Credential Manager API", |
71 "Max", | 71 "NoStatePrefetch Finished", |
| 72 "Max", |
72 }; | 73 }; |
73 static_assert(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1, | 74 static_assert(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1, |
74 "status name count mismatch"); | 75 "status name count mismatch"); |
75 | 76 |
76 } // namespace | 77 } // namespace |
77 | 78 |
78 const char* NameFromFinalStatus(FinalStatus final_status) { | 79 const char* NameFromFinalStatus(FinalStatus final_status) { |
79 DCHECK_LT(static_cast<unsigned int>(final_status), | 80 DCHECK_LT(static_cast<unsigned int>(final_status), |
80 arraysize(kFinalStatusNames)); | 81 arraysize(kFinalStatusNames)); |
81 return kFinalStatusNames[final_status]; | 82 return kFinalStatusNames[final_status]; |
82 } | 83 } |
83 | 84 |
84 } // namespace prerender | 85 } // namespace prerender |
OLD | NEW |