Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.h

Issue 1738133002: Add support for media attribute on link (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nits Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "platform/Timer.h" 42 #include "platform/Timer.h"
43 #include "platform/heap/Handle.h" 43 #include "platform/heap/Handle.h"
44 #include "wtf/OwnPtr.h" 44 #include "wtf/OwnPtr.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class Document; 48 class Document;
49 class LinkRelAttribute; 49 class LinkRelAttribute;
50 class NetworkHintsInterface; 50 class NetworkHintsInterface;
51 class PrerenderHandle; 51 class PrerenderHandle;
52 struct ViewportDescriptionWrapper;
52 53
53 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefe tch and prerender. 54 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefe tch and prerender.
54 class CORE_EXPORT LinkLoader final : public NoBaseWillBeGarbageCollectedFinalize d<LinkLoader>, public ResourceOwner<Resource, ResourceClient>, public PrerenderC lient { 55 class CORE_EXPORT LinkLoader final : public NoBaseWillBeGarbageCollectedFinalize d<LinkLoader>, public ResourceOwner<Resource, ResourceClient>, public PrerenderC lient {
55 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LinkLoader); 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LinkLoader);
56 public: 57 public:
57 static PassOwnPtrWillBeRawPtr<LinkLoader> create(LinkLoaderClient* client) 58 static PassOwnPtrWillBeRawPtr<LinkLoader> create(LinkLoaderClient* client)
58 { 59 {
59 return adoptPtrWillBeNoop(new LinkLoader(client)); 60 return adoptPtrWillBeNoop(new LinkLoader(client));
60 } 61 }
61 ~LinkLoader() override; 62 ~LinkLoader() override;
62 63
63 // from ResourceClient 64 // from ResourceClient
64 void notifyFinished(Resource*) override; 65 void notifyFinished(Resource*) override;
65 String debugName() const override { return "LinkLoader"; } 66 String debugName() const override { return "LinkLoader"; }
66 67
67 // from PrerenderClient 68 // from PrerenderClient
68 void didStartPrerender() override; 69 void didStartPrerender() override;
69 void didStopPrerender() override; 70 void didStopPrerender() override;
70 void didSendLoadForPrerender() override; 71 void didSendLoadForPrerender() override;
71 void didSendDOMContentLoadedForPrerender() override; 72 void didSendDOMContentLoadedForPrerender() override;
72 73
73 void triggerEvents(const Resource*); 74 void triggerEvents(const Resource*);
74 75
75 void released(); 76 void released();
76 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const KURL&, Document&, const NetworkHintsInterface& ); 77 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const String& media, const KURL&, Document&, const N etworkHintsInterface&);
77 enum CanLoadResources { OnlyLoadResources, DoNotLoadResources, LoadResources AndPreconnect }; 78 enum CanLoadResources { OnlyLoadResources, DoNotLoadResources, LoadResources AndPreconnect };
78 static void loadLinksFromHeader(const String& headerValue, const KURL& baseU RL, Document*, const NetworkHintsInterface&, CanLoadResources); 79 static void loadLinksFromHeader(const String& headerValue, const KURL& baseU RL, Document*, const NetworkHintsInterface&, CanLoadResources, ViewportDescripti onWrapper*);
79 static bool getResourceTypeFromAsAttribute(const String& as, Resource::Type& ); 80 static bool getResourceTypeFromAsAttribute(const String& as, Resource::Type& );
80 81
81 DECLARE_TRACE(); 82 DECLARE_TRACE();
82 83
83 private: 84 private:
84 explicit LinkLoader(LinkLoaderClient*); 85 explicit LinkLoader(LinkLoaderClient*);
85 86
86 void linkLoadTimerFired(Timer<LinkLoader>*); 87 void linkLoadTimerFired(Timer<LinkLoader>*);
87 void linkLoadingErrorTimerFired(Timer<LinkLoader>*); 88 void linkLoadingErrorTimerFired(Timer<LinkLoader>*);
88 void createLinkPreloadResourceClient(Resource*); 89 void createLinkPreloadResourceClient(Resource*);
89 90
90 RawPtrWillBeMember<LinkLoaderClient> m_client; 91 RawPtrWillBeMember<LinkLoaderClient> m_client;
91 92
92 Timer<LinkLoader> m_linkLoadTimer; 93 Timer<LinkLoader> m_linkLoadTimer;
93 Timer<LinkLoader> m_linkLoadingErrorTimer; 94 Timer<LinkLoader> m_linkLoadingErrorTimer;
94 95
95 OwnPtrWillBeMember<PrerenderHandle> m_prerender; 96 OwnPtrWillBeMember<PrerenderHandle> m_prerender;
96 OwnPtrWillBeMember<LinkPreloadResourceClient> m_linkPreloadResourceClient; 97 OwnPtrWillBeMember<LinkPreloadResourceClient> m_linkPreloadResourceClient;
97 }; 98 };
98 99
99 } // namespace blink 100 } // namespace blink
100 101
101 #endif 102 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/LinkHeaderTest.cpp ('k') | third_party/WebKit/Source/core/loader/LinkLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698