WebKit/chromium/src/WebSettingsImpl.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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::setImagesEnabled(bool enabled)
       
   134 {
       
   135     m_settings->setImagesEnabled(enabled);
       
   136 }
       
   137 
       
   138 void WebSettingsImpl::setPluginsEnabled(bool enabled)
       
   139 {
       
   140     m_settings->setPluginsEnabled(enabled);
       
   141 }
       
   142 
       
   143 void WebSettingsImpl::setDOMPasteAllowed(bool enabled)
       
   144 {
       
   145     m_settings->setDOMPasteAllowed(enabled);
       
   146 }
       
   147 
       
   148 void WebSettingsImpl::setDeveloperExtrasEnabled(bool enabled)
       
   149 {
       
   150     m_settings->setDeveloperExtrasEnabled(enabled);
       
   151 }
       
   152 
       
   153 void WebSettingsImpl::setNeedsSiteSpecificQuirks(bool enabled)
       
   154 {
       
   155     m_settings->setNeedsSiteSpecificQuirks(enabled);
       
   156 }
       
   157 
       
   158 void WebSettingsImpl::setShrinksStandaloneImagesToFit(bool shrinkImages)
       
   159 {
       
   160     m_settings->setShrinksStandaloneImagesToFit(shrinkImages);
       
   161 }
       
   162 
       
   163 void WebSettingsImpl::setUsesEncodingDetector(bool usesDetector)
       
   164 {
       
   165     m_settings->setUsesEncodingDetector(usesDetector);
       
   166 }
       
   167 
       
   168 void WebSettingsImpl::setTextAreasAreResizable(bool areResizable)
       
   169 {
       
   170     m_settings->setTextAreasAreResizable(areResizable);
       
   171 }
       
   172 
       
   173 void WebSettingsImpl::setJavaEnabled(bool enabled)
       
   174 {
       
   175     m_settings->setJavaEnabled(enabled);
       
   176 }
       
   177 
       
   178 void WebSettingsImpl::setAllowScriptsToCloseWindows(bool allow)
       
   179 {
       
   180     m_settings->setAllowScriptsToCloseWindows(allow);
       
   181 }
       
   182 
       
   183 void WebSettingsImpl::setUserStyleSheetLocation(const WebURL& location)
       
   184 {
       
   185     m_settings->setUserStyleSheetLocation(location);
       
   186 }
       
   187 
       
   188 void WebSettingsImpl::setAuthorAndUserStylesEnabled(bool enabled)
       
   189 {
       
   190     m_settings->setAuthorAndUserStylesEnabled(enabled);
       
   191 }
       
   192 
       
   193 void WebSettingsImpl::setUsesPageCache(bool usesPageCache)
       
   194 {
       
   195     m_settings->setUsesPageCache(usesPageCache);
       
   196 }
       
   197 
       
   198 void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled)
       
   199 {
       
   200     m_settings->setDownloadableBinaryFontsEnabled(enabled);
       
   201 }
       
   202 
       
   203 void WebSettingsImpl::setJavaScriptCanAccessClipboard(bool enabled)
       
   204 {
       
   205     m_settings->setJavaScriptCanAccessClipboard(enabled);
       
   206 }
       
   207 
       
   208 void WebSettingsImpl::setXSSAuditorEnabled(bool enabled)
       
   209 {
       
   210     m_settings->setXSSAuditorEnabled(enabled);
       
   211 }
       
   212 
       
   213 void WebSettingsImpl::setLocalStorageEnabled(bool enabled)
       
   214 {
       
   215     m_settings->setLocalStorageEnabled(enabled);
       
   216 }
       
   217 
       
   218 void WebSettingsImpl::setEditableLinkBehaviorNeverLive()
       
   219 {
       
   220     // FIXME: If you ever need more behaviors than this, then we should probably
       
   221     //        define an enum in WebSettings.h and have a switch statement that
       
   222     //        translates.  Until then, this is probably fine, though.
       
   223     m_settings->setEditableLinkBehavior(WebCore::EditableLinkNeverLive);
       
   224 }
       
   225 
       
   226 void WebSettingsImpl::setFontRenderingModeNormal()
       
   227 {
       
   228     // FIXME: If you ever need more behaviors than this, then we should probably
       
   229     //        define an enum in WebSettings.h and have a switch statement that
       
   230     //        translates.  Until then, this is probably fine, though.
       
   231     m_settings->setFontRenderingMode(WebCore::NormalRenderingMode);
       
   232 }
       
   233 
       
   234 void WebSettingsImpl::setShouldPaintCustomScrollbars(bool enabled)
       
   235 {
       
   236     m_settings->setShouldPaintCustomScrollbars(enabled);
       
   237 }
       
   238 
       
   239 void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow)
       
   240 {
       
   241     m_settings->setAllowUniversalAccessFromFileURLs(allow);
       
   242 }
       
   243 
       
   244 void WebSettingsImpl::setAllowFileAccessFromFileURLs(bool allow)
       
   245 {
       
   246     m_settings->setAllowFileAccessFromFileURLs(allow);
       
   247 }
       
   248 
       
   249 void WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded()
       
   250 {
       
   251     // FIXME: If you ever need more behaviors than this, then we should probably
       
   252     //        define an enum in WebSettings.h and have a switch statement that
       
   253     //        translates.  Until then, this is probably fine, though.
       
   254     m_settings->setTextDirectionSubmenuInclusionBehavior(WebCore::TextDirectionSubmenuNeverIncluded);
       
   255 }
       
   256 
       
   257 void WebSettingsImpl::setOfflineWebApplicationCacheEnabled(bool enabled)
       
   258 {
       
   259     m_settings->setOfflineWebApplicationCacheEnabled(enabled);
       
   260 }
       
   261 
       
   262 void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled)
       
   263 {
       
   264     m_settings->setWebGLEnabled(enabled);
       
   265 }
       
   266 
       
   267 void WebSettingsImpl::setShowDebugBorders(bool show)
       
   268 {
       
   269     m_settings->setShowDebugBorders(show);
       
   270 }
       
   271 
       
   272 void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior)
       
   273 {
       
   274     m_settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(behavior));
       
   275 }
       
   276 
       
   277 void WebSettingsImpl::setAcceleratedCompositingEnabled(bool enabled)
       
   278 {
       
   279     m_settings->setAcceleratedCompositingEnabled(enabled);
       
   280 }
       
   281 
       
   282 void WebSettingsImpl::setHTML5ParserEnabled(bool enabled)
       
   283 {
       
   284     m_settings->setHTML5ParserEnabled(enabled);
       
   285 }
       
   286 
       
   287 void WebSettingsImpl::setMemoryInfoEnabled(bool enabled)
       
   288 {
       
   289     m_settings->setMemoryInfoEnabled(enabled);
       
   290 }
       
   291 
       
   292 } // namespace WebKit