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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContextFeaturesClientImpl.cpp

Issue 2786673002: Separate ContentSettingsClient out from LocalFrameClient (Closed)
Patch Set: added class-level comment Created 3 years, 8 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/ContextFeaturesClientImpl.h" 31 #include "core/dom/ContextFeaturesClientImpl.h"
32 32
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/frame/ContentSettingsClient.h"
34 #include "platform/weborigin/SecurityOrigin.h" 35 #include "platform/weborigin/SecurityOrigin.h"
35 #include "public/web/WebContentSettingsClient.h"
36 #include "public/web/WebDocument.h"
37 #include "web/WebLocalFrameImpl.h"
38 36
39 namespace blink { 37 namespace blink {
40 38
41 class ContextFeaturesCache final 39 class ContextFeaturesCache final
42 : public GarbageCollectedFinalized<ContextFeaturesCache>, 40 : public GarbageCollectedFinalized<ContextFeaturesCache>,
43 public Supplement<Document> { 41 public Supplement<Document> {
44 USING_GARBAGE_COLLECTED_MIXIN(ContextFeaturesCache); 42 USING_GARBAGE_COLLECTED_MIXIN(ContextFeaturesCache);
45 43
46 public: 44 public:
47 class Entry { 45 class Entry {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 126
129 void ContextFeaturesClientImpl::urlDidChange(Document* document) { 127 void ContextFeaturesClientImpl::urlDidChange(Document* document) {
130 DCHECK(document); 128 DCHECK(document);
131 ContextFeaturesCache::from(*document).validateAgainst(document); 129 ContextFeaturesCache::from(*document).validateAgainst(document);
132 } 130 }
133 131
134 bool ContextFeaturesClientImpl::askIfIsEnabled( 132 bool ContextFeaturesClientImpl::askIfIsEnabled(
135 Document* document, 133 Document* document,
136 ContextFeatures::FeatureType type, 134 ContextFeatures::FeatureType type,
137 bool defaultValue) { 135 bool defaultValue) {
138 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(document->frame()); 136 LocalFrame* frame = document->frame();
139 if (!frame || !frame->contentSettingsClient()) 137 if (!frame || !frame->contentSettingsClient())
140 return defaultValue; 138 return defaultValue;
141 139
142 switch (type) { 140 switch (type) {
143 case ContextFeatures::MutationEvents: 141 case ContextFeatures::MutationEvents:
144 return frame->contentSettingsClient()->allowMutationEvents(defaultValue); 142 return frame->contentSettingsClient()->allowMutationEvents(defaultValue);
145 default: 143 default:
146 return defaultValue; 144 return defaultValue;
147 } 145 }
148 } 146 }
149 147
150 } // namespace blink 148 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContextFeaturesClientImpl.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698