2 * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
4 * Copyright (C) 2018 Apple Inc. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * 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 INC. AND ITS CONTRIBUTORS ``AS IS''
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 * THE POSSIBILITY OF SUCH DAMAGE.
29 #include "WebPreferences.h"
31 #include "WebPreferencesKeys.h"
35 <%- for @pref in @internalDebugFeatures do -%>
36 void WebPreferences::set<%= @pref.name %>(const bool& value)
38 if (!m_store.setBoolValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key(), value))
40 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::<%= @pref.nameLower %>Key(), value);
43 bool WebPreferences::<%= @pref.nameLower %>() const
45 return m_store.getBoolValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key());
49 const Vector<RefPtr<API::Object>>& WebPreferences::internalDebugFeatures()
51 static NeverDestroyed<Vector<RefPtr<API::Object>>> features(std::initializer_list<RefPtr<API::Object>> {
52 <%- for @pref in @internalDebugFeatures do -%>
53 <%- if @pref.condition -%>
54 #if <%= @pref.condition %>
56 API::InternalDebugFeature::create(<%= @pref.humanReadableName %>, "<%= @pref.name %>", <%= @pref.humanReadableDescription %>, <%= @pref.defaultValue %>, <%= @pref.hidden %>),
57 <%- if @pref.condition -%>
66 bool WebPreferences::isFeatureEnabled(const API::InternalDebugFeature& feature) const
68 struct FeatureGetterMapping {
70 bool (WebPreferences::*function) () const;
73 static FeatureGetterMapping getters[] = {
74 <%- for @pref in @internalDebugFeatures do -%>
75 <%- if @pref.condition -%>
76 #if <%= @pref.condition %>
78 { "<%= @pref.name %>", &WebPreferences::<%= @pref.nameLower %> },
79 <%- if @pref.condition -%>
85 const String& key = feature.key();
87 for (auto& getter : getters) {
88 if (key == getter.name)
89 return (this->*getter.function)();
95 void WebPreferences::setFeatureEnabled(const API::InternalDebugFeature& feature, bool value)
97 setInternalDebugFeatureEnabledForKey(feature.key(), value);
100 void WebPreferences::setInternalDebugFeatureEnabledForKey(const String& key, bool value)
102 struct FeatureSetterMapping {
104 void (WebPreferences::*function) (const bool&);
107 static FeatureSetterMapping setters[] = {
108 <%- for @pref in @internalDebugFeatures do -%>
109 <%- if @pref.condition -%>
110 #if <%= @pref.condition %>
112 { "<%= @pref.name %>", &WebPreferences::set<%= @pref.name %> },
113 <%- if @pref.condition -%>
119 for (auto& setter : setters) {
120 if (key == setter.name) {
121 (this->*setter.function)(value);
127 void WebPreferences::resetAllInternalDebugFeatures()
129 <%- for @pref in @internalDebugFeatures do -%>
130 <%- if @pref.condition -%>
131 #if <%= @pref.condition %>
133 set<%= @pref.name %>(<%= @pref.defaultValue %>);
134 <%- if @pref.condition -%>