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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: Move API change to another patch and address comments Created 3 years, 5 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 7 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 27 matching lines...) Expand all
38 #include "core/html/imports/LinkImport.h" 38 #include "core/html/imports/LinkImport.h"
39 #include "core/inspector/ConsoleMessage.h" 39 #include "core/inspector/ConsoleMessage.h"
40 #include "core/loader/NetworkHintsInterface.h" 40 #include "core/loader/NetworkHintsInterface.h"
41 #include "core/origin_trials/OriginTrials.h" 41 #include "core/origin_trials/OriginTrials.h"
42 #include "platform/weborigin/SecurityPolicy.h" 42 #include "platform/weborigin/SecurityPolicy.h"
43 #include "public/platform/WebIconSizesParser.h" 43 #include "public/platform/WebIconSizesParser.h"
44 #include "public/platform/WebSize.h" 44 #include "public/platform/WebSize.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 namespace {
49 WebServiceWorkerUpdateViaCache ParseUpdateViaCache(const AtomicString& value) {
50 if (value == "imports")
51 return WebServiceWorkerUpdateViaCache::kImports;
52 if (value == "all")
53 return WebServiceWorkerUpdateViaCache::kAll;
54 if (value == "none")
55 return WebServiceWorkerUpdateViaCache::kNone;
56 // Default value
57 return WebServiceWorkerUpdateViaCache::kImports;
58 }
59 } // namespace
60
48 using namespace HTMLNames; 61 using namespace HTMLNames;
49 62
50 inline HTMLLinkElement::HTMLLinkElement(Document& document, 63 inline HTMLLinkElement::HTMLLinkElement(Document& document,
51 bool created_by_parser) 64 bool created_by_parser)
52 : HTMLElement(linkTag, document), 65 : HTMLElement(linkTag, document),
53 link_loader_(LinkLoader::Create(this)), 66 link_loader_(LinkLoader::Create(this)),
54 sizes_(DOMTokenList::Create(*this, HTMLNames::sizesAttr)), 67 sizes_(DOMTokenList::Create(*this, HTMLNames::sizesAttr)),
55 rel_list_(this, RelList::Create(this)), 68 rel_list_(this, RelList::Create(this)),
56 created_by_parser_(created_by_parser) {} 69 created_by_parser_(created_by_parser) {}
57 70
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 icon_sizes_.resize(web_icon_sizes.size()); 108 icon_sizes_.resize(web_icon_sizes.size());
96 for (size_t i = 0; i < web_icon_sizes.size(); ++i) 109 for (size_t i = 0; i < web_icon_sizes.size(); ++i)
97 icon_sizes_[i] = web_icon_sizes[i]; 110 icon_sizes_[i] = web_icon_sizes[i];
98 Process(); 111 Process();
99 } else if (name == mediaAttr) { 112 } else if (name == mediaAttr) {
100 media_ = value.DeprecatedLower(); 113 media_ = value.DeprecatedLower();
101 Process(); 114 Process();
102 } else if (name == scopeAttr) { 115 } else if (name == scopeAttr) {
103 scope_ = value; 116 scope_ = value;
104 Process(); 117 Process();
118 } else if (name == updateviacacheAttr) {
119 update_via_cache_ = ParseUpdateViaCache(value);
120 Process();
105 } else if (name == disabledAttr) { 121 } else if (name == disabledAttr) {
106 UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementDisabled); 122 UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementDisabled);
107 if (LinkStyle* link = GetLinkStyle()) 123 if (LinkStyle* link = GetLinkStyle())
108 link->SetDisabledState(!value.IsNull()); 124 link->SetDisabledState(!value.IsNull());
109 } else { 125 } else {
110 if (name == titleAttr) { 126 if (name == titleAttr) {
111 if (LinkStyle* link = GetLinkStyle()) 127 if (LinkStyle* link = GetLinkStyle())
112 link->SetSheetTitle(value); 128 link->SetSheetTitle(value);
113 } 129 }
114 130
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 HTMLElement::Trace(visitor); 385 HTMLElement::Trace(visitor);
370 LinkLoaderClient::Trace(visitor); 386 LinkLoaderClient::Trace(visitor);
371 } 387 }
372 388
373 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) { 389 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) {
374 visitor->TraceWrappers(rel_list_); 390 visitor->TraceWrappers(rel_list_);
375 HTMLElement::TraceWrappers(visitor); 391 HTMLElement::TraceWrappers(visitor);
376 } 392 }
377 393
378 } // namespace blink 394 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698