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 ImageResourceInfo_h | 5 #ifndef ImageResourceInfo_h |
6 #define ImageResourceInfo_h | 6 #define ImageResourceInfo_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/fetch/ResourceStatus.h" | 9 #include "core/fetch/ResourceStatus.h" |
10 #include "platform/heap/Heap.h" | 10 #include "platform/heap/Heap.h" |
11 #include "platform/weborigin/KURL.h" | 11 #include "platform/weborigin/KURL.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class ResourceError; | 15 class ResourceError; |
16 class ResourceFetcher; | 16 class ResourceFetcher; |
17 class ResourceResponse; | 17 class ResourceResponse; |
18 class SecurityOrigin; | 18 class SecurityOrigin; |
19 | 19 |
20 // Delegate class of ImageResource that encapsulates the interface and data | 20 // Delegate class of ImageResource that encapsulates the interface and data |
21 // visible to ImageResourceContent. | 21 // visible to ImageResourceContent. |
22 // TODO(hiroshige): reduce the members of this class to further decouple | 22 // TODO(hiroshige): reduce the members of this class to further decouple |
23 // ImageResource and ImageResourceContent. | 23 // ImageResource and ImageResourceContent. |
24 class CORE_EXPORT ImageResourceInfo : public GarbageCollectedMixin { | 24 class CORE_EXPORT ImageResourceInfo : public GarbageCollectedMixin { |
25 public: | 25 public: |
26 ~ImageResourceInfo() {} | 26 ~ImageResourceInfo() {} |
27 virtual const KURL& url() const = 0; | 27 virtual const KURL& url() const = 0; |
28 virtual bool isSchedulingReload() const = 0; | |
29 virtual bool hasDevicePixelRatioHeaderValue() const = 0; | 28 virtual bool hasDevicePixelRatioHeaderValue() const = 0; |
30 virtual float devicePixelRatioHeaderValue() const = 0; | 29 virtual float devicePixelRatioHeaderValue() const = 0; |
31 virtual const ResourceResponse& response() const = 0; | 30 virtual const ResourceResponse& response() const = 0; |
32 virtual ResourceStatus getStatus() const = 0; | 31 virtual ResourceStatus getStatus() const = 0; |
33 virtual bool isPlaceholder() const = 0; | 32 virtual bool isPlaceholder() const = 0; |
34 virtual bool isCacheValidator() const = 0; | 33 virtual bool isCacheValidator() const = 0; |
35 virtual bool schedulingReloadOrShouldReloadBrokenPlaceholder() const = 0; | 34 virtual bool shouldReloadBrokenPlaceholder() const = 0; |
36 virtual bool isAccessAllowed( | 35 virtual bool isAccessAllowed( |
37 SecurityOrigin*, | 36 SecurityOrigin*, |
38 bool doesCurrentFrameHasSingleSecurityOrigin) const = 0; | 37 bool doesCurrentFrameHasSingleSecurityOrigin) const = 0; |
39 virtual bool hasCacheControlNoStoreHeader() const = 0; | 38 virtual bool hasCacheControlNoStoreHeader() const = 0; |
40 virtual const ResourceError& resourceError() const = 0; | 39 virtual const ResourceError& resourceError() const = 0; |
41 | 40 |
| 41 // Only for tests. |
| 42 virtual ImageResource* resourceForTest() const = 0; |
| 43 |
42 DEFINE_INLINE_VIRTUAL_TRACE() {} | 44 DEFINE_INLINE_VIRTUAL_TRACE() {} |
43 | 45 |
44 virtual void decodeError(bool allDataReceived) {} | 46 virtual void decodeError(bool allDataReceived) {} |
45 virtual void setDecodedSize(size_t) {} | 47 virtual void setDecodedSize(size_t) {} |
46 virtual void willAddClientOrObserver() {} | 48 virtual void willAddClientOrObserver() {} |
47 virtual void didRemoveClientOrObserver() {} | 49 virtual void didRemoveClientOrObserver() {} |
48 virtual void emulateLoadStartedForInspector( | 50 virtual void emulateLoadStartedForInspector( |
49 ResourceFetcher*, | 51 ResourceFetcher*, |
50 const KURL&, | 52 const KURL&, |
51 const AtomicString& initiatorName) {} | 53 const AtomicString& initiatorName) {} |
| 54 // Returns true if reloading is started. |
| 55 virtual bool reloadIfLoFiOrPlaceholder(ResourceFetcher* fetcherForReload) { |
| 56 return false; |
| 57 } |
52 }; | 58 }; |
53 | 59 |
54 } // namespace blink | 60 } // namespace blink |
55 | 61 |
56 #endif | 62 #endif |
OLD | NEW |