Index: third_party/WebKit/Source/core/css/cssom/CSSResourceValue.h |
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSResourceValue.h b/third_party/WebKit/Source/core/css/cssom/CSSResourceValue.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..50d0993cde3725641692cd5c4d4cc70f1f3b13d7 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/cssom/CSSResourceValue.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2016 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 CSSResourceValue_h |
+#define CSSResourceValue_h |
+ |
+#include "core/css/cssom/CSSStyleValue.h" |
+ |
+#include "core/fetch/Resource.h" |
+ |
+namespace blink { |
+ |
+class CORE_EXPORT CSSResourceValue : public CSSStyleValue { |
+ WTF_MAKE_NONCOPYABLE(CSSResourceValue); |
+ DEFINE_WRAPPERTYPEINFO(); |
+public: |
+ virtual ~CSSResourceValue() { } |
+ |
+ StyleValueType type() const override { return ResourceType; } |
+ |
+ const String state() const |
+ { |
+ switch (status()) { |
+ case Resource::Status::NotStarted: |
+ return "unloaded"; |
+ case Resource::Status::Pending: |
+ return "loading"; |
+ case Resource::Status::Cached: |
+ return "loaded"; |
+ case Resource::Status::LoadError: |
+ case Resource::Status::DecodeError: |
+ return "error"; |
+ default: |
+ NOTREACHED(); |
+ return ""; |
+ } |
+ } |
+ |
+ DEFINE_INLINE_VIRTUAL_TRACE() |
+ { |
+ CSSStyleValue::trace(visitor); |
+ } |
+ |
+protected: |
+ CSSResourceValue() { } |
+ |
+ virtual Resource::Status status() const = 0; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // CSSResourceValue_h |