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 SHARED_WORKER, // the main resource of a shared worker. | |
Andrew T Wilson (Slow)
2010/04/25 17:13:15
When workers perform XHR or load scripts like impo
michaeln
2010/04/26 21:51:53
I think right now all resources loaded by workers
| |
24 WORKER, // the main resource of a dedicated worker. | |
23 LAST_TYPE // Place holder so we don't need to change ValidType | 25 LAST_TYPE // Place holder so we don't need to change ValidType |
24 // everytime. | 26 // everytime. |
25 }; | 27 }; |
26 | 28 |
27 static bool ValidType(int32 type) { | 29 static bool ValidType(int32 type) { |
28 return type >= MAIN_FRAME && type < LAST_TYPE; | 30 return type >= MAIN_FRAME && type < LAST_TYPE; |
29 } | 31 } |
30 | 32 |
31 static Type FromInt(int32 type) { | 33 static Type FromInt(int32 type) { |
32 return static_cast<Type>(type); | 34 return static_cast<Type>(type); |
33 } | 35 } |
34 | 36 |
35 static bool IsFrame(ResourceType::Type type) { | 37 static bool IsFrame(ResourceType::Type type) { |
36 return type == MAIN_FRAME || type == SUB_FRAME; | 38 return type == MAIN_FRAME || type == SUB_FRAME; |
37 } | 39 } |
38 | 40 |
41 static bool IsSharedWorker(ResourceType::Type type) { | |
42 return type == SHARED_WORKER; | |
43 } | |
44 | |
39 static bool IsSubresource(ResourceType::Type type) { | 45 static bool IsSubresource(ResourceType::Type type) { |
40 return type == STYLESHEET || | 46 return type == STYLESHEET || |
41 type == SCRIPT || | 47 type == SCRIPT || |
42 type == IMAGE || | 48 type == IMAGE || |
43 type == FONT_RESOURCE || | 49 type == FONT_RESOURCE || |
44 type == SUB_RESOURCE; | 50 type == SUB_RESOURCE || |
51 type == WORKER; | |
45 } | 52 } |
46 | 53 |
47 private: | 54 private: |
48 // Don't instantiate this class. | 55 // Don't instantiate this class. |
49 ResourceType(); | 56 ResourceType(); |
50 ~ResourceType(); | 57 ~ResourceType(); |
51 }; | 58 }; |
52 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ | 59 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ |
OLD | NEW |