Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: webkit/glue/resource_type.h

Issue 7551019: Add support for WebURLRequest::TargetIsXHR (part I) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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 PREFETCH, // an explicitly requested prefetch
26 PRERENDER, // an explicitly requested prerender 26 PRERENDER, // an explicitly requested prerender
27 FAVICON, // a favicon 27 FAVICON, // a favicon
28 XHR, // a XMLHttpRequest
28 LAST_TYPE // Place holder so we don't need to change ValidType 29 LAST_TYPE // Place holder so we don't need to change ValidType
29 // everytime. 30 // everytime.
30 }; 31 };
31 32
32 static bool ValidType(int32 type) { 33 static bool ValidType(int32 type) {
33 return type >= MAIN_FRAME && type < LAST_TYPE; 34 return type >= MAIN_FRAME && type < LAST_TYPE;
34 } 35 }
35 36
36 static Type FromInt(int32 type) { 37 static Type FromInt(int32 type) {
37 return static_cast<Type>(type); 38 return static_cast<Type>(type);
38 } 39 }
39 40
40 static bool IsFrame(ResourceType::Type type) { 41 static bool IsFrame(ResourceType::Type type) {
41 return type == MAIN_FRAME || type == SUB_FRAME; 42 return type == MAIN_FRAME || type == SUB_FRAME;
42 } 43 }
43 44
44 static bool IsSharedWorker(ResourceType::Type type) { 45 static bool IsSharedWorker(ResourceType::Type type) {
45 return type == SHARED_WORKER; 46 return type == SHARED_WORKER;
46 } 47 }
47 48
48 static bool IsSubresource(ResourceType::Type type) { 49 static bool IsSubresource(ResourceType::Type type) {
49 return type == STYLESHEET || 50 return type == STYLESHEET ||
50 type == SCRIPT || 51 type == SCRIPT ||
51 type == IMAGE || 52 type == IMAGE ||
52 type == FONT_RESOURCE || 53 type == FONT_RESOURCE ||
53 type == SUB_RESOURCE || 54 type == SUB_RESOURCE ||
54 type == WORKER; 55 type == WORKER ||
56 type == XHR;
55 } 57 }
56 58
57 private: 59 private:
58 // Don't instantiate this class. 60 // Don't instantiate this class.
59 ResourceType(); 61 ResourceType();
60 ~ResourceType(); 62 ~ResourceType();
61 }; 63 };
62 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__ 64 #endif // WEBKIT_GLUE_RESOURCE_TYPE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698