| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #include "config.h" | |
| 32 #include "WebSettingsImpl.h" | |
| 33 | |
| 34 #include "FontRenderingMode.h" | |
| 35 #include "Settings.h" | |
| 36 #include "WebString.h" | |
| 37 #include "WebURL.h" | |
| 38 | |
| 39 #if defined(OS_WIN) | |
| 40 #include "RenderThemeChromiumWin.h" | |
| 41 #endif | |
| 42 | |
| 43 using namespace WebCore; | |
| 44 | |
| 45 namespace WebKit { | |
| 46 | |
| 47 WebSettingsImpl::WebSettingsImpl(Settings* settings) | |
| 48 : m_settings(settings) | |
| 49 { | |
| 50 ASSERT(settings); | |
| 51 } | |
| 52 | |
| 53 void WebSettingsImpl::setStandardFontFamily(const WebString& font) | |
| 54 { | |
| 55 m_settings->setStandardFontFamily(font); | |
| 56 } | |
| 57 | |
| 58 void WebSettingsImpl::setFixedFontFamily(const WebString& font) | |
| 59 { | |
| 60 m_settings->setFixedFontFamily((String)font); | |
| 61 } | |
| 62 | |
| 63 void WebSettingsImpl::setSerifFontFamily(const WebString& font) | |
| 64 { | |
| 65 m_settings->setSerifFontFamily((String)font); | |
| 66 } | |
| 67 | |
| 68 void WebSettingsImpl::setSansSerifFontFamily(const WebString& font) | |
| 69 { | |
| 70 m_settings->setSansSerifFontFamily((String)font); | |
| 71 } | |
| 72 | |
| 73 void WebSettingsImpl::setCursiveFontFamily(const WebString& font) | |
| 74 { | |
| 75 m_settings->setCursiveFontFamily((String)font); | |
| 76 } | |
| 77 | |
| 78 void WebSettingsImpl::setFantasyFontFamily(const WebString& font) | |
| 79 { | |
| 80 m_settings->setFantasyFontFamily((String)font); | |
| 81 } | |
| 82 | |
| 83 void WebSettingsImpl::setDefaultFontSize(int size) | |
| 84 { | |
| 85 m_settings->setDefaultFontSize(size); | |
| 86 #if defined(OS_WIN) | |
| 87 // RenderTheme is a singleton that needs to know the default font size to | |
| 88 // draw some form controls. We let it know each time the size changes. | |
| 89 WebCore::RenderThemeChromiumWin::setDefaultFontSize(size); | |
| 90 #endif | |
| 91 } | |
| 92 | |
| 93 void WebSettingsImpl::setDefaultFixedFontSize(int size) | |
| 94 { | |
| 95 m_settings->setDefaultFixedFontSize(size); | |
| 96 } | |
| 97 | |
| 98 void WebSettingsImpl::setMinimumFontSize(int size) | |
| 99 { | |
| 100 m_settings->setMinimumFontSize(size); | |
| 101 } | |
| 102 | |
| 103 void WebSettingsImpl::setMinimumLogicalFontSize(int size) | |
| 104 { | |
| 105 m_settings->setMinimumLogicalFontSize(size); | |
| 106 } | |
| 107 | |
| 108 void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding) | |
| 109 { | |
| 110 m_settings->setDefaultTextEncodingName((String)encoding); | |
| 111 } | |
| 112 | |
| 113 void WebSettingsImpl::setJavaScriptEnabled(bool enabled) | |
| 114 { | |
| 115 m_settings->setJavaScriptEnabled(enabled); | |
| 116 } | |
| 117 | |
| 118 void WebSettingsImpl::setWebSecurityEnabled(bool enabled) | |
| 119 { | |
| 120 m_settings->setWebSecurityEnabled(enabled); | |
| 121 } | |
| 122 | |
| 123 void WebSettingsImpl::setJavaScriptCanOpenWindowsAutomatically(bool canOpenWindows) | |
| 124 { | |
| 125 m_settings->setJavaScriptCanOpenWindowsAutomatically(canOpenWindows); | |
| 126 } | |
| 127 | |
| 128 void WebSettingsImpl::setLoadsImagesAutomatically(bool loadsImagesAutomatically) | |
| 129 { | |
| 130 m_settings->setLoadsImagesAutomatically(loadsImagesAutomatically); | |
| 131 } | |
| 132 | |
| 133 void WebSettingsImpl::setPluginsEnabled(bool enabled) | |
| 134 { | |
| 135 m_settings->setPluginsEnabled(enabled); | |
| 136 } | |
| 137 | |
| 138 void WebSettingsImpl::setDOMPasteAllowed(bool enabled) | |
| 139 { | |
| 140 m_settings->setDOMPasteAllowed(enabled); | |
| 141 } | |
| 142 | |
| 143 void WebSettingsImpl::setDeveloperExtrasEnabled(bool enabled) | |
| 144 { | |
| 145 m_settings->setDeveloperExtrasEnabled(enabled); | |
| 146 } | |
| 147 | |
| 148 void WebSettingsImpl::setShrinksStandaloneImagesToFit(bool shrinkImages) | |
| 149 { | |
| 150 m_settings->setShrinksStandaloneImagesToFit(shrinkImages); | |
| 151 } | |
| 152 | |
| 153 void WebSettingsImpl::setUsesEncodingDetector(bool usesDetector) | |
| 154 { | |
| 155 m_settings->setUsesEncodingDetector(usesDetector); | |
| 156 } | |
| 157 | |
| 158 void WebSettingsImpl::setTextAreasAreResizable(bool areResizable) | |
| 159 { | |
| 160 m_settings->setTextAreasAreResizable(areResizable); | |
| 161 } | |
| 162 | |
| 163 void WebSettingsImpl::setJavaEnabled(bool enabled) | |
| 164 { | |
| 165 m_settings->setJavaEnabled(enabled); | |
| 166 } | |
| 167 | |
| 168 void WebSettingsImpl::setAllowScriptsToCloseWindows(bool allow) | |
| 169 { | |
| 170 m_settings->setAllowScriptsToCloseWindows(allow); | |
| 171 } | |
| 172 | |
| 173 void WebSettingsImpl::setUserStyleSheetLocation(const WebURL& location) | |
| 174 { | |
| 175 m_settings->setUserStyleSheetLocation(location); | |
| 176 } | |
| 177 | |
| 178 void WebSettingsImpl::setUsesPageCache(bool usesPageCache) | |
| 179 { | |
| 180 m_settings->setUsesPageCache(usesPageCache); | |
| 181 } | |
| 182 | |
| 183 void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled) | |
| 184 { | |
| 185 m_settings->setDownloadableBinaryFontsEnabled(enabled); | |
| 186 } | |
| 187 | |
| 188 void WebSettingsImpl::setXSSAuditorEnabled(bool enabled) | |
| 189 { | |
| 190 m_settings->setXSSAuditorEnabled(enabled); | |
| 191 } | |
| 192 | |
| 193 void WebSettingsImpl::setLocalStorageEnabled(bool enabled) | |
| 194 { | |
| 195 m_settings->setLocalStorageEnabled(enabled); | |
| 196 } | |
| 197 | |
| 198 void WebSettingsImpl::setEditableLinkBehaviorNeverLive() | |
| 199 { | |
| 200 // FIXME: If you ever need more behaviors than this, then we should probably | |
| 201 // define an enum in WebSettings.h and have a switch statement that | |
| 202 // translates. Until then, this is probably fine, though. | |
| 203 m_settings->setEditableLinkBehavior(WebCore::EditableLinkNeverLive); | |
| 204 } | |
| 205 | |
| 206 void WebSettingsImpl::setFontRenderingModeNormal() | |
| 207 { | |
| 208 // FIXME: If you ever need more behaviors than this, then we should probably | |
| 209 // define an enum in WebSettings.h and have a switch statement that | |
| 210 // translates. Until then, this is probably fine, though. | |
| 211 m_settings->setFontRenderingMode(WebCore::NormalRenderingMode); | |
| 212 } | |
| 213 | |
| 214 void WebSettingsImpl::setShouldPaintCustomScrollbars(bool enabled) | |
| 215 { | |
| 216 m_settings->setShouldPaintCustomScrollbars(enabled); | |
| 217 } | |
| 218 | |
| 219 void WebSettingsImpl::setDatabasesEnabled(bool enabled) | |
| 220 { | |
| 221 m_settings->setDatabasesEnabled(enabled); | |
| 222 } | |
| 223 | |
| 224 void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow) | |
| 225 { | |
| 226 m_settings->setAllowUniversalAccessFromFileURLs(allow); | |
| 227 } | |
| 228 | |
| 229 void WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded() | |
| 230 { | |
| 231 // FIXME: If you ever need more behaviors than this, then we should probably | |
| 232 // define an enum in WebSettings.h and have a switch statement that | |
| 233 // translates. Until then, this is probably fine, though. | |
| 234 m_settings->setTextDirectionSubmenuInclusionBehavior(WebCore::TextDirectionSubmenuNeverIncluded); | |
| 235 } | |
| 236 | |
| 237 void WebSettingsImpl::setOfflineWebApplicationCacheEnabled(bool enabled) | |
| 238 { | |
| 239 m_settings->setOfflineWebApplicationCacheEnabled(enabled); | |
| 240 } | |
| 241 | |
| 242 void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled) | |
| 243 { | |
| 244 m_settings->setWebGLEnabled(enabled); | |
| 245 } | |
| 246 | |
| 247 } // namespace WebKit | |
| OLD | NEW |