| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | |
| 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> | |
| 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | |
| 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | |
| 6 | |
| 7 This library is free software; you can redistribute it and/or | |
| 8 modify it under the terms of the GNU Library General Public | |
| 9 License as published by the Free Software Foundation; either | |
| 10 version 2 of the License, or (at your option) any later version. | |
| 11 | |
| 12 This library is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 Library General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU Library General Public License | |
| 18 along with this library; see the file COPYING.LIB. If not, write to | |
| 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 20 Boston, MA 02110-1301, USA. | |
| 21 */ | |
| 22 | |
| 23 #ifndef SKY_ENGINE_CORE_FETCH_RAWRESOURCE_H_ | |
| 24 #define SKY_ENGINE_CORE_FETCH_RAWRESOURCE_H_ | |
| 25 | |
| 26 #include "sky/engine/core/fetch/ResourceClient.h" | |
| 27 #include "sky/engine/core/fetch/ResourcePtr.h" | |
| 28 | |
| 29 namespace blink { | |
| 30 class RawResourceCallback; | |
| 31 class RawResourceClient; | |
| 32 | |
| 33 class RawResource final : public Resource { | |
| 34 public: | |
| 35 typedef RawResourceClient ClientType; | |
| 36 | |
| 37 RawResource(const ResourceRequest&, Type); | |
| 38 | |
| 39 virtual bool canReuse(const ResourceRequest&) const override; | |
| 40 | |
| 41 private: | |
| 42 virtual void didAddClient(ResourceClient*) override; | |
| 43 virtual void appendData(const char*, int) override; | |
| 44 | |
| 45 virtual bool shouldIgnoreHTTPStatusCodeErrors() const override { return true
; } | |
| 46 | |
| 47 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) over
ride; | |
| 48 virtual void updateRequest(const ResourceRequest&) override; | |
| 49 virtual void responseReceived(const ResourceResponse&) override; | |
| 50 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; | |
| 51 virtual void didDownloadData(int) override; | |
| 52 }; | |
| 53 | |
| 54 #if ENABLE(SECURITY_ASSERT) | |
| 55 inline bool isRawResource(const Resource& resource) | |
| 56 { | |
| 57 Resource::Type type = resource.type(); | |
| 58 return type == Resource::MainResource || type == Resource::Raw || type == Re
source::Media || type == Resource::ImportResource; | |
| 59 } | |
| 60 #endif | |
| 61 inline RawResource* toRawResource(const ResourcePtr<Resource>& resource) | |
| 62 { | |
| 63 ASSERT_WITH_SECURITY_IMPLICATION(!resource || isRawResource(*resource.get())
); | |
| 64 return static_cast<RawResource*>(resource.get()); | |
| 65 } | |
| 66 | |
| 67 class RawResourceClient : public ResourceClient { | |
| 68 public: | |
| 69 virtual ~RawResourceClient() { } | |
| 70 static ResourceClientType expectedType() { return RawResourceType; } | |
| 71 virtual ResourceClientType resourceClientType() const override final { retur
n expectedType(); } | |
| 72 | |
| 73 virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigne
d long long /* totalBytesToBeSent */) { } | |
| 74 virtual void responseReceived(Resource*, const ResourceResponse&) { } | |
| 75 virtual void dataReceived(Resource*, const char* /* data */, int /* length *
/) { } | |
| 76 virtual void updateRequest(Resource*, const ResourceRequest&) { } | |
| 77 virtual void dataDownloaded(Resource*, int) { } | |
| 78 }; | |
| 79 | |
| 80 } | |
| 81 | |
| 82 #endif // SKY_ENGINE_CORE_FETCH_RAWRESOURCE_H_ | |
| OLD | NEW |