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/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Delegate class of ImageResource that encapsulates the interface and data | 22 // Delegate class of ImageResource that encapsulates the interface and data |
23 // visible to ImageResourceContent. | 23 // visible to ImageResourceContent. |
24 // Do not add new members or new call sites unless really needed. | 24 // Do not add new members or new call sites unless really needed. |
25 // TODO(hiroshige): reduce the members of this class to further decouple | 25 // TODO(hiroshige): reduce the members of this class to further decouple |
26 // ImageResource and ImageResourceContent. | 26 // ImageResource and ImageResourceContent. |
27 class CORE_EXPORT ImageResourceInfo : public GarbageCollectedMixin { | 27 class CORE_EXPORT ImageResourceInfo : public GarbageCollectedMixin { |
28 public: | 28 public: |
29 ~ImageResourceInfo() {} | 29 ~ImageResourceInfo() {} |
30 virtual const KURL& url() const = 0; | 30 virtual const KURL& url() const = 0; |
31 virtual bool isSchedulingReload() const = 0; | |
32 virtual bool hasDevicePixelRatioHeaderValue() const = 0; | 31 virtual bool hasDevicePixelRatioHeaderValue() const = 0; |
33 virtual float devicePixelRatioHeaderValue() const = 0; | 32 virtual float devicePixelRatioHeaderValue() const = 0; |
34 virtual const ResourceResponse& response() const = 0; | 33 virtual const ResourceResponse& response() const = 0; |
35 virtual ResourceStatus getStatus() const = 0; | 34 virtual ResourceStatus getStatus() const = 0; |
36 virtual bool isPlaceholder() const = 0; | 35 virtual bool isPlaceholder() const = 0; |
37 virtual bool isCacheValidator() const = 0; | 36 virtual bool isCacheValidator() const = 0; |
38 virtual bool schedulingReloadOrShouldReloadBrokenPlaceholder() const = 0; | |
39 enum DoesCurrentFrameHaveSingleSecurityOrigin { | 37 enum DoesCurrentFrameHaveSingleSecurityOrigin { |
40 HasMultipleSecurityOrigin, | 38 HasMultipleSecurityOrigin, |
41 HasSingleSecurityOrigin | 39 HasSingleSecurityOrigin |
42 }; | 40 }; |
43 virtual bool isAccessAllowed( | 41 virtual bool isAccessAllowed( |
44 SecurityOrigin*, | 42 SecurityOrigin*, |
45 DoesCurrentFrameHaveSingleSecurityOrigin) const = 0; | 43 DoesCurrentFrameHaveSingleSecurityOrigin) const = 0; |
46 virtual bool hasCacheControlNoStoreHeader() const = 0; | 44 virtual bool hasCacheControlNoStoreHeader() const = 0; |
47 virtual const ResourceError& resourceError() const = 0; | 45 virtual const ResourceError& resourceError() const = 0; |
48 | 46 |
49 // Like Resource::error(), decodeError() makes corresponding ImageResource | 47 // Like Resource::error(), decodeError() makes corresponding ImageResource |
50 // (if any) DecodeError and finishes loading. | 48 // (if any) DecodeError and finishes loading. |
51 virtual void decodeError(bool allDataReceived) = 0; | 49 virtual void decodeError(bool allDataReceived) = 0; |
52 | 50 |
| 51 // Returns true if reloading is started. |
| 52 virtual bool reloadIfLoFiOrPlaceholderIfNeeded( |
| 53 ResourceFetcher* fetcherForReload) = 0; |
| 54 |
53 // TODO(hiroshige): Remove this once MemoryCache becomes further weaker. | 55 // TODO(hiroshige): Remove this once MemoryCache becomes further weaker. |
54 virtual void setDecodedSize(size_t) = 0; | 56 virtual void setDecodedSize(size_t) = 0; |
55 | 57 |
56 // TODO(hiroshige): Remove these. | 58 // TODO(hiroshige): Remove these. |
57 virtual void willAddClientOrObserver() = 0; | 59 virtual void willAddClientOrObserver() = 0; |
58 virtual void didRemoveClientOrObserver() = 0; | 60 virtual void didRemoveClientOrObserver() = 0; |
59 | 61 |
60 // TODO(hiroshige): Remove this. crbug.com/666214 | 62 // TODO(hiroshige): Remove this. crbug.com/666214 |
61 virtual void emulateLoadStartedForInspector( | 63 virtual void emulateLoadStartedForInspector( |
62 ResourceFetcher*, | 64 ResourceFetcher*, |
63 const KURL&, | 65 const KURL&, |
64 const AtomicString& initiatorName) = 0; | 66 const AtomicString& initiatorName) = 0; |
65 | 67 |
| 68 // Only for tests. |
| 69 virtual const ImageResource* resourceForTest() const = 0; |
| 70 |
66 DEFINE_INLINE_VIRTUAL_TRACE() {} | 71 DEFINE_INLINE_VIRTUAL_TRACE() {} |
67 }; | 72 }; |
68 | 73 |
69 } // namespace blink | 74 } // namespace blink |
70 | 75 |
71 #endif | 76 #endif |
OLD | NEW |