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/WebKit.h" | 8 #include "webkit/api/public/WebKit.h" |
9 #include "webkit/api/public/WebSettings.h" | 9 #include "webkit/api/public/WebSettings.h" |
10 #include "webkit/api/public/WebString.h" | 10 #include "webkit/api/public/WebString.h" |
11 #include "webkit/api/public/WebURL.h" | 11 #include "webkit/api/public/WebURL.h" |
12 #include "webkit/glue/webkit_glue.h" | 12 #include "webkit/glue/webkit_glue.h" |
13 #include "webkit/glue/webview.h" | 13 #include "webkit/glue/webview.h" |
14 | 14 |
15 using WebKit::WebSettings; | 15 using WebKit::WebSettings; |
16 using WebKit::WebURL; | 16 using WebKit::WebURL; |
17 | 17 |
18 void WebPreferences::Apply(WebView* web_view) const { | 18 void WebPreferences::Apply(WebView* web_view) const { |
19 WebSettings* settings = web_view->GetSettings(); | 19 WebSettings* settings = web_view->GetSettings(); |
20 settings->setStandardFontFamily(WideToUTF16Hack(standard_font_family)); | 20 settings->setStandardFontFamily(WideToUTF16Hack(standard_font_family)); |
21 settings->setFixedFontFamily(WideToUTF16Hack(fixed_font_family)); | 21 settings->setFixedFontFamily(WideToUTF16Hack(fixed_font_family)); |
22 settings->setSerifFontFamily(WideToUTF16Hack(serif_font_family)); | 22 settings->setSerifFontFamily(WideToUTF16Hack(serif_font_family)); |
23 settings->setSansSerifFontFamily(WideToUTF16Hack(sans_serif_font_family)); | 23 settings->setSansSerifFontFamily(WideToUTF16Hack(sans_serif_font_family)); |
24 settings->setCursiveFontFamily(WideToUTF16Hack(cursive_font_family)); | 24 settings->setCursiveFontFamily(WideToUTF16Hack(cursive_font_family)); |
25 settings->setFantasyFontFamily(WideToUTF16Hack(fantasy_font_family)); | 25 settings->setFantasyFontFamily(WideToUTF16Hack(fantasy_font_family)); |
26 settings->setDefaultFontSize(default_font_size); | 26 settings->setDefaultFontSize(default_font_size); |
27 settings->setDefaultFixedFontSize(default_fixed_font_size); | 27 settings->setDefaultFixedFontSize(default_fixed_font_size); |
28 settings->setMinimumFontSize(minimum_font_size); | 28 settings->setMinimumFontSize(minimum_font_size); |
29 settings->setMinimumLogicalFontSize(minimum_logical_font_size); | 29 settings->setMinimumLogicalFontSize(minimum_logical_font_size); |
30 settings->setDefaultTextEncodingName(WideToUTF16Hack(default_encoding)); | 30 settings->setDefaultTextEncodingName(ASCIIToUTF16(default_encoding)); |
31 settings->setJavaScriptEnabled(javascript_enabled); | 31 settings->setJavaScriptEnabled(javascript_enabled); |
32 settings->setWebSecurityEnabled(web_security_enabled); | 32 settings->setWebSecurityEnabled(web_security_enabled); |
33 settings->setJavaScriptCanOpenWindowsAutomatically( | 33 settings->setJavaScriptCanOpenWindowsAutomatically( |
34 javascript_can_open_windows_automatically); | 34 javascript_can_open_windows_automatically); |
35 settings->setLoadsImagesAutomatically(loads_images_automatically); | 35 settings->setLoadsImagesAutomatically(loads_images_automatically); |
36 settings->setPluginsEnabled(plugins_enabled); | 36 settings->setPluginsEnabled(plugins_enabled); |
37 settings->setDOMPasteAllowed(dom_paste_enabled); | 37 settings->setDOMPasteAllowed(dom_paste_enabled); |
38 settings->setDeveloperExtrasEnabled(developer_extras_enabled); | 38 settings->setDeveloperExtrasEnabled(developer_extras_enabled); |
39 settings->setShrinksStandaloneImagesToFit(shrinks_standalone_images_to_fit); | 39 settings->setShrinksStandaloneImagesToFit(shrinks_standalone_images_to_fit); |
40 settings->setUsesEncodingDetector(uses_universal_detector); | 40 settings->setUsesEncodingDetector(uses_universal_detector); |
(...skipping 28 matching lines...) Expand all Loading... |
69 settings->setAllowUniversalAccessFromFileURLs(false); | 69 settings->setAllowUniversalAccessFromFileURLs(false); |
70 | 70 |
71 // We prevent WebKit from checking if it needs to add a "text direction" | 71 // We prevent WebKit from checking if it needs to add a "text direction" |
72 // submenu to a context menu. it is not only because we don't need the result | 72 // submenu to a context menu. it is not only because we don't need the result |
73 // but also because it cause a possible crash in Editor::hasBidiSelection(). | 73 // but also because it cause a possible crash in Editor::hasBidiSelection(). |
74 settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); | 74 settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); |
75 | 75 |
76 // Web inspector settings need to be passed in differently. | 76 // Web inspector settings need to be passed in differently. |
77 web_view->SetInspectorSettings(inspector_settings); | 77 web_view->SetInspectorSettings(inspector_settings); |
78 } | 78 } |
OLD | NEW |