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 "extensions/browser/api/web_request/web_request_api_helpers.h" | 5 #include "extensions/browser/api/web_request/web_request_api_helpers.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 "image", | 63 "image", |
64 "font", | 64 "font", |
65 "object", | 65 "object", |
66 "script", | 66 "script", |
67 "script", | 67 "script", |
68 "image", | 68 "image", |
69 "xmlhttprequest", | 69 "xmlhttprequest", |
70 "ping", | 70 "ping", |
71 "script", | 71 "script", |
72 "object", | 72 "object", |
73 "csp_report", | |
74 "other", | 73 "other", |
75 }; | 74 }; |
76 | 75 |
77 const size_t kResourceTypeStringsLength = arraysize(kResourceTypeStrings); | 76 const size_t kResourceTypeStringsLength = arraysize(kResourceTypeStrings); |
78 | 77 |
79 static ResourceType kResourceTypeValues[] = { | 78 static ResourceType kResourceTypeValues[] = { |
80 content::RESOURCE_TYPE_MAIN_FRAME, | 79 content::RESOURCE_TYPE_MAIN_FRAME, |
81 content::RESOURCE_TYPE_SUB_FRAME, | 80 content::RESOURCE_TYPE_SUB_FRAME, |
82 content::RESOURCE_TYPE_STYLESHEET, | 81 content::RESOURCE_TYPE_STYLESHEET, |
83 content::RESOURCE_TYPE_SCRIPT, | 82 content::RESOURCE_TYPE_SCRIPT, |
84 content::RESOURCE_TYPE_IMAGE, | 83 content::RESOURCE_TYPE_IMAGE, |
85 content::RESOURCE_TYPE_FONT_RESOURCE, | 84 content::RESOURCE_TYPE_FONT_RESOURCE, |
86 content::RESOURCE_TYPE_OBJECT, | 85 content::RESOURCE_TYPE_OBJECT, |
87 content::RESOURCE_TYPE_WORKER, | 86 content::RESOURCE_TYPE_WORKER, |
88 content::RESOURCE_TYPE_SHARED_WORKER, | 87 content::RESOURCE_TYPE_SHARED_WORKER, |
89 content::RESOURCE_TYPE_FAVICON, | 88 content::RESOURCE_TYPE_FAVICON, |
90 content::RESOURCE_TYPE_XHR, | 89 content::RESOURCE_TYPE_XHR, |
91 content::RESOURCE_TYPE_PING, | 90 content::RESOURCE_TYPE_PING, |
92 content::RESOURCE_TYPE_SERVICE_WORKER, | 91 content::RESOURCE_TYPE_SERVICE_WORKER, |
93 content::RESOURCE_TYPE_PLUGIN_RESOURCE, | 92 content::RESOURCE_TYPE_PLUGIN_RESOURCE, |
94 content::RESOURCE_TYPE_CSP_REPORT, | |
95 content::RESOURCE_TYPE_LAST_TYPE, // represents "other" | 93 content::RESOURCE_TYPE_LAST_TYPE, // represents "other" |
96 }; | 94 }; |
97 | 95 |
98 const size_t kResourceTypeValuesLength = arraysize(kResourceTypeValues); | 96 const size_t kResourceTypeValuesLength = arraysize(kResourceTypeValues); |
99 | 97 |
100 static_assert(kResourceTypeStringsLength == kResourceTypeValuesLength, | 98 static_assert(kResourceTypeStringsLength == kResourceTypeValuesLength, |
101 "Sizes of string lists and ResourceType lists should be equal"); | 99 "Sizes of string lists and ResourceType lists should be equal"); |
102 | 100 |
103 typedef std::vector<linked_ptr<net::ParsedCookie> > ParsedResponseCookies; | 101 typedef std::vector<linked_ptr<net::ParsedCookie> > ParsedResponseCookies; |
104 | 102 |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { | 1315 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { |
1318 if (type_str == kResourceTypeStrings[i]) { | 1316 if (type_str == kResourceTypeStrings[i]) { |
1319 found = true; | 1317 found = true; |
1320 types->push_back(kResourceTypeValues[i]); | 1318 types->push_back(kResourceTypeValues[i]); |
1321 } | 1319 } |
1322 } | 1320 } |
1323 return found; | 1321 return found; |
1324 } | 1322 } |
1325 | 1323 |
1326 } // namespace extension_web_request_api_helpers | 1324 } // namespace extension_web_request_api_helpers |
OLD | NEW |