| OLD | NEW | 
|   1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 
|   2 // Use of this source code is governed by a BSD-style license that can be |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 #include "webkit/glue/webpreferences.h" |   5 #include "webkit/glue/webpreferences.h" | 
|   6  |   6  | 
|   7 #include "base/string_util.h" |   7 #include "base/string_util.h" | 
 |   8 #include "webkit/api/public/WebRuntimeFeatures.h" | 
|   8 #include "webkit/api/public/WebKit.h" |   9 #include "webkit/api/public/WebKit.h" | 
|   9 #include "webkit/api/public/WebSettings.h" |  10 #include "webkit/api/public/WebSettings.h" | 
|  10 #include "webkit/api/public/WebString.h" |  11 #include "webkit/api/public/WebString.h" | 
|  11 #include "webkit/api/public/WebURL.h" |  12 #include "webkit/api/public/WebURL.h" | 
|  12 #include "webkit/api/public/WebView.h" |  13 #include "webkit/api/public/WebView.h" | 
|  13 #include "webkit/glue/webkit_glue.h" |  14 #include "webkit/glue/webkit_glue.h" | 
|  14  |  15  | 
 |  16 using WebKit::WebRuntimeFeatures; | 
|  15 using WebKit::WebSettings; |  17 using WebKit::WebSettings; | 
|  16 using WebKit::WebString; |  18 using WebKit::WebString; | 
|  17 using WebKit::WebURL; |  19 using WebKit::WebURL; | 
|  18 using WebKit::WebView; |  20 using WebKit::WebView; | 
|  19  |  21  | 
|  20 void WebPreferences::Apply(WebView* web_view) const { |  22 void WebPreferences::Apply(WebView* web_view) const { | 
|  21   WebSettings* settings = web_view->settings(); |  23   WebSettings* settings = web_view->settings(); | 
|  22   settings->setStandardFontFamily(WideToUTF16Hack(standard_font_family)); |  24   settings->setStandardFontFamily(WideToUTF16Hack(standard_font_family)); | 
|  23   settings->setFixedFontFamily(WideToUTF16Hack(fixed_font_family)); |  25   settings->setFixedFontFamily(WideToUTF16Hack(fixed_font_family)); | 
|  24   settings->setSerifFontFamily(WideToUTF16Hack(serif_font_family)); |  26   settings->setSerifFontFamily(WideToUTF16Hack(serif_font_family)); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|  43   settings->setTextAreasAreResizable(text_areas_are_resizable); |  45   settings->setTextAreasAreResizable(text_areas_are_resizable); | 
|  44   settings->setAllowScriptsToCloseWindows(allow_scripts_to_close_windows); |  46   settings->setAllowScriptsToCloseWindows(allow_scripts_to_close_windows); | 
|  45   if (user_style_sheet_enabled) |  47   if (user_style_sheet_enabled) | 
|  46     settings->setUserStyleSheetLocation(user_style_sheet_location); |  48     settings->setUserStyleSheetLocation(user_style_sheet_location); | 
|  47   else |  49   else | 
|  48     settings->setUserStyleSheetLocation(WebURL()); |  50     settings->setUserStyleSheetLocation(WebURL()); | 
|  49   settings->setUsesPageCache(uses_page_cache); |  51   settings->setUsesPageCache(uses_page_cache); | 
|  50   settings->setDownloadableBinaryFontsEnabled(remote_fonts_enabled); |  52   settings->setDownloadableBinaryFontsEnabled(remote_fonts_enabled); | 
|  51   settings->setXSSAuditorEnabled(xss_auditor_enabled); |  53   settings->setXSSAuditorEnabled(xss_auditor_enabled); | 
|  52   settings->setLocalStorageEnabled(local_storage_enabled); |  54   settings->setLocalStorageEnabled(local_storage_enabled); | 
|  53   settings->setDatabasesEnabled(WebKit::databasesEnabled() || databases_enabled)
    ; |  55   settings->setDatabasesEnabled( | 
 |  56       WebRuntimeFeatures::isDatabaseEnabled() || databases_enabled); | 
|  54   settings->setSessionStorageEnabled(session_storage_enabled); |  57   settings->setSessionStorageEnabled(session_storage_enabled); | 
|  55   settings->setOfflineWebApplicationCacheEnabled(application_cache_enabled); |  58   settings->setOfflineWebApplicationCacheEnabled(application_cache_enabled); | 
|  56   settings->setExperimentalNotificationsEnabled( |  59   settings->setExperimentalNotificationsEnabled( | 
|  57       experimental_notifications_enabled); |  60       experimental_notifications_enabled); | 
|  58  |  61  | 
|  59   // This setting affects the behavior of links in an editable region: |  62   // This setting affects the behavior of links in an editable region: | 
|  60   // clicking the link should select it rather than navigate to it. |  63   // clicking the link should select it rather than navigate to it. | 
|  61   // Safari uses the same default. It is unlikley an embedder would want to |  64   // Safari uses the same default. It is unlikley an embedder would want to | 
|  62   // change this, since it would break existing rich text editors. |  65   // change this, since it would break existing rich text editors. | 
|  63   settings->setEditableLinkBehaviorNeverLive(); |  66   settings->setEditableLinkBehaviorNeverLive(); | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  83   // and support is compiled in. |  86   // and support is compiled in. | 
|  84   settings->setExperimentalWebGLEnabled(experimental_webgl_enabled); |  87   settings->setExperimentalWebGLEnabled(experimental_webgl_enabled); | 
|  85  |  88  | 
|  86   // Web inspector settings need to be passed in differently. |  89   // Web inspector settings need to be passed in differently. | 
|  87   web_view->setInspectorSettings(WebString::fromUTF8(inspector_settings)); |  90   web_view->setInspectorSettings(WebString::fromUTF8(inspector_settings)); | 
|  88  |  91  | 
|  89   // Tabs to link is not part of the settings. WebCore calls |  92   // Tabs to link is not part of the settings. WebCore calls | 
|  90   // ChromeClient::tabsToLinks which is part of the glue code. |  93   // ChromeClient::tabsToLinks which is part of the glue code. | 
|  91   web_view->setTabsToLinks(tabs_to_links); |  94   web_view->setTabsToLinks(tabs_to_links); | 
|  92 } |  95 } | 
| OLD | NEW |