OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 10 #include "webkit/glue/webkit_glue_export.h" |
10 | 11 |
11 class ResourceType { | 12 class ResourceType { |
12 public: | 13 public: |
13 enum Type { | 14 enum Type { |
14 MAIN_FRAME = 0, // top level page | 15 MAIN_FRAME = 0, // top level page |
15 SUB_FRAME, // frame or iframe | 16 SUB_FRAME, // frame or iframe |
16 STYLESHEET, // a CSS stylesheet | 17 STYLESHEET, // a CSS stylesheet |
17 SCRIPT, // an external script | 18 SCRIPT, // an external script |
18 IMAGE, // an image (jpg/gif/png/etc) | 19 IMAGE, // an image (jpg/gif/png/etc) |
19 FONT_RESOURCE, // a font | 20 FONT_RESOURCE, // a font |
(...skipping 12 matching lines...) Expand all Loading... |
32 }; | 33 }; |
33 | 34 |
34 static bool ValidType(int32 type) { | 35 static bool ValidType(int32 type) { |
35 return type >= MAIN_FRAME && type < LAST_TYPE; | 36 return type >= MAIN_FRAME && type < LAST_TYPE; |
36 } | 37 } |
37 | 38 |
38 static Type FromInt(int32 type) { | 39 static Type FromInt(int32 type) { |
39 return static_cast<Type>(type); | 40 return static_cast<Type>(type); |
40 } | 41 } |
41 | 42 |
42 static Type FromTargetType(WebKit::WebURLRequest::TargetType type); | 43 WEBKIT_GLUE_EXPORT static Type FromTargetType( |
| 44 WebKit::WebURLRequest::TargetType type); |
43 | 45 |
44 static bool IsFrame(ResourceType::Type type) { | 46 static bool IsFrame(ResourceType::Type type) { |
45 return type == MAIN_FRAME || type == SUB_FRAME; | 47 return type == MAIN_FRAME || type == SUB_FRAME; |
46 } | 48 } |
47 | 49 |
48 static bool IsSharedWorker(ResourceType::Type type) { | 50 static bool IsSharedWorker(ResourceType::Type type) { |
49 return type == SHARED_WORKER; | 51 return type == SHARED_WORKER; |
50 } | 52 } |
51 | 53 |
52 static bool IsSubresource(ResourceType::Type type) { | 54 static bool IsSubresource(ResourceType::Type type) { |
53 return type == STYLESHEET || | 55 return type == STYLESHEET || |
54 type == SCRIPT || | 56 type == SCRIPT || |
55 type == IMAGE || | 57 type == IMAGE || |
56 type == FONT_RESOURCE || | 58 type == FONT_RESOURCE || |
57 type == SUB_RESOURCE || | 59 type == SUB_RESOURCE || |
58 type == WORKER || | 60 type == WORKER || |
59 type == XHR; | 61 type == XHR; |
60 } | 62 } |
61 | 63 |
62 private: | 64 private: |
63 // Don't instantiate this class. | 65 // Don't instantiate this class. |
64 ResourceType(); | 66 ResourceType(); |
65 ~ResourceType(); | 67 ~ResourceType(); |
66 }; | 68 }; |
67 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ | 69 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ |
OLD | NEW |