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 {
52 DEFINE_WRAPPERTYPEINFO();
56 explicit Backup(Settings*);
57 void restoreTo(Settings*);
59 bool m_originalAuthorShadowDOMForAnyElementEnabled;
61 bool m_originalLaxMixedContentCheckingEnabled;
62 bool m_originalOverlayScrollbarsEnabled;
63 EditingBehaviorType m_originalEditingBehavior;
64 bool m_originalTextAutosizingEnabled;
65 IntSize m_originalTextAutosizingWindowSizeOverride;
66 float m_originalAccessibilityFontScaleFactor;
67 String m_originalMediaTypeOverride;
68 bool m_originalMockScrollbarsEnabled;
69 bool m_originalMockGestureTapHighlightsEnabled;
70 bool m_langAttributeAwareFormControlUIEnabled;
72 String m_defaultVideoPosterURL;
73 bool m_originalLayerSquashingEnabled;
74 bool m_originalPseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled;
77 static PassRefPtrWillBeRawPtr<InternalSettings> create(Page& page)
79 return adoptRefWillBeNoop(new InternalSettings(page));
81 static InternalSettings* from(Page&);
84 void hostDestroyed() { m_page = nullptr; }
87 virtual ~InternalSettings();
88 void resetToConsistentState();
90 void setStandardFontFamily(const AtomicString& family, const String& script, ExceptionState&);
91 void setSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&);
92 void setSansSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&);
93 void setFixedFontFamily(const AtomicString& family, const String& script, ExceptionState&);
94 void setCursiveFontFamily(const AtomicString& family, const String& script, ExceptionState&);
95 void setFantasyFontFamily(const AtomicString& family, const String& script, ExceptionState&);
96 void setPictographFontFamily(const AtomicString& family, const String& script, ExceptionState&);
98 void setDefaultVideoPosterURL(const String& url, ExceptionState&);
99 void setEditingBehavior(const String&, ExceptionState&);
100 void setImagesEnabled(bool, ExceptionState&);
101 void setMediaTypeOverride(const String& mediaType, ExceptionState&);
102 void setMockScrollbarsEnabled(bool, ExceptionState&);
103 void setMockGestureTapHighlightsEnabled(bool, ExceptionState&);
104 void setTextAutosizingEnabled(bool, ExceptionState&);
105 void setAccessibilityFontScaleFactor(float fontScaleFactor, ExceptionState&);
106 void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionState&);
107 void setViewportEnabled(bool, ExceptionState&);
109 // FIXME: This is a temporary flag and should be removed once squashing is
110 // ready (crbug.com/261605).
111 void setLayerSquashingEnabled(bool, ExceptionState&);
113 // FIXME: The following are RuntimeEnabledFeatures and likely
114 // cannot be changed after process start. These setters should
115 // be removed or moved onto internals.runtimeFlags:
116 void setAuthorShadowDOMForAnyElementEnabled(bool);
117 void setLangAttributeAwareFormControlUIEnabled(bool);
118 void setOverlayScrollbarsEnabled(bool);
119 void setExperimentalContentSecurityPolicyFeaturesEnabled(bool);
120 void setPseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled(bool);
121 void setLaxMixedContentCheckingEnabled(bool);
123 virtual void trace(Visitor*) OVERRIDE;
125 void setAvailablePointerTypes(const String&, ExceptionState&);
126 void setPrimaryPointerType(const String&, ExceptionState&);
127 void setAvailableHoverTypes(const String&, ExceptionState&);
128 void setPrimaryHoverType(const String&, ExceptionState&);
131 explicit InternalSettings(Page&);
133 Settings* settings() const;
134 Page* page() const { return m_page; }
135 static const char* supplementName();
137 RawPtrWillBeWeakMember<Page> m_page;
143 #endif // InternalSettings_h