OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 WEBKIT_GLUE_RESOURCE_TYPE_H__ | 5 #ifndef WEBKIT_GLUE_RESOURCE_TYPE_H__ |
6 #define WEBKIT_GLUE_RESOURCE_TYPE_H__ | 6 #define WEBKIT_GLUE_RESOURCE_TYPE_H__ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 class ResourceType { | 10 class ResourceType { |
11 public: | 11 public: |
12 enum Type { | 12 enum Type { |
13 MAIN_FRAME = 0, // top level page | 13 MAIN_FRAME = 0, // top level page |
14 SUB_FRAME, // frame or iframe | 14 SUB_FRAME, // frame or iframe |
15 STYLESHEET, // a CSS stylesheet | 15 STYLESHEET, // a CSS stylesheet |
16 SCRIPT, // an external script | 16 SCRIPT, // an external script |
17 IMAGE, // an image (jpg/gif/png/etc) | 17 IMAGE, // an image (jpg/gif/png/etc) |
18 FONT_RESOURCE, // a font | 18 FONT_RESOURCE, // a font |
19 SUB_RESOURCE, // an "other" subresource. | 19 SUB_RESOURCE, // an "other" subresource. |
20 OBJECT, // an object (or embed) tag for a plugin, | 20 OBJECT, // an object (or embed) tag for a plugin, |
21 // or a resource that a plugin requested. | 21 // or a resource that a plugin requested. |
22 MEDIA, // a media resource. | 22 MEDIA, // a media resource. |
23 WORKER, // the main resource of a dedicated worker. | 23 WORKER, // the main resource of a dedicated worker. |
24 SHARED_WORKER, // the main resource of a shared worker. | 24 SHARED_WORKER, // the main resource of a shared worker. |
| 25 PREFETCH, // an explicitly requested prefetch |
25 LAST_TYPE // Place holder so we don't need to change ValidType | 26 LAST_TYPE // Place holder so we don't need to change ValidType |
26 // everytime. | 27 // everytime. |
27 }; | 28 }; |
28 | 29 |
29 static bool ValidType(int32 type) { | 30 static bool ValidType(int32 type) { |
30 return type >= MAIN_FRAME && type < LAST_TYPE; | 31 return type >= MAIN_FRAME && type < LAST_TYPE; |
31 } | 32 } |
32 | 33 |
33 static Type FromInt(int32 type) { | 34 static Type FromInt(int32 type) { |
34 return static_cast<Type>(type); | 35 return static_cast<Type>(type); |
(...skipping 15 matching lines...) Expand all Loading... |
50 type == SUB_RESOURCE || | 51 type == SUB_RESOURCE || |
51 type == WORKER; | 52 type == WORKER; |
52 } | 53 } |
53 | 54 |
54 private: | 55 private: |
55 // Don't instantiate this class. | 56 // Don't instantiate this class. |
56 ResourceType(); | 57 ResourceType(); |
57 ~ResourceType(); | 58 ~ResourceType(); |
58 }; | 59 }; |
59 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ | 60 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ |
OLD | NEW |