2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef InternalSettings_h
28 #define InternalSettings_h
30 #include "core/InternalSettingsGenerated.h"
31 #include "core/editing/EditingBehaviorTypes.h"
32 #include "platform/geometry/IntSize.h"
33 #include "platform/heap/Handle.h"
34 #include "wtf/PassRefPtr.h"
35 #include "wtf/RefCounted.h"
36 #include "wtf/text/WTFString.h"
47 class InternalSettings FINAL : public InternalSettingsGenerated, public HeapSupplement<Page> {
48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(InternalSettings);
50 class InternalSettings FINAL : public InternalSettingsGenerated {
55 explicit Backup(Settings*);
56 void restoreTo(Settings*);
58 bool m_originalAuthorShadowDOMForAnyElementEnabled;
60 bool m_originalLaxMixedContentCheckingEnabled;
61 bool m_originalOverlayScrollbarsEnabled;
62 EditingBehaviorType m_originalEditingBehavior;
63 bool m_originalTextAutosizingEnabled;
64 IntSize m_originalTextAutosizingWindowSizeOverride;
65 float m_originalAccessibilityFontScaleFactor;
66 String m_originalMediaTypeOverride;
67 bool m_originalMockScrollbarsEnabled;
68 bool m_originalMockGestureTapHighlightsEnabled;
69 bool m_langAttributeAwareFormControlUIEnabled;
71 String m_defaultVideoPosterURL;
72 bool m_originalLayerSquashingEnabled;
73 bool m_originalPseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled;
76 static PassRefPtrWillBeRawPtr<InternalSettings> create(Page& page)
78 return adoptRefWillBeNoop(new InternalSettings(page));
80 static InternalSettings* from(Page&);
83 void hostDestroyed() { m_page = nullptr; }
86 virtual ~InternalSettings();
87 void resetToConsistentState();
89 void setStandardFontFamily(const AtomicString& family, const String& script, ExceptionState&);
90 void setSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&);
91 void setSansSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&);
92 void setFixedFontFamily(const AtomicString& family, const String& script, ExceptionState&);
93 void setCursiveFontFamily(const AtomicString& family, const String& script, ExceptionState&);
94 void setFantasyFontFamily(const AtomicString& family, const String& script, ExceptionState&);
95 void setPictographFontFamily(const AtomicString& family, const String& script, ExceptionState&);
97 void setDefaultVideoPosterURL(const String& url, ExceptionState&);
98 void setEditingBehavior(const String&, ExceptionState&);
99 void setImagesEnabled(bool, ExceptionState&);
100 void setMediaTypeOverride(const String& mediaType, ExceptionState&);
101 void setMockScrollbarsEnabled(bool, ExceptionState&);
102 void setMockGestureTapHighlightsEnabled(bool, ExceptionState&);
103 void setTextAutosizingEnabled(bool, ExceptionState&);
104 void setAccessibilityFontScaleFactor(float fontScaleFactor, ExceptionState&);
105 void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionState&);
106 void setViewportEnabled(bool, ExceptionState&);
108 // FIXME: This is a temporary flag and should be removed once squashing is
109 // ready (crbug.com/261605).
110 void setLayerSquashingEnabled(bool, ExceptionState&);
112 // FIXME: The following are RuntimeEnabledFeatures and likely
113 // cannot be changed after process start. These setters should
114 // be removed or moved onto internals.runtimeFlags:
115 void setAuthorShadowDOMForAnyElementEnabled(bool);
116 void setLangAttributeAwareFormControlUIEnabled(bool);
117 void setOverlayScrollbarsEnabled(bool);
118 void setExperimentalContentSecurityPolicyFeaturesEnabled(bool);
119 void setPseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled(bool);
120 void setLaxMixedContentCheckingEnabled(bool);
122 virtual void trace(Visitor*) OVERRIDE;
125 explicit InternalSettings(Page&);
127 Settings* settings() const;
128 Page* page() const { return m_page; }
129 static const char* supplementName();
131 RawPtrWillBeWeakMember<Page> m_page;