OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> | 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> |
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 #ifndef RawResource_h | 23 #ifndef RawResource_h |
24 #define RawResource_h | 24 #define RawResource_h |
25 | 25 |
26 #include "core/fetch/ResourceClient.h" | 26 #include "core/fetch/ResourceClient.h" |
27 #include "core/fetch/ResourcePtr.h" | 27 #include "core/fetch/ResourcePtr.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 class RawResourceClient; | 30 class RawResourceClient; |
31 | 31 |
32 class RawResource FINAL : public Resource { | 32 class RawResource final : public Resource { |
33 public: | 33 public: |
34 typedef RawResourceClient ClientType; | 34 typedef RawResourceClient ClientType; |
35 | 35 |
36 RawResource(const ResourceRequest&, Type); | 36 RawResource(const ResourceRequest&, Type); |
37 | 37 |
38 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and th
erefore shouldn't | 38 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and th
erefore shouldn't |
39 // use RawResource. However, it is, and it needs to be able to defer loading
. | 39 // use RawResource. However, it is, and it needs to be able to defer loading
. |
40 // This can be fixed by splitting CORS preflighting out of DocumentThreacabl
eLoader. | 40 // This can be fixed by splitting CORS preflighting out of DocumentThreacabl
eLoader. |
41 void setDefersLoading(bool); | 41 void setDefersLoading(bool); |
42 | 42 |
43 virtual bool canReuse(const ResourceRequest&) const OVERRIDE; | 43 virtual bool canReuse(const ResourceRequest&) const override; |
44 | 44 |
45 private: | 45 private: |
46 virtual void didAddClient(ResourceClient*) OVERRIDE; | 46 virtual void didAddClient(ResourceClient*) override; |
47 virtual void appendData(const char*, unsigned) OVERRIDE; | 47 virtual void appendData(const char*, unsigned) override; |
48 | 48 |
49 virtual bool shouldIgnoreHTTPStatusCodeErrors() const OVERRIDE { return true
; } | 49 virtual bool shouldIgnoreHTTPStatusCodeErrors() const override { return true
; } |
50 | 50 |
51 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) OVER
RIDE; | 51 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) over
ride; |
52 virtual void updateRequest(const ResourceRequest&) OVERRIDE; | 52 virtual void updateRequest(const ResourceRequest&) override; |
53 virtual void responseReceived(const ResourceResponse&) OVERRIDE; | 53 virtual void responseReceived(const ResourceResponse&) override; |
54 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) OVERRIDE; | 54 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; |
55 virtual void didDownloadData(int) OVERRIDE; | 55 virtual void didDownloadData(int) override; |
56 }; | 56 }; |
57 | 57 |
58 #if ENABLE(SECURITY_ASSERT) | 58 #if ENABLE(SECURITY_ASSERT) |
59 inline bool isRawResource(const Resource& resource) | 59 inline bool isRawResource(const Resource& resource) |
60 { | 60 { |
61 Resource::Type type = resource.type(); | 61 Resource::Type type = resource.type(); |
62 return type == Resource::MainResource || type == Resource::Raw || type == Re
source::TextTrack || type == Resource::Media || type == Resource::ImportResource
; | 62 return type == Resource::MainResource || type == Resource::Raw || type == Re
source::TextTrack || type == Resource::Media || type == Resource::ImportResource
; |
63 } | 63 } |
64 #endif | 64 #endif |
65 inline RawResource* toRawResource(const ResourcePtr<Resource>& resource) | 65 inline RawResource* toRawResource(const ResourcePtr<Resource>& resource) |
66 { | 66 { |
67 ASSERT_WITH_SECURITY_IMPLICATION(!resource || isRawResource(*resource.get())
); | 67 ASSERT_WITH_SECURITY_IMPLICATION(!resource || isRawResource(*resource.get())
); |
68 return static_cast<RawResource*>(resource.get()); | 68 return static_cast<RawResource*>(resource.get()); |
69 } | 69 } |
70 | 70 |
71 class RawResourceClient : public ResourceClient { | 71 class RawResourceClient : public ResourceClient { |
72 public: | 72 public: |
73 virtual ~RawResourceClient() { } | 73 virtual ~RawResourceClient() { } |
74 static ResourceClientType expectedType() { return RawResourceType; } | 74 static ResourceClientType expectedType() { return RawResourceType; } |
75 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur
n expectedType(); } | 75 virtual ResourceClientType resourceClientType() const override final { retur
n expectedType(); } |
76 | 76 |
77 virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigne
d long long /* totalBytesToBeSent */) { } | 77 virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigne
d long long /* totalBytesToBeSent */) { } |
78 virtual void responseReceived(Resource*, const ResourceResponse&) { } | 78 virtual void responseReceived(Resource*, const ResourceResponse&) { } |
79 virtual void dataReceived(Resource*, const char* /* data */, unsigned /* len
gth */) { } | 79 virtual void dataReceived(Resource*, const char* /* data */, unsigned /* len
gth */) { } |
80 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceRes
ponse&) { } | 80 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceRes
ponse&) { } |
81 virtual void updateRequest(Resource*, const ResourceRequest&) { } | 81 virtual void updateRequest(Resource*, const ResourceRequest&) { } |
82 virtual void dataDownloaded(Resource*, int) { } | 82 virtual void dataDownloaded(Resource*, int) { } |
83 }; | 83 }; |
84 | 84 |
85 } | 85 } |
86 | 86 |
87 #endif // RawResource_h | 87 #endif // RawResource_h |
OLD | NEW |