Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 | * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * |
| 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. |
| 14 | * |
| 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. |
| 25 | */ |
| 26 | |
| 27 | #ifndef InternalSettings_h |
| 28 | #define InternalSettings_h |
| 29 | |
| 30 | #include "InternalSettingsGenerated.h" |
| 31 | #include "core/editing/EditingBehaviorTypes.h" |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 32 | #include "heap/Handle.h" |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 33 | #include "platform/geometry/IntSize.h" |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 34 | #include "wtf/PassRefPtr.h" |
| 35 | #include "wtf/RefCounted.h" |
| 36 | #include "wtf/text/WTFString.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 37 | |
| 38 | namespace WebCore { |
| 39 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 40 | class Document; |
Ben Murdoch | df95704 | 2013-08-06 11:01:27 +0100 | [diff] [blame] | 41 | class ExceptionState; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 42 | class LocalFrame; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 43 | class Page; |
| 44 | class Settings; |
| 45 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 46 | class InternalSettings FINAL : public InternalSettingsGenerated { |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 47 | public: |
| 48 | class Backup { |
| 49 | public: |
| 50 | explicit Backup(Settings*); |
| 51 | void restoreTo(Settings*); |
| 52 | |
| 53 | bool m_originalCSSExclusionsEnabled; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 54 | bool m_originalAuthorShadowDOMForAnyElementEnabled; |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 55 | bool m_originalExperimentalWebSocketEnabled; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 56 | bool m_originalStyleScoped; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 57 | bool m_originalCSP; |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 58 | bool m_originalOverlayScrollbarsEnabled; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 59 | EditingBehaviorType m_originalEditingBehavior; |
| 60 | bool m_originalTextAutosizingEnabled; |
| 61 | IntSize m_originalTextAutosizingWindowSizeOverride; |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 62 | float m_originalAccessibilityFontScaleFactor; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 63 | String m_originalMediaTypeOverride; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 64 | bool m_originalMockScrollbarsEnabled; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 65 | bool m_langAttributeAwareFormControlUIEnabled; |
| 66 | bool m_imagesEnabled; |
| 67 | bool m_shouldDisplaySubtitles; |
| 68 | bool m_shouldDisplayCaptions; |
| 69 | bool m_shouldDisplayTextDescriptions; |
| 70 | String m_defaultVideoPosterURL; |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 71 | bool m_originalCompositorDrivenAcceleratedScrollEnabled; |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 72 | bool m_originalLayerSquashingEnabled; |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 73 | bool m_originalPasswordGenerationDecorationEnabled; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 74 | }; |
| 75 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 76 | static PassRefPtrWillBeRawPtr<InternalSettings> create(Page& page) |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 77 | { |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 78 | return adoptRefWillBeNoop(new InternalSettings(page)); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 79 | } |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 80 | static InternalSettings* from(Page&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 81 | void hostDestroyed() { m_page = 0; } |
| 82 | |
| 83 | virtual ~InternalSettings(); |
| 84 | void resetToConsistentState(); |
| 85 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 86 | void setStandardFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
| 87 | void setSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
| 88 | void setSansSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
| 89 | void setFixedFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
| 90 | void setCursiveFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
| 91 | void setFantasyFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
| 92 | void setPictographFontFamily(const AtomicString& family, const String& script, ExceptionState&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 93 | |
Ben Murdoch | df95704 | 2013-08-06 11:01:27 +0100 | [diff] [blame] | 94 | void setDefaultVideoPosterURL(const String& url, ExceptionState&); |
| 95 | void setEditingBehavior(const String&, ExceptionState&); |
| 96 | void setImagesEnabled(bool, ExceptionState&); |
| 97 | void setMediaTypeOverride(const String& mediaType, ExceptionState&); |
| 98 | void setMockScrollbarsEnabled(bool, ExceptionState&); |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 99 | void setPasswordGenerationDecorationEnabled(bool, ExceptionState&); |
Ben Murdoch | df95704 | 2013-08-06 11:01:27 +0100 | [diff] [blame] | 100 | void setTextAutosizingEnabled(bool, ExceptionState&); |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 101 | void setAccessibilityFontScaleFactor(float fontScaleFactor, ExceptionState&); |
Ben Murdoch | df95704 | 2013-08-06 11:01:27 +0100 | [diff] [blame] | 102 | void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionState&); |
| 103 | void setTouchEventEmulationEnabled(bool, ExceptionState&); |
Torne (Richard Coles) | e1f1df5 | 2013-08-23 16:39:30 +0100 | [diff] [blame] | 104 | void setViewportEnabled(bool, ExceptionState&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 105 | |
Ben Murdoch | 591b958 | 2013-07-10 11:41:44 +0100 | [diff] [blame] | 106 | // FIXME: This is a temporary flag and should be removed once accelerated |
| 107 | // overflow scroll is ready (crbug.com/254111). |
Ben Murdoch | df95704 | 2013-08-06 11:01:27 +0100 | [diff] [blame] | 108 | void setCompositorDrivenAcceleratedScrollingEnabled(bool, ExceptionState&); |
Ben Murdoch | 591b958 | 2013-07-10 11:41:44 +0100 | [diff] [blame] | 109 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 110 | // FIXME: This is a temporary flag and should be removed once squashing is |
| 111 | // ready (crbug.com/261605). |
| 112 | void setLayerSquashingEnabled(bool, ExceptionState&); |
| 113 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 114 | // FIXME: The following are RuntimeEnabledFeatures and likely |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 115 | // cannot be changed after process start. These setters should |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 116 | // be removed or moved onto internals.runtimeFlags: |
| 117 | void setAuthorShadowDOMForAnyElementEnabled(bool); |
| 118 | void setCSSExclusionsEnabled(bool); |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 119 | void setExperimentalWebSocketEnabled(bool); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 120 | void setLangAttributeAwareFormControlUIEnabled(bool); |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 121 | void setOverlayScrollbarsEnabled(bool); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 122 | void setStyleScopedEnabled(bool); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 123 | void setExperimentalContentSecurityPolicyFeaturesEnabled(bool); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 124 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 125 | virtual void trace(Visitor* visitor) OVERRIDE { InternalSettingsGenerated::trace(visitor); } |
| 126 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 127 | private: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 128 | explicit InternalSettings(Page&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 129 | |
| 130 | Settings* settings() const; |
| 131 | Page* page() const { return m_page; } |
| 132 | static const char* supplementName(); |
| 133 | |
| 134 | Page* m_page; |
| 135 | Backup m_backup; |
| 136 | }; |
| 137 | |
| 138 | } // namespace WebCore |
| 139 | |
| 140 | #endif |