| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CSSResourceValue_h | 5 #ifndef CSSResourceValue_h |
| 6 #define CSSResourceValue_h | 6 #define CSSResourceValue_h |
| 7 | 7 |
| 8 #include "core/css/cssom/CSSStyleValue.h" | 8 #include "core/css/cssom/CSSStyleValue.h" |
| 9 | 9 |
| 10 #include "platform/loader/fetch/Resource.h" | 10 #include "platform/loader/fetch/Resource.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class CORE_EXPORT CSSResourceValue : public CSSStyleValue { | 14 class CORE_EXPORT CSSResourceValue : public CSSStyleValue { |
| 15 WTF_MAKE_NONCOPYABLE(CSSResourceValue); | 15 WTF_MAKE_NONCOPYABLE(CSSResourceValue); |
| 16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
| 17 | 17 |
| 18 public: | 18 public: |
| 19 virtual ~CSSResourceValue() {} | 19 virtual ~CSSResourceValue() {} |
| 20 | 20 |
| 21 const String state() const { | 21 const String state() const { |
| 22 switch (status()) { | 22 switch (status()) { |
| 23 case Resource::Status::NotStarted: | 23 case ResourceStatus::NotStarted: |
| 24 return "unloaded"; | 24 return "unloaded"; |
| 25 case Resource::Status::Pending: | 25 case ResourceStatus::Pending: |
| 26 return "loading"; | 26 return "loading"; |
| 27 case Resource::Status::Cached: | 27 case ResourceStatus::Cached: |
| 28 return "loaded"; | 28 return "loaded"; |
| 29 case Resource::Status::LoadError: | 29 case ResourceStatus::LoadError: |
| 30 case Resource::Status::DecodeError: | 30 case ResourceStatus::DecodeError: |
| 31 return "error"; | 31 return "error"; |
| 32 default: | 32 default: |
| 33 NOTREACHED(); | 33 NOTREACHED(); |
| 34 return ""; | 34 return ""; |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 DEFINE_INLINE_VIRTUAL_TRACE() { CSSStyleValue::trace(visitor); } | 38 DEFINE_INLINE_VIRTUAL_TRACE() { CSSStyleValue::trace(visitor); } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 CSSResourceValue() {} | 41 CSSResourceValue() {} |
| 42 | 42 |
| 43 virtual Resource::Status status() const = 0; | 43 virtual ResourceStatus status() const = 0; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace blink | 46 } // namespace blink |
| 47 | 47 |
| 48 #endif // CSSResourceValue_h | 48 #endif // CSSResourceValue_h |
| OLD | NEW |