mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-11 09:08:06 +01:00
801ff3ca43
- Move to the new DOM storage backend. Persistent localStorage support will need to be re-implemented (issue #603). - Add CefV8Value::CreateUInt method and indicate that integer types are 32bit via usage of int32 and uint32 types (issue #331). - Add CefV8Context::Eval method for synchronous JavaScript execution that returns a value or exception (issue #444). - Move exception handling from an ExecuteFunction argument to a CefV8Value attribute (issue #546). - Make user data an attribute for all CefV8Value object types and not just CreateObject (issue #547). - Un-fork SQLitePersistentCookieStore by adding stub implementations for sqlite_diagnostics and browser_thread. - Update tools/cef_parser.py to match the CEF3 version. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@644 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
156 lines
6.1 KiB
C++
156 lines
6.1 KiB
C++
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
|
// be found in the LICENSE file.
|
|
|
|
#include "libcef/browser_settings.h"
|
|
#include "include/internal/cef_types_wrappers.h"
|
|
#include "base/utf_string_conversions.h"
|
|
#include "webkit/glue/webpreferences.h"
|
|
|
|
using webkit_glue::WebPreferences;
|
|
|
|
void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) {
|
|
if (cef.standard_font_family.length > 0) {
|
|
web.standard_font_family_map[WebPreferences::kCommonScript] =
|
|
CefString(&cef.standard_font_family);
|
|
} else {
|
|
web.standard_font_family_map[WebPreferences::kCommonScript] =
|
|
ASCIIToUTF16("Times");
|
|
}
|
|
|
|
if (cef.fixed_font_family.length > 0) {
|
|
web.fixed_font_family_map[WebPreferences::kCommonScript] =
|
|
CefString(&cef.fixed_font_family);
|
|
} else {
|
|
web.fixed_font_family_map[WebPreferences::kCommonScript] =
|
|
ASCIIToUTF16("Courier");
|
|
}
|
|
|
|
if (cef.serif_font_family.length > 0) {
|
|
web.serif_font_family_map[WebPreferences::kCommonScript] =
|
|
CefString(&cef.serif_font_family);
|
|
} else {
|
|
web.serif_font_family_map[WebPreferences::kCommonScript] =
|
|
ASCIIToUTF16("Times");
|
|
}
|
|
|
|
if (cef.sans_serif_font_family.length > 0) {
|
|
web.sans_serif_font_family_map[WebPreferences::kCommonScript] =
|
|
CefString(&cef.sans_serif_font_family);
|
|
} else {
|
|
web.sans_serif_font_family_map[WebPreferences::kCommonScript] =
|
|
ASCIIToUTF16("Helvetica");
|
|
}
|
|
|
|
// These two fonts below are picked from the intersection of
|
|
// Win XP font list and Vista font list :
|
|
// http://www.microsoft.com/typography/fonts/winxp.htm
|
|
// http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx
|
|
// Some of them are installed only with CJK and complex script
|
|
// support enabled on Windows XP and are out of consideration here.
|
|
// (although we enabled both on our buildbots.)
|
|
// They (especially Impact for fantasy) are not typical cursive
|
|
// and fantasy fonts, but it should not matter for layout tests
|
|
// as long as they're available.
|
|
|
|
if (cef.cursive_font_family.length > 0) {
|
|
web.cursive_font_family_map[WebPreferences::kCommonScript] =
|
|
CefString(&cef.cursive_font_family);
|
|
} else {
|
|
web.cursive_font_family_map[WebPreferences::kCommonScript] =
|
|
#if defined(OS_MACOSX)
|
|
ASCIIToUTF16("Apple Chancery");
|
|
#else
|
|
ASCIIToUTF16("Comic Sans MS");
|
|
#endif
|
|
}
|
|
|
|
if (cef.fantasy_font_family.length > 0) {
|
|
web.fantasy_font_family_map[WebPreferences::kCommonScript] =
|
|
CefString(&cef.fantasy_font_family);
|
|
} else {
|
|
web.fantasy_font_family_map[WebPreferences::kCommonScript] =
|
|
#if defined(OS_MACOSX)
|
|
ASCIIToUTF16("Papyrus");
|
|
#else
|
|
ASCIIToUTF16("Impact");
|
|
#endif
|
|
}
|
|
|
|
if (cef.default_font_size > 0)
|
|
web.default_font_size = cef.default_font_size;
|
|
else
|
|
web.default_font_size = 16;
|
|
|
|
if (cef.default_fixed_font_size > 0)
|
|
web.default_fixed_font_size = cef.default_fixed_font_size;
|
|
else
|
|
web.default_fixed_font_size = 13;
|
|
|
|
if (cef.minimum_font_size > 0)
|
|
web.minimum_font_size = cef.minimum_font_size;
|
|
else
|
|
web.minimum_font_size = 1;
|
|
|
|
if (cef.minimum_logical_font_size > 0)
|
|
web.minimum_logical_font_size = cef.minimum_logical_font_size;
|
|
else
|
|
web.minimum_logical_font_size = 9;
|
|
|
|
if (cef.default_encoding.length > 0)
|
|
web.default_encoding = CefString(&cef.default_encoding);
|
|
else
|
|
web.default_encoding = "ISO-8859-1";
|
|
|
|
web.javascript_enabled = !cef.javascript_disabled;
|
|
web.web_security_enabled = !cef.web_security_disabled;
|
|
web.javascript_can_open_windows_automatically =
|
|
!cef.javascript_open_windows_disallowed;
|
|
web.loads_images_automatically = !cef.image_load_disabled;
|
|
web.plugins_enabled = !cef.plugins_disabled;
|
|
web.dom_paste_enabled = !cef.dom_paste_disabled;
|
|
web.developer_extras_enabled = !cef.developer_tools_disabled;
|
|
web.inspector_settings.clear();
|
|
web.site_specific_quirks_enabled = !cef.site_specific_quirks_disabled;
|
|
web.shrinks_standalone_images_to_fit = cef.shrink_standalone_images_to_fit;
|
|
web.uses_universal_detector = cef.encoding_detector_enabled;
|
|
web.text_areas_are_resizable = !cef.text_area_resize_disabled;
|
|
web.java_enabled = !cef.java_disabled;
|
|
web.allow_scripts_to_close_windows = !cef.javascript_close_windows_disallowed;
|
|
web.uses_page_cache = !cef.page_cache_disabled;
|
|
web.remote_fonts_enabled = !cef.remote_fonts_disabled;
|
|
web.javascript_can_access_clipboard =
|
|
!cef.javascript_access_clipboard_disallowed;
|
|
web.xss_auditor_enabled = cef.xss_auditor_enabled;
|
|
web.local_storage_enabled = !cef.local_storage_disabled;
|
|
web.databases_enabled = !cef.databases_disabled;
|
|
web.application_cache_enabled = !cef.application_cache_disabled;
|
|
web.tabs_to_links = !cef.tab_to_links_disabled;
|
|
web.caret_browsing_enabled = cef.caret_browsing_enabled;
|
|
web.hyperlink_auditing_enabled = !cef.hyperlink_auditing_disabled;
|
|
|
|
web.user_style_sheet_enabled = cef.user_style_sheet_enabled;
|
|
|
|
if (cef.user_style_sheet_location.length > 0) {
|
|
web.user_style_sheet_location =
|
|
GURL(std::string(CefString(&cef.user_style_sheet_location)));
|
|
}
|
|
|
|
web.author_and_user_styles_enabled = !cef.author_and_user_styles_disabled;
|
|
web.allow_universal_access_from_file_urls =
|
|
cef.universal_access_from_file_urls_allowed;
|
|
web.allow_file_access_from_file_urls = cef.file_access_from_file_urls_allowed;
|
|
web.experimental_webgl_enabled = !cef.webgl_disabled;
|
|
web.show_composited_layer_borders = false;
|
|
web.accelerated_compositing_enabled = cef.accelerated_compositing_enabled;
|
|
web.accelerated_layers_enabled = !cef.accelerated_layers_disabled;
|
|
web.accelerated_animation_enabled = !cef.accelerated_layers_disabled;
|
|
web.accelerated_video_enabled = !cef.accelerated_video_disabled;
|
|
web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled;
|
|
web.accelerated_painting_enabled = !cef.accelerated_painting_disabled;
|
|
web.accelerated_filters_enabled = !cef.accelerated_filters_disabled;
|
|
web.accelerated_plugins_enabled = !cef.accelerated_plugins_disabled;
|
|
web.memory_info_enabled = false;
|
|
web.fullscreen_enabled = cef.fullscreen_enabled;
|
|
}
|