summaryrefslogtreecommitdiffstats
path: root/webkit/common
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 02:45:43 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 02:45:43 +0000
commitd0fcff7b79fdc1b1931eb0e2e2da20ae8771ad57 (patch)
tree9fae17aca3536ca96737741724b782c189bd4e23 /webkit/common
parent770c714e651efbeef3507a3c177c619867c4f346 (diff)
downloadchromium_src-d0fcff7b79fdc1b1931eb0e2e2da20ae8771ad57.zip
chromium_src-d0fcff7b79fdc1b1931eb0e2e2da20ae8771ad57.tar.gz
chromium_src-d0fcff7b79fdc1b1931eb0e2e2da20ae8771ad57.tar.bz2
reland crrev.com/212927 Move webkitplatformsupport_impl and related from glue to child
Win x64 warning suppression, and allocator dependency on linux for shared_library build compared to previous land. TBR=jam@chromium.org Review URL: https://codereview.chromium.org/20003004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213033 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/common')
-rw-r--r--webkit/common/resource_request_body.h2
-rw-r--r--webkit/common/resource_type.cc47
-rw-r--r--webkit/common/resource_type.h70
-rw-r--r--webkit/common/webkit_common.gyp6
4 files changed, 122 insertions, 3 deletions
diff --git a/webkit/common/resource_request_body.h b/webkit/common/resource_request_body.h
index 5c1edd1..c0bdc08 100644
--- a/webkit/common/resource_request_body.h
+++ b/webkit/common/resource_request_body.h
@@ -62,4 +62,4 @@ class WEBKIT_COMMON_EXPORT ResourceRequestBody
} // namespace webkit_glue
-#endif // WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
+#endif // WEBKIT_COMMON_RESOURCE_REQUEST_BODY_H_
diff --git a/webkit/common/resource_type.cc b/webkit/common/resource_type.cc
new file mode 100644
index 0000000..2c416d3
--- /dev/null
+++ b/webkit/common/resource_type.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/common/resource_type.h"
+
+#include "base/logging.h"
+
+using WebKit::WebURLRequest;
+
+// static
+ResourceType::Type ResourceType::FromTargetType(
+ WebURLRequest::TargetType type) {
+ switch (type) {
+ case WebURLRequest::TargetIsMainFrame:
+ return ResourceType::MAIN_FRAME;
+ case WebURLRequest::TargetIsSubframe:
+ return ResourceType::SUB_FRAME;
+ case WebURLRequest::TargetIsSubresource:
+ return ResourceType::SUB_RESOURCE;
+ case WebURLRequest::TargetIsStyleSheet:
+ return ResourceType::STYLESHEET;
+ case WebURLRequest::TargetIsScript:
+ return ResourceType::SCRIPT;
+ case WebURLRequest::TargetIsFontResource:
+ return ResourceType::FONT_RESOURCE;
+ case WebURLRequest::TargetIsImage:
+ return ResourceType::IMAGE;
+ case WebURLRequest::TargetIsObject:
+ return ResourceType::OBJECT;
+ case WebURLRequest::TargetIsMedia:
+ return ResourceType::MEDIA;
+ case WebURLRequest::TargetIsWorker:
+ return ResourceType::WORKER;
+ case WebURLRequest::TargetIsSharedWorker:
+ return ResourceType::SHARED_WORKER;
+ case WebURLRequest::TargetIsPrefetch:
+ return ResourceType::PREFETCH;
+ case WebURLRequest::TargetIsFavicon:
+ return ResourceType::FAVICON;
+ case WebURLRequest::TargetIsXHR:
+ return ResourceType::XHR;
+ default:
+ NOTREACHED();
+ return ResourceType::SUB_RESOURCE;
+ }
+}
diff --git a/webkit/common/resource_type.h b/webkit/common/resource_type.h
new file mode 100644
index 0000000..9ec7909
--- /dev/null
+++ b/webkit/common/resource_type.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_COMMON_RESOURCE_TYPE_H__
+#define WEBKIT_COMMON_RESOURCE_TYPE_H__
+
+#include "base/basictypes.h"
+#include "third_party/WebKit/public/platform/WebURLRequest.h"
+#include "webkit/common/webkit_common_export.h"
+
+class ResourceType {
+ public:
+ // Used in histograms, so please add new types at the end, and rename unused
+ // entries to RESOURCETYPE_UNUSED_0, etc...
+ enum Type {
+ MAIN_FRAME = 0, // top level page
+ SUB_FRAME, // frame or iframe
+ STYLESHEET, // a CSS stylesheet
+ SCRIPT, // an external script
+ IMAGE, // an image (jpg/gif/png/etc)
+ FONT_RESOURCE, // a font
+ SUB_RESOURCE, // an "other" subresource.
+ OBJECT, // an object (or embed) tag for a plugin,
+ // or a resource that a plugin requested.
+ MEDIA, // a media resource.
+ WORKER, // the main resource of a dedicated worker.
+ SHARED_WORKER, // the main resource of a shared worker.
+ PREFETCH, // an explicitly requested prefetch
+ FAVICON, // a favicon
+ XHR, // a XMLHttpRequest
+ LAST_TYPE // Place holder so we don't need to change ValidType
+ // everytime.
+ };
+
+ static bool ValidType(int32 type) {
+ return type >= MAIN_FRAME && type < LAST_TYPE;
+ }
+
+ static Type FromInt(int32 type) {
+ return static_cast<Type>(type);
+ }
+
+ WEBKIT_COMMON_EXPORT static Type FromTargetType(
+ WebKit::WebURLRequest::TargetType type);
+
+ static bool IsFrame(ResourceType::Type type) {
+ return type == MAIN_FRAME || type == SUB_FRAME;
+ }
+
+ static bool IsSharedWorker(ResourceType::Type type) {
+ return type == SHARED_WORKER;
+ }
+
+ static bool IsSubresource(ResourceType::Type type) {
+ return type == STYLESHEET ||
+ type == SCRIPT ||
+ type == IMAGE ||
+ type == FONT_RESOURCE ||
+ type == SUB_RESOURCE ||
+ type == WORKER ||
+ type == XHR;
+ }
+
+ private:
+ // Don't instantiate this class.
+ ResourceType();
+ ~ResourceType();
+};
+#endif // WEBKIT_COMMON_RESOURCE_TYPE_H__
diff --git a/webkit/common/webkit_common.gyp b/webkit/common/webkit_common.gyp
index e3b6579..af1c688 100644
--- a/webkit/common/webkit_common.gyp
+++ b/webkit/common/webkit_common.gyp
@@ -15,8 +15,8 @@
'WEBKIT_COMMON_IMPLEMENTATION',
],
'dependencies': [
- '<(DEPTH)/base/base.gyp:base_i18n',
'<(DEPTH)/base/base.gyp:base',
+ '<(DEPTH)/base/base.gyp:base_i18n',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/skia/skia.gyp:skia',
@@ -39,10 +39,10 @@
'cursors/webcursor_aura.cc',
'cursors/webcursor_aurawin.cc',
'cursors/webcursor_aurax11.cc',
- 'cursors/webcursor_null.cc',
'cursors/webcursor_gtk.cc',
'cursors/webcursor_gtk_data.h',
'cursors/webcursor_mac.mm',
+ 'cursors/webcursor_null.cc',
'cursors/webcursor_win.cc',
'data_element.cc',
'data_element.h',
@@ -52,6 +52,8 @@
'resource_request_body.h',
'resource_response_info.cc',
'resource_response_info.h',
+ 'resource_type.cc',
+ 'resource_type.h',
],
'conditions': [