Improve the way that settings are specified (issue #878).

- Change CefBrowserSettings members that previously used a boolean to instead use a cef_state_t enumeration with default, enabled and disabled states.
- Remove CefBrowserSettings members that are unlikely to be used and that can also be set using Chromium command-line switches.
- Change the CEF command-line switch naming pattern to match Chromium and move the implementation out of cefclient.
- Improve documentation by listing the command-line switch, if any, associated with each setting.

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1364@1082 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-02-07 19:58:58 +00:00
parent f0394ead29
commit 8d90b87c01
15 changed files with 415 additions and 506 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. // Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
@ -128,10 +128,30 @@ enum cef_log_severity_t {
LOGSEVERITY_DISABLE = 99 LOGSEVERITY_DISABLE = 99
}; };
///
// Represents the state of a setting.
///
enum cef_state_t {
///
// Use the default state for the setting.
///
STATE_DEFAULT = 0,
///
// Enable or allow the setting.
///
STATE_ENABLED,
///
// Disable or disallow the setting.
///
STATE_DISABLED,
};
/// ///
// Initialization settings. Specify NULL or 0 to get the recommended default // Initialization settings. Specify NULL or 0 to get the recommended default
// values. Many of these and other settings can also configured using command- // values. Many of these and other settings can also configured using command-
// line flags. // line switches.
/// ///
typedef struct _cef_settings_t { typedef struct _cef_settings_t {
/// ///
@ -142,14 +162,16 @@ typedef struct _cef_settings_t {
/// ///
// Set to true (1) to use a single process for the browser and renderer. This // Set to true (1) to use a single process for the browser and renderer. This
// run mode is not officially supported by Chromium and is less stable than // run mode is not officially supported by Chromium and is less stable than
// the multi-process default. // the multi-process default. Also configurable using the "single-process"
// command-line switch.
/// ///
bool single_process; bool single_process;
/// ///
// The path to a separate executable that will be launched for sub-processes. // The path to a separate executable that will be launched for sub-processes.
// By default the browser process executable is used. See the comments on // By default the browser process executable is used. See the comments on
// CefExecuteProcess() for details. // CefExecuteProcess() for details. Also configurable using the
// "browser-subprocess-path" command-line switch.
/// ///
cef_string_t browser_subprocess_path; cef_string_t browser_subprocess_path;
@ -177,14 +199,16 @@ typedef struct _cef_settings_t {
/// ///
// Value that will be returned as the User-Agent HTTP header. If empty the // Value that will be returned as the User-Agent HTTP header. If empty the
// default User-Agent string will be used. // default User-Agent string will be used. Also configurable using the
// "user-agent" command-line switch.
/// ///
cef_string_t user_agent; cef_string_t user_agent;
/// ///
// Value that will be inserted as the product portion of the default // Value that will be inserted as the product portion of the default
// User-Agent string. If empty the Chromium product version will be used. If // User-Agent string. If empty the Chromium product version will be used. If
// |userAgent| is specified this value will be ignored. // |userAgent| is specified this value will be ignored. Also configurable
// using the "product-version" command-line switch.
/// ///
cef_string_t product_version; cef_string_t product_version;
@ -192,31 +216,37 @@ typedef struct _cef_settings_t {
// The locale string that will be passed to WebKit. If empty the default // The locale string that will be passed to WebKit. If empty the default
// locale of "en-US" will be used. This value is ignored on Linux where locale // locale of "en-US" will be used. This value is ignored on Linux where locale
// is determined using environment variable parsing with the precedence order: // is determined using environment variable parsing with the precedence order:
// LANGUAGE, LC_ALL, LC_MESSAGES and LANG. // LANGUAGE, LC_ALL, LC_MESSAGES and LANG. Also configurable using the "lang"
// command-line switch.
/// ///
cef_string_t locale; cef_string_t locale;
/// ///
// The directory and file name to use for the debug log. If empty, the // The directory and file name to use for the debug log. If empty, the
// default name of "debug.log" will be used and the file will be written // default name of "debug.log" will be used and the file will be written
// to the application directory. // to the application directory. Also configurable using the "log-file"
// command-line switch.
/// ///
cef_string_t log_file; cef_string_t log_file;
/// ///
// The log severity. Only messages of this severity level or higher will be // The log severity. Only messages of this severity level or higher will be
// logged. // logged. Also configurable using the "log-severity" command-line switch with
// a value of "verbose", "info", "warning", "error", "error-report" or
// "disable".
/// ///
cef_log_severity_t log_severity; cef_log_severity_t log_severity;
/// ///
// Enable DCHECK in release mode to ease debugging. // Enable DCHECK in release mode to ease debugging. Also configurable using the
// "enable-release-dcheck" command-line switch.
/// ///
bool release_dcheck_enabled; bool release_dcheck_enabled;
/// ///
// Custom flags that will be used when initializing the V8 JavaScript engine. // Custom flags that will be used when initializing the V8 JavaScript engine.
// The consequences of using custom flags may not be well tested. // The consequences of using custom flags may not be well tested. Also
// configurable using the "js-flags" command-line switch.
/// ///
cef_string_t javascript_flags; cef_string_t javascript_flags;
@ -224,7 +254,8 @@ typedef struct _cef_settings_t {
// The fully qualified path for the resources directory. If this value is // The fully qualified path for the resources directory. If this value is
// empty the cef.pak and/or devtools_resources.pak files must be located in // empty the cef.pak and/or devtools_resources.pak files must be located in
// the module directory on Windows/Linux or the app bundle Resources directory // the module directory on Windows/Linux or the app bundle Resources directory
// on Mac OS X. // on Mac OS X. Also configurable using the "resources-dir-path" command-line
// switch.
/// ///
cef_string_t resources_dir_path; cef_string_t resources_dir_path;
@ -232,7 +263,8 @@ typedef struct _cef_settings_t {
// The fully qualified path for the locales directory. If this value is empty // The fully qualified path for the locales directory. If this value is empty
// the locales directory must be located in the module directory. This value // the locales directory must be located in the module directory. This value
// is ignored on Mac OS X where pack files are always loaded from the app // is ignored on Mac OS X where pack files are always loaded from the app
// bundle Resources directory. // bundle Resources directory. Also configurable using the "locales-dir-path"
// command-line switch.
/// ///
cef_string_t locales_dir_path; cef_string_t locales_dir_path;
@ -240,7 +272,8 @@ typedef struct _cef_settings_t {
// Set to true (1) to disable loading of pack files for resources and locales. // Set to true (1) to disable loading of pack files for resources and locales.
// A resource bundle handler must be provided for the browser and render // A resource bundle handler must be provided for the browser and render
// processes via CefApp::GetResourceBundleHandler() if loading of pack files // processes via CefApp::GetResourceBundleHandler() if loading of pack files
// is disabled. // is disabled. Also configurable using the "disable-pack-loading" command-
// line switch.
/// ///
bool pack_loading_disabled; bool pack_loading_disabled;
@ -248,7 +281,8 @@ typedef struct _cef_settings_t {
// Set to a value between 1024 and 65535 to enable remote debugging on the // Set to a value between 1024 and 65535 to enable remote debugging on the
// specified port. For example, if 8080 is specified the remote debugging URL // specified port. For example, if 8080 is specified the remote debugging URL
// will be http://localhost:8080. CEF can be remotely debugged from any CEF or // will be http://localhost:8080. CEF can be remotely debugged from any CEF or
// Chrome browser window. // Chrome browser window. Also configurable using the "remote-debugging-port"
// command-line switch.
/// ///
int remote_debugging_port; int remote_debugging_port;
@ -256,7 +290,8 @@ typedef struct _cef_settings_t {
// The number of stack trace frames to capture for uncaught exceptions. // The number of stack trace frames to capture for uncaught exceptions.
// Specify a positive value to enable the CefV8ContextHandler:: // Specify a positive value to enable the CefV8ContextHandler::
// OnUncaughtException() callback. Specify 0 (default value) and // OnUncaughtException() callback. Specify 0 (default value) and
// OnUncaughtException() will not be called. // OnUncaughtException() will not be called. Also configurable using the
// "uncaught-exception-stack-size" command-line switch.
/// ///
int uncaught_exception_stack_size; int uncaught_exception_stack_size;
@ -276,6 +311,9 @@ typedef struct _cef_settings_t {
// If you need better performance in the creation of V8 references and you // If you need better performance in the creation of V8 references and you
// plan to manually track context lifespan you can disable context safety by // plan to manually track context lifespan you can disable context safety by
// specifying a value of -1. // specifying a value of -1.
//
// Also configurable using the "context-safety-implementation" command-line
// switch.
/// ///
int context_safety_implementation; int context_safety_implementation;
} cef_settings_t; } cef_settings_t;
@ -284,7 +322,7 @@ typedef struct _cef_settings_t {
// Browser initialization settings. Specify NULL or 0 to get the recommended // Browser initialization settings. Specify NULL or 0 to get the recommended
// default values. The consequences of using custom values may not be well // default values. The consequences of using custom values may not be well
// tested. Many of these and other settings can also configured using command- // tested. Many of these and other settings can also configured using command-
// line flags. // line switches.
/// ///
typedef struct _cef_browser_settings_t { typedef struct _cef_browser_settings_t {
/// ///
@ -309,185 +347,174 @@ typedef struct _cef_browser_settings_t {
int minimum_logical_font_size; int minimum_logical_font_size;
/// ///
// Set to true (1) to disable loading of fonts from remote sources. // Default encoding for Web content. If empty "ISO-8859-1" will be used. Also
/// // configurable using the "default-encoding" command-line switch.
bool remote_fonts_disabled;
///
// Default encoding for Web content. If empty "ISO-8859-1" will be used.
/// ///
cef_string_t default_encoding; cef_string_t default_encoding;
/// ///
// Set to true (1) to attempt automatic detection of content encoding. // Location of the user style sheet that will be used for all pages. This must
/// // be a data URL of the form "data:text/css;charset=utf-8;base64,csscontent"
bool encoding_detector_enabled; // where "csscontent" is the base64 encoded contents of the CSS file. Also
// configurable using the "user-style-sheet-location" command-line switch.
///
// Set to true (1) to disable JavaScript.
///
bool javascript_disabled;
///
// Set to true (1) to disallow JavaScript from opening windows.
///
bool javascript_open_windows_disallowed;
///
// Set to true (1) to disallow JavaScript from closing windows.
///
bool javascript_close_windows_disallowed;
///
// Set to true (1) to disallow JavaScript from accessing the clipboard.
///
bool javascript_access_clipboard_disallowed;
///
// Set to true (1) to disable DOM pasting in the editor. DOM pasting also
// depends on |javascript_cannot_access_clipboard| being false (0).
///
bool dom_paste_disabled;
///
// Set to true (1) to enable drawing of the caret position.
///
bool caret_browsing_enabled;
///
// Set to true (1) to disable Java.
///
bool java_disabled;
///
// Set to true (1) to disable plugins.
///
bool plugins_disabled;
///
// Set to true (1) to allow access to all URLs from file URLs.
///
bool universal_access_from_file_urls_allowed;
///
// Set to true (1) to allow access to file URLs from other file URLs.
///
bool file_access_from_file_urls_allowed;
///
// Set to true (1) to allow risky security behavior such as cross-site
// scripting (XSS). Use with extreme care.
///
bool web_security_disabled;
///
// Set to true (1) to enable console warnings about XSS attempts.
///
bool xss_auditor_enabled;
///
// Set to true (1) to suppress the network load of image URLs. A cached
// image will still be rendered if requested.
///
bool image_load_disabled;
///
// Set to true (1) to shrink standalone images to fit the page.
///
bool shrink_standalone_images_to_fit;
///
// Set to true (1) to disable browser backwards compatibility features.
///
bool site_specific_quirks_disabled;
///
// Set to true (1) to disable resize of text areas.
///
bool text_area_resize_disabled;
///
// Set to true (1) to disable use of the page cache.
///
bool page_cache_disabled;
///
// Set to true (1) to not have the tab key advance focus to links.
///
bool tab_to_links_disabled;
///
// Set to true (1) to disable hyperlink pings (<a ping> and window.sendPing).
///
bool hyperlink_auditing_disabled;
///
// Set to true (1) to enable the user style sheet for all pages.
///
bool user_style_sheet_enabled;
///
// Location of the user style sheet. This must be a data URL of the form
// "data:text/css;charset=utf-8;base64,csscontent" where "csscontent" is the
// base64 encoded contents of the CSS file.
/// ///
cef_string_t user_style_sheet_location; cef_string_t user_style_sheet_location;
/// ///
// Set to true (1) to disable style sheets. // Controls the loading of fonts from remote sources. Also configurable using
// the "disable-remote-fonts" command-line switch.
/// ///
bool author_and_user_styles_disabled; cef_state_t remote_fonts;
/// ///
// Set to true (1) to disable local storage. // Controls whether JavaScript can be executed. Also configurable using the
// "disable-javascript" command-line switch.
/// ///
bool local_storage_disabled; cef_state_t javascript;
/// ///
// Set to true (1) to disable databases. // Controls whether JavaScript can be used for opening windows. Also
// configurable using the "disable-javascript-open-windows" command-line
// switch.
/// ///
bool databases_disabled; cef_state_t javascript_open_windows;
/// ///
// Set to true (1) to disable application cache. // Controls whether JavaScript can be used to close windows that were not
// opened via JavaScript. JavaScript can still be used to close windows that
// were opened via JavaScript. Also configurable using the
// "disable-javascript-close-windows" command-line switch.
/// ///
bool application_cache_disabled; cef_state_t javascript_close_windows;
/// ///
// Set to true (1) to disable WebGL. // Controls whether JavaScript can access the clipboard. Also configurable
// using the "disable-javascript-access-clipboard" command-line switch.
/// ///
bool webgl_disabled; cef_state_t javascript_access_clipboard;
/// ///
// Set to true (1) to disable accelerated compositing. // Controls whether DOM pasting is supported in the editor via
// execCommand("paste"). The |javascript_access_clipboard| setting must also
// be enabled. Also configurable using the "disable-javascript-dom-paste"
// command-line switch.
/// ///
bool accelerated_compositing_disabled; cef_state_t javascript_dom_paste;
/// ///
// Set to true (1) to disable accelerated layers. This affects features like // Controls whether the caret position will be drawn. Also configurable using
// 3D CSS transforms. // the "enable-caret-browsing" command-line switch.
/// ///
bool accelerated_layers_disabled; cef_state_t caret_browsing;
/// ///
// Set to true (1) to disable accelerated video. // Controls whether the Java plugin will be loaded. Also configurable using
// the "disable-java" command-line switch.
/// ///
bool accelerated_video_disabled; cef_state_t java;
/// ///
// Set to true (1) to disable accelerated 2d canvas. // Controls whether any plugins will be loaded. Also configurable using the
// "disable-plugins" command-line switch.
/// ///
bool accelerated_2d_canvas_disabled; cef_state_t plugins;
/// ///
// Set to true (1) to disable accelerated plugins. // Controls whether file URLs will have access to all URLs. Also configurable
// using the "allow-universal-access-from-files" command-line switch.
/// ///
bool accelerated_plugins_disabled; cef_state_t universal_access_from_file_urls;
/// ///
// Set to true (1) to disable developer tools (WebKit inspector). // Controls whether file URLs will have access to other file URLs. Also
// configurable using the "allow-access-from-files" command-line switch.
/// ///
bool developer_tools_disabled; cef_state_t file_access_from_file_urls;
///
// Controls whether web security restrictions (same-origin policy) will be
// enforced. Disabling this setting is not recommend as it will allow risky
// security behavior such as cross-site scripting (XSS). Also configurable
// using the "disable-web-security" command-line switch.
///
cef_state_t web_security;
///
// Controls whether image URLs will be loaded from the network. A cached image
// will still be rendered if requested. Also configurable using the
// "disable-image-loading" command-line switch.
///
cef_state_t image_loading;
///
// Controls whether standalone images will be shrunk to fit the page. Also
// configurable using the "image-shrink-standalone-to-fit" command-line
// switch.
///
cef_state_t image_shrink_standalone_to_fit;
///
// Controls whether text areas can be resized. Also configurable using the
// "disable-text-area-resize" command-line switch.
///
cef_state_t text_area_resize;
///
// Controls whether the fastback (back/forward) page cache will be used. Also
// configurable using the "enable-fastback" command-line switch.
///
cef_state_t page_cache;
///
// Controls whether the tab key can advance focus to links. Also configurable
// using the "disable-tab-to-links" command-line switch.
///
cef_state_t tab_to_links;
///
// Controls whether style sheets can be used. Also configurable using the
// "disable-author-and-user-styles" command-line switch.
///
cef_state_t author_and_user_styles;
///
// Controls whether local storage can be used. Also configurable using the
// "disable-local-storage" command-line switch.
///
cef_state_t local_storage;
///
// Controls whether databases can be used. Also configurable using the
// "disable-databases" command-line switch.
///
cef_state_t databases;
///
// Controls whether the application cache can be used. Also configurable using
// the "disable-application-cache" command-line switch.
///
cef_state_t application_cache;
///
// Controls whether WebGL can be used. Note that WebGL requires hardware
// support and may not work on all systems even when enabled. Also
// configurable using the "disable-webgl" command-line switch.
///
cef_state_t webgl;
///
// Controls whether content that depends on accelerated compositing can be
// used. Note that accelerated compositing requires hardware support and may
// not work on all systems even when enabled. Also configurable using the
// "disable-accelerated-compositing" command-line switch.
///
cef_state_t accelerated_compositing;
///
// Controls whether developer tools (WebKit inspector) can be used. Also
// configurable using the "disable-developer-tools" command-line switch.
///
cef_state_t developer_tools;
} cef_browser_settings_t; } cef_browser_settings_t;
/// ///

View File

@ -1,4 +1,4 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
@ -366,57 +366,40 @@ struct CefBrowserSettingsTraits {
target->default_fixed_font_size = src->default_fixed_font_size; target->default_fixed_font_size = src->default_fixed_font_size;
target->minimum_font_size = src->minimum_font_size; target->minimum_font_size = src->minimum_font_size;
target->minimum_logical_font_size = src->minimum_logical_font_size; target->minimum_logical_font_size = src->minimum_logical_font_size;
target->remote_fonts_disabled = src->remote_fonts_disabled;
cef_string_set(src->default_encoding.str, src->default_encoding.length, cef_string_set(src->default_encoding.str, src->default_encoding.length,
&target->default_encoding, copy); &target->default_encoding, copy);
target->encoding_detector_enabled = src->encoding_detector_enabled;
target->javascript_disabled = src->javascript_disabled;
target->javascript_open_windows_disallowed =
src->javascript_open_windows_disallowed;
target->javascript_close_windows_disallowed =
src->javascript_close_windows_disallowed;
target->javascript_access_clipboard_disallowed =
src->javascript_access_clipboard_disallowed;
target->dom_paste_disabled = src->dom_paste_disabled;
target->caret_browsing_enabled = src->caret_browsing_enabled;
target->java_disabled = src->java_disabled;
target->plugins_disabled = src->plugins_disabled;
target->universal_access_from_file_urls_allowed =
src->universal_access_from_file_urls_allowed;
target->file_access_from_file_urls_allowed =
src->file_access_from_file_urls_allowed;
target->web_security_disabled = src->web_security_disabled;
target->xss_auditor_enabled = src->xss_auditor_enabled;
target->image_load_disabled = src->image_load_disabled;
target->shrink_standalone_images_to_fit =
src->shrink_standalone_images_to_fit;
target->site_specific_quirks_disabled = src->site_specific_quirks_disabled;
target->text_area_resize_disabled = src->text_area_resize_disabled;
target->page_cache_disabled = src->page_cache_disabled;
target->tab_to_links_disabled = src->tab_to_links_disabled;
target->hyperlink_auditing_disabled = src->hyperlink_auditing_disabled;
target->user_style_sheet_enabled = src->user_style_sheet_enabled;
cef_string_set(src->user_style_sheet_location.str, cef_string_set(src->user_style_sheet_location.str,
src->user_style_sheet_location.length, src->user_style_sheet_location.length,
&target->user_style_sheet_location, copy); &target->user_style_sheet_location, copy);
target->author_and_user_styles_disabled = target->remote_fonts = src->remote_fonts;
src->author_and_user_styles_disabled; target->javascript = src->javascript;
target->local_storage_disabled = src->local_storage_disabled; target->javascript_open_windows = src->javascript_open_windows;
target->databases_disabled = src->databases_disabled; target->javascript_close_windows = src->javascript_close_windows;
target->application_cache_disabled = src->application_cache_disabled; target->javascript_access_clipboard = src->javascript_access_clipboard;
target->webgl_disabled = src->webgl_disabled; target->javascript_dom_paste = src->javascript_dom_paste;
target->accelerated_compositing_disabled = target->caret_browsing = src->caret_browsing;
src->accelerated_compositing_disabled; target->java = src->java;
target->accelerated_layers_disabled = src->accelerated_layers_disabled; target->plugins = src->plugins;
target->accelerated_video_disabled = src->accelerated_video_disabled; target->universal_access_from_file_urls =
target->accelerated_2d_canvas_disabled = src->universal_access_from_file_urls;
src->accelerated_2d_canvas_disabled; target->file_access_from_file_urls = src->file_access_from_file_urls;
target->accelerated_plugins_disabled = src->accelerated_plugins_disabled; target->web_security = src->web_security;
target->developer_tools_disabled = src->developer_tools_disabled; target->image_loading = src->image_loading;
target->image_shrink_standalone_to_fit =
src->image_shrink_standalone_to_fit;
target->text_area_resize = src->text_area_resize;
target->page_cache = src->page_cache;
target->tab_to_links = src->tab_to_links;
target->author_and_user_styles = src->author_and_user_styles;
target->local_storage = src->local_storage;
target->databases= src->databases;
target->application_cache = src->application_cache;
target->webgl = src->webgl;
target->accelerated_compositing = src->accelerated_compositing;
target->developer_tools = src->developer_tools;
} }
}; };

View File

@ -233,10 +233,10 @@ bool CefBrowserHost::CreateBrowser(const CefWindowInfo& windowInfo,
NOTREACHED() << "CefRenderHandler implementation is required"; NOTREACHED() << "CefRenderHandler implementation is required";
return false; return false;
} }
if (!new_settings.accelerated_compositing_disabled) { if (new_settings.accelerated_compositing != STATE_DISABLED) {
// Accelerated compositing is not supported when window rendering is // Accelerated compositing is not supported when window rendering is
// disabled. // disabled.
new_settings.accelerated_compositing_disabled = true; new_settings.accelerated_compositing = STATE_DISABLED;
} }
} }
@ -280,10 +280,10 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
NOTREACHED() << "CefRenderHandler implementation is required"; NOTREACHED() << "CefRenderHandler implementation is required";
return NULL; return NULL;
} }
if (!new_settings.accelerated_compositing_disabled) { if (new_settings.accelerated_compositing != STATE_DISABLED) {
// Accelerated compositing is not supported when window rendering is // Accelerated compositing is not supported when window rendering is
// disabled. // disabled.
new_settings.accelerated_compositing_disabled = true; new_settings.accelerated_compositing = STATE_DISABLED;
} }
} }
@ -1530,15 +1530,15 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
} }
if (IsWindowRenderingDisabled(pending_window_info_)) { if (IsWindowRenderingDisabled(pending_window_info_)) {
if (!pending_client_->GetRenderHandler().get()) { if (!pending_client_->GetRenderHandler().get()) {
NOTREACHED() << "CefRenderHandler implementation is required"; NOTREACHED() << "CefRenderHandler implementation is required";
return false; return false;
} }
if (!pending_settings_.accelerated_compositing_disabled) { if (pending_settings_.accelerated_compositing != STATE_DISABLED) {
// Accelerated compositing is not supported when window rendering is // Accelerated compositing is not supported when window rendering is
// disabled. // disabled.
pending_settings_.accelerated_compositing_disabled = true; pending_settings_.accelerated_compositing = STATE_DISABLED;
} }
} }
_Context->browser_context()->set_use_osr_next_contents_view( _Context->browser_context()->set_use_osr_next_contents_view(

View File

@ -6,15 +6,71 @@
#include <string> #include <string>
#include "libcef/common/cef_switches.h"
#include "base/command_line.h"
#include "include/internal/cef_types_wrappers.h" #include "include/internal/cef_types_wrappers.h"
#include "webkit/glue/webpreferences.h" #include "webkit/glue/webpreferences.h"
using webkit_glue::WebPreferences; using webkit_glue::WebPreferences;
// Set default preferences based on CEF command-line flags. Chromium command-
// line flags should not exist for these preferences.
void SetDefaults(WebPreferences& web) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kDefaultEncoding)) {
web.default_encoding =
command_line.GetSwitchValueASCII(switches::kDefaultEncoding);
}
if (command_line.HasSwitch(switches::kUserStyleSheetLocation)) {
web.user_style_sheet_location = GURL(
command_line.GetSwitchValueASCII(switches::kUserStyleSheetLocation));
if (!web.user_style_sheet_location.is_empty())
web.user_style_sheet_enabled = true;
}
web.javascript_can_open_windows_automatically =
!command_line.HasSwitch(switches::kDisableJavascriptOpenWindows);
web.allow_scripts_to_close_windows =
!command_line.HasSwitch(switches::kDisableJavascriptCloseWindows);
web.javascript_can_access_clipboard =
!command_line.HasSwitch(switches::kDisableJavascriptAccessClipboard);
web.dom_paste_enabled =
!command_line.HasSwitch(switches::kDisableJavascriptDomPaste);
web.caret_browsing_enabled =
command_line.HasSwitch(switches::kEnableCaretBrowsing);
web.allow_universal_access_from_file_urls =
command_line.HasSwitch(switches::kAllowUniversalAccessFromFileUrls);
web.loads_images_automatically =
!command_line.HasSwitch(switches::kDisableImageLoading);
web.shrinks_standalone_images_to_fit =
command_line.HasSwitch(switches::kImageShrinkStandaloneToFit);
web.text_areas_are_resizable =
!command_line.HasSwitch(switches::kDisableTextAreaResize);
web.tabs_to_links =
!command_line.HasSwitch(switches::kDisableTabToLinks);
web.author_and_user_styles_enabled =
!command_line.HasSwitch(switches::kDisableAuthorAndUserStyles);
web.developer_extras_enabled =
!command_line.HasSwitch(switches::kDisableDeveloperTools);
}
// Helper macro for setting a WebPreferences variable based on the value of a
// CefBrowserSettings variable.
#define SET_STATE(cef_var, web_var) \
if (cef_var == STATE_ENABLED) \
web_var = true; \
else if (cef_var == STATE_DISABLED) \
web_var = false;
// Use the preferences from WebContentsImpl::GetWebkitPrefs and the // Use the preferences from WebContentsImpl::GetWebkitPrefs and the
// WebPreferences constructor by default. Only override features that are // WebPreferences constructor by default. Only override features that are
// explicitly enabled or disabled. // explicitly enabled or disabled.
void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) { void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) {
SetDefaults(web);
if (cef.standard_font_family.length > 0) { if (cef.standard_font_family.length > 0) {
web.standard_font_family_map[WebPreferences::kCommonScript] = web.standard_font_family_map[WebPreferences::kCommonScript] =
CefString(&cef.standard_font_family); CefString(&cef.standard_font_family);
@ -48,84 +104,49 @@ void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) {
web.minimum_font_size = cef.minimum_font_size; web.minimum_font_size = cef.minimum_font_size;
if (cef.minimum_logical_font_size > 0) if (cef.minimum_logical_font_size > 0)
web.minimum_logical_font_size = cef.minimum_logical_font_size; web.minimum_logical_font_size = cef.minimum_logical_font_size;
if (cef.default_encoding.length > 0) if (cef.default_encoding.length > 0)
web.default_encoding = CefString(&cef.default_encoding); web.default_encoding = CefString(&cef.default_encoding);
if (cef.javascript_disabled) if (cef.user_style_sheet_location.length > 0) {
web.javascript_enabled = false;
if (cef.web_security_disabled)
web.web_security_enabled = false;
if (cef.javascript_open_windows_disallowed)
web.javascript_can_open_windows_automatically = false;
if (cef.image_load_disabled)
web.loads_images_automatically = false;
if (cef.plugins_disabled)
web.plugins_enabled = false;
if (cef.dom_paste_disabled)
web.dom_paste_enabled = false;
if (cef.developer_tools_disabled)
web.developer_extras_enabled = false;
if (cef.site_specific_quirks_disabled)
web.site_specific_quirks_enabled = false;
if (cef.shrink_standalone_images_to_fit)
web.shrinks_standalone_images_to_fit = true;
if (cef.encoding_detector_enabled)
web.uses_universal_detector = true;
if (cef.text_area_resize_disabled)
web.text_areas_are_resizable = false;
if (cef.java_disabled)
web.java_enabled = false;
if (cef.javascript_close_windows_disallowed)
web.allow_scripts_to_close_windows = false;
if (cef.page_cache_disabled)
web.uses_page_cache = false;
if (cef.remote_fonts_disabled)
web.remote_fonts_enabled = true;
if (cef.javascript_access_clipboard_disallowed)
web.javascript_can_access_clipboard = false;
if (cef.xss_auditor_enabled)
web.xss_auditor_enabled = true;
if (cef.local_storage_disabled)
web.local_storage_enabled = false;
if (cef.databases_disabled)
web.databases_enabled = false;
if (cef.application_cache_disabled)
web.application_cache_enabled = false;
if (cef.tab_to_links_disabled)
web.tabs_to_links = false;
if (cef.caret_browsing_enabled)
web.caret_browsing_enabled = true;
if (cef.hyperlink_auditing_disabled)
web.hyperlink_auditing_enabled = true;
if (cef.user_style_sheet_enabled &&
cef.user_style_sheet_location.length > 0) {
web.user_style_sheet_enabled = true; web.user_style_sheet_enabled = true;
web.user_style_sheet_location = web.user_style_sheet_location =
GURL(std::string(CefString(&cef.user_style_sheet_location))); GURL(CefString(&cef.user_style_sheet_location).ToString());
} }
if (cef.author_and_user_styles_disabled)
web.author_and_user_styles_enabled = false; SET_STATE(cef.remote_fonts, web.remote_fonts_enabled);
if (cef.universal_access_from_file_urls_allowed) SET_STATE(cef.javascript, web.javascript_enabled);
web.allow_universal_access_from_file_urls = true; SET_STATE(cef.javascript_open_windows,
if (cef.file_access_from_file_urls_allowed) web.javascript_can_open_windows_automatically);
web.allow_file_access_from_file_urls = true; SET_STATE(cef.javascript_close_windows, web.allow_scripts_to_close_windows);
SET_STATE(cef.javascript_access_clipboard,
web.javascript_can_access_clipboard);
SET_STATE(cef.javascript_dom_paste, web.dom_paste_enabled);
SET_STATE(cef.caret_browsing, web.caret_browsing_enabled);
SET_STATE(cef.java, web.java_enabled);
SET_STATE(cef.plugins, web.plugins_enabled);
SET_STATE(cef.universal_access_from_file_urls,
web.allow_universal_access_from_file_urls);
SET_STATE(cef.file_access_from_file_urls,
web.allow_file_access_from_file_urls);
SET_STATE(cef.web_security, web.web_security_enabled);
SET_STATE(cef.image_loading, web.loads_images_automatically);
SET_STATE(cef.image_shrink_standalone_to_fit,
web.shrinks_standalone_images_to_fit);
SET_STATE(cef.text_area_resize, web.text_areas_are_resizable);
SET_STATE(cef.page_cache, web.uses_page_cache);
SET_STATE(cef.tab_to_links, web.tabs_to_links);
SET_STATE(cef.author_and_user_styles, web.author_and_user_styles_enabled);
SET_STATE(cef.local_storage, web.local_storage_enabled);
SET_STATE(cef.databases, web.databases_enabled);
SET_STATE(cef.application_cache, web.application_cache_enabled);
// Never explicitly enable GPU-related functions in this method because the // Never explicitly enable GPU-related functions in this method because the
// GPU blacklist is not being checked here. // GPU blacklist is not being checked here.
if (cef.webgl_disabled) { if (cef.webgl == STATE_DISABLED)
web.experimental_webgl_enabled = false; web.experimental_webgl_enabled = false;
web.gl_multisampling_enabled = false; if (cef.accelerated_compositing == STATE_DISABLED)
}
if (cef.accelerated_compositing_disabled)
web.accelerated_compositing_enabled = false; web.accelerated_compositing_enabled = false;
if (cef.accelerated_layers_disabled) {
web.accelerated_compositing_for_3d_transforms_enabled = false; SET_STATE(cef.developer_tools, web.developer_extras_enabled);
web.accelerated_compositing_for_animation_enabled = false;
}
if (cef.accelerated_video_disabled)
web.accelerated_compositing_for_video_enabled = false;
if (cef.accelerated_2d_canvas_disabled)
web.accelerated_2d_canvas_enabled = false;
if (cef.accelerated_plugins_disabled)
web.accelerated_compositing_for_plugins_enabled = false;
} }

View File

@ -404,8 +404,8 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kLocalesDirPath, switches::kLocalesDirPath,
switches::kLogFile, switches::kLogFile,
switches::kLogSeverity, switches::kLogSeverity,
switches::kReleaseDcheckEnabled, switches::kEnableReleaseDcheck,
switches::kPackLoadingDisabled, switches::kDisablePackLoading,
switches::kResourcesDirPath, switches::kResourcesDirPath,
}; };
command_line->CopySwitchesFrom(browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(browser_cmd, kSwitchNames,

View File

@ -7,28 +7,28 @@
namespace switches { namespace switches {
// Log file path. // Log file path.
const char kLogFile[] = "log-file"; const char kLogFile[] = "log-file";
// Severity of messages to log. // Severity of messages to log.
const char kLogSeverity[] = "log-severity"; const char kLogSeverity[] = "log-severity";
const char kLogSeverity_Verbose[] = "verbose"; const char kLogSeverity_Verbose[] = "verbose";
const char kLogSeverity_Info[] = "info"; const char kLogSeverity_Info[] = "info";
const char kLogSeverity_Warning[] = "warning"; const char kLogSeverity_Warning[] = "warning";
const char kLogSeverity_Error[] = "error"; const char kLogSeverity_Error[] = "error";
const char kLogSeverity_ErrorReport[] = "error-report"; const char kLogSeverity_ErrorReport[] = "error-report";
const char kLogSeverity_Disable[] = "disable"; const char kLogSeverity_Disable[] = "disable";
// Enable DCHECK for release mode. // Enable DCHECK for release mode.
const char kReleaseDcheckEnabled[] = "release-dcheck-enabled"; const char kEnableReleaseDcheck[] = "enable-release-dcheck";
// Path to resources directory. // Path to resources directory.
const char kResourcesDirPath[] = "resources-dir-path"; const char kResourcesDirPath[] = "resources-dir-path";
// Path to locales directory. // Path to locales directory.
const char kLocalesDirPath[] = "locales-dir-path"; const char kLocalesDirPath[] = "locales-dir-path";
// Path to locales directory. // Path to locales directory.
const char kPackLoadingDisabled[] = "pack-loading-disabled"; const char kDisablePackLoading[] = "disable-pack-loading";
// Stack size for uncaught exceptions. // Stack size for uncaught exceptions.
const char kUncaughtExceptionStackSize[] = "uncaught-exception-stack-size"; const char kUncaughtExceptionStackSize[] = "uncaught-exception-stack-size";
@ -36,4 +36,51 @@ const char kUncaughtExceptionStackSize[] = "uncaught-exception-stack-size";
// Context safety implementation type. // Context safety implementation type.
const char kContextSafetyImplementation[] = "context-safety-implementation"; const char kContextSafetyImplementation[] = "context-safety-implementation";
// Default encoding.
const char kDefaultEncoding[] = "default-encoding";
// User style sheet location.
const char kUserStyleSheetLocation[] = "user-style-sheet-location";
// Disable opening of windows via JavaScript.
const char kDisableJavascriptOpenWindows[] =
"disable-javascript-open-windows";
// Disable closing of windows via JavaScript.
const char kDisableJavascriptCloseWindows[] =
"disable-javascript-close-windows";
// Disable clipboard access via JavaScript.
const char kDisableJavascriptAccessClipboard[] =
"disable-javascript-access-clipboard";
// Disable DOM paste via JavaScript execCommand("paste").
const char kDisableJavascriptDomPaste[] = "disable-javascript-dom-paste";
// Enable caret browsing.
const char kEnableCaretBrowsing[] = "enable-caret-browsing";
// Allow universal access from file URLs.
const char kAllowUniversalAccessFromFileUrls[] =
"allow-universal-access-from-files";
// Disable loading of images from the network. A cached image will still be
// rendered if requested.
const char kDisableImageLoading[] = "disable-image-loading";
// Shrink stand-alone images to fit.
const char kImageShrinkStandaloneToFit[] = "image-shrink-standalone-to-fit";
// Disable resizing of text areas.
const char kDisableTextAreaResize[] = "disable-text-area-resize";
// Disable using the tab key to advance focus to links.
const char kDisableTabToLinks[] = "disable-tab-to-links";
// Disable user style sheets.
const char kDisableAuthorAndUserStyles[] = "disable-author-and-user-styles";
// Disable developer tools (WebKit Inspector).
const char kDisableDeveloperTools[] = "disable-developer-tools";
} // namespace switches } // namespace switches

View File

@ -18,12 +18,26 @@ extern const char kLogSeverity_Warning[];
extern const char kLogSeverity_Error[]; extern const char kLogSeverity_Error[];
extern const char kLogSeverity_ErrorReport[]; extern const char kLogSeverity_ErrorReport[];
extern const char kLogSeverity_Disable[]; extern const char kLogSeverity_Disable[];
extern const char kReleaseDcheckEnabled[]; extern const char kEnableReleaseDcheck[];
extern const char kResourcesDirPath[]; extern const char kResourcesDirPath[];
extern const char kLocalesDirPath[]; extern const char kLocalesDirPath[];
extern const char kPackLoadingDisabled[]; extern const char kDisablePackLoading[];
extern const char kUncaughtExceptionStackSize[]; extern const char kUncaughtExceptionStackSize[];
extern const char kContextSafetyImplementation[]; extern const char kContextSafetyImplementation[];
extern const char kDefaultEncoding[];
extern const char kUserStyleSheetLocation[];
extern const char kDisableJavascriptOpenWindows[];
extern const char kDisableJavascriptCloseWindows[];
extern const char kDisableJavascriptAccessClipboard[];
extern const char kDisableJavascriptDomPaste[];
extern const char kEnableCaretBrowsing[];
extern const char kAllowUniversalAccessFromFileUrls[];
extern const char kDisableImageLoading[];
extern const char kImageShrinkStandaloneToFit[];
extern const char kDisableTextAreaResize[];
extern const char kDisableTabToLinks[];
extern const char kDisableAuthorAndUserStyles[];
extern const char kDisableDeveloperTools[];
} // namespace switches } // namespace switches

View File

@ -225,7 +225,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
} }
if (settings.release_dcheck_enabled) if (settings.release_dcheck_enabled)
command_line->AppendSwitch(switches::kReleaseDcheckEnabled); command_line->AppendSwitch(switches::kEnableReleaseDcheck);
if (settings.javascript_flags.length > 0) { if (settings.javascript_flags.length > 0) {
command_line->AppendSwitchASCII(switches::kJavaScriptFlags, command_line->AppendSwitchASCII(switches::kJavaScriptFlags,
@ -233,7 +233,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
} }
if (settings.pack_loading_disabled) { if (settings.pack_loading_disabled) {
command_line->AppendSwitch(switches::kPackLoadingDisabled); command_line->AppendSwitch(switches::kDisablePackLoading);
} else { } else {
if (settings.resources_dir_path.length > 0) { if (settings.resources_dir_path.length > 0) {
FilePath file_path = FilePath(CefString(&settings.resources_dir_path)); FilePath file_path = FilePath(CefString(&settings.resources_dir_path));
@ -315,7 +315,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
logging::DcheckState dcheck_state = logging::DcheckState dcheck_state =
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
if (command_line->HasSwitch(switches::kReleaseDcheckEnabled)) if (command_line->HasSwitch(switches::kEnableReleaseDcheck))
dcheck_state = logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; dcheck_state = logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
logging::InitLogging(log_file.value().c_str(), logging_dest, logging::InitLogging(log_file.value().c_str(), logging_dest,
@ -333,7 +333,7 @@ void CefMainDelegate::PreSandboxStartup() {
#endif #endif
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kPackLoadingDisabled)) if (command_line.HasSwitch(switches::kDisablePackLoading))
content_client_.set_pack_loading_disabled(true); content_client_.set_pack_loading_disabled(true);
InitializeResourceBundle(); InitializeResourceBundle();

View File

@ -18,19 +18,6 @@
#include "cefclient/string_util.h" #include "cefclient/string_util.h"
#include "cefclient/util.h" #include "cefclient/util.h"
namespace {
// Return the int representation of the specified string.
int GetIntValue(const CefString& str) {
if (str.empty())
return 0;
std::string stdStr = str;
return atoi(stdStr.c_str());
}
} // namespace
CefRefPtr<ClientHandler> g_handler; CefRefPtr<ClientHandler> g_handler;
CefRefPtr<CefCommandLine> g_command_line; CefRefPtr<CefCommandLine> g_command_line;
@ -61,8 +48,7 @@ CefRefPtr<CefCommandLine> AppGetCommandLine() {
} }
// Returns the application settings based on command line arguments. // Returns the application settings based on command line arguments.
void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) { void AppGetSettings(CefSettings& settings) {
ASSERT(app.get());
ASSERT(g_command_line.get()); ASSERT(g_command_line.get());
if (!g_command_line.get()) if (!g_command_line.get())
return; return;
@ -86,89 +72,6 @@ bool AppIsOffScreenRenderingEnabled() {
return g_command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled); return g_command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled);
} }
// Returns the application browser settings based on command line arguments.
void AppGetBrowserSettings(CefBrowserSettings& settings) {
ASSERT(g_command_line.get());
if (!g_command_line.get())
return;
settings.remote_fonts_disabled =
g_command_line->HasSwitch(cefclient::kRemoteFontsDisabled);
CefString(&settings.default_encoding) =
g_command_line->GetSwitchValue(cefclient::kDefaultEncoding);
settings.encoding_detector_enabled =
g_command_line->HasSwitch(cefclient::kEncodingDetectorEnabled);
settings.javascript_disabled =
g_command_line->HasSwitch(cefclient::kJavascriptDisabled);
settings.javascript_open_windows_disallowed =
g_command_line->HasSwitch(cefclient::kJavascriptOpenWindowsDisallowed);
settings.javascript_close_windows_disallowed =
g_command_line->HasSwitch(cefclient::kJavascriptCloseWindowsDisallowed);
settings.javascript_access_clipboard_disallowed =
g_command_line->HasSwitch(
cefclient::kJavascriptAccessClipboardDisallowed);
settings.dom_paste_disabled =
g_command_line->HasSwitch(cefclient::kDomPasteDisabled);
settings.caret_browsing_enabled =
g_command_line->HasSwitch(cefclient::kCaretBrowsingDisabled);
settings.java_disabled =
g_command_line->HasSwitch(cefclient::kJavaDisabled);
settings.plugins_disabled =
g_command_line->HasSwitch(cefclient::kPluginsDisabled);
settings.universal_access_from_file_urls_allowed =
g_command_line->HasSwitch(cefclient::kUniversalAccessFromFileUrlsAllowed);
settings.file_access_from_file_urls_allowed =
g_command_line->HasSwitch(cefclient::kFileAccessFromFileUrlsAllowed);
settings.web_security_disabled =
g_command_line->HasSwitch(cefclient::kWebSecurityDisabled);
settings.xss_auditor_enabled =
g_command_line->HasSwitch(cefclient::kXssAuditorEnabled);
settings.image_load_disabled =
g_command_line->HasSwitch(cefclient::kImageLoadingDisabled);
settings.shrink_standalone_images_to_fit =
g_command_line->HasSwitch(cefclient::kShrinkStandaloneImagesToFit);
settings.site_specific_quirks_disabled =
g_command_line->HasSwitch(cefclient::kSiteSpecificQuirksDisabled);
settings.text_area_resize_disabled =
g_command_line->HasSwitch(cefclient::kTextAreaResizeDisabled);
settings.page_cache_disabled =
g_command_line->HasSwitch(cefclient::kPageCacheDisabled);
settings.tab_to_links_disabled =
g_command_line->HasSwitch(cefclient::kTabToLinksDisabled);
settings.hyperlink_auditing_disabled =
g_command_line->HasSwitch(cefclient::kHyperlinkAuditingDisabled);
settings.user_style_sheet_enabled =
g_command_line->HasSwitch(cefclient::kUserStyleSheetEnabled);
CefString(&settings.user_style_sheet_location) =
g_command_line->GetSwitchValue(cefclient::kUserStyleSheetLocation);
settings.author_and_user_styles_disabled =
g_command_line->HasSwitch(cefclient::kAuthorAndUserStylesDisabled);
settings.local_storage_disabled =
g_command_line->HasSwitch(cefclient::kLocalStorageDisabled);
settings.databases_disabled =
g_command_line->HasSwitch(cefclient::kDatabasesDisabled);
settings.application_cache_disabled =
g_command_line->HasSwitch(cefclient::kApplicationCacheDisabled);
settings.webgl_disabled =
g_command_line->HasSwitch(cefclient::kWebglDisabled);
settings.accelerated_compositing_disabled =
g_command_line->HasSwitch(cefclient::kAcceleratedCompositingDisabled);
settings.accelerated_layers_disabled =
g_command_line->HasSwitch(cefclient::kAcceleratedLayersDisabled);
settings.accelerated_video_disabled =
g_command_line->HasSwitch(cefclient::kAcceleratedVideoDisabled);
settings.accelerated_2d_canvas_disabled =
g_command_line->HasSwitch(cefclient::kAcceledated2dCanvasDisabled);
settings.accelerated_plugins_disabled =
g_command_line->HasSwitch(cefclient::kAcceleratedPluginsDisabled);
settings.developer_tools_disabled =
g_command_line->HasSwitch(cefclient::kDeveloperToolsDisabled);
}
void RunGetSourceTest(CefRefPtr<CefBrowser> browser) { void RunGetSourceTest(CefRefPtr<CefBrowser> browser) {
class Visitor : public CefStringVisitor { class Visitor : public CefStringVisitor {
public: public:

View File

@ -30,10 +30,7 @@ void AppInitCommandLine(int argc, const char* const* argv);
CefRefPtr<CefCommandLine> AppGetCommandLine(); CefRefPtr<CefCommandLine> AppGetCommandLine();
// Returns the application settings based on command line arguments. // Returns the application settings based on command line arguments.
void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app); void AppGetSettings(CefSettings& settings);
// Returns the application browser settings based on command line arguments.
void AppGetBrowserSettings(CefBrowserSettings& settings);
// Returns true if off-screen rendering is enabled via the command line // Returns true if off-screen rendering is enabled via the command line
// argument. // argument.

View File

@ -350,7 +350,7 @@ int main(int argc, char* argv[]) {
CefSettings settings; CefSettings settings;
// Populate the settings based on command line arguments. // Populate the settings based on command line arguments.
AppGetSettings(settings, app); AppGetSettings(settings);
// Initialize CEF. // Initialize CEF.
CefInitialize(main_args, settings, app.get()); CefInitialize(main_args, settings, app.get());
@ -420,9 +420,6 @@ int main(int argc, char* argv[]) {
CefWindowInfo window_info; CefWindowInfo window_info;
CefBrowserSettings browserSettings; CefBrowserSettings browserSettings;
// Populate the settings based on command line arguments.
AppGetBrowserSettings(browserSettings);
window_info.SetAsChild(vbox); window_info.SetAsChild(vbox);
CefBrowserHost::CreateBrowserSync( CefBrowserHost::CreateBrowserSync(

View File

@ -369,9 +369,6 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
CefWindowInfo window_info; CefWindowInfo window_info;
CefBrowserSettings settings; CefBrowserSettings settings;
// Populate the settings based on command line arguments.
AppGetBrowserSettings(settings);
window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight); window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
CefBrowserHost::CreateBrowser(window_info, g_handler.get(), CefBrowserHost::CreateBrowser(window_info, g_handler.get(),
g_handler->GetStartupURL(), settings); g_handler->GetStartupURL(), settings);
@ -542,7 +539,7 @@ int main(int argc, char* argv[]) {
CefSettings settings; CefSettings settings;
// Populate the settings based on command line arguments. // Populate the settings based on command line arguments.
AppGetSettings(settings, app); AppGetSettings(settings);
// Initialize CEF. // Initialize CEF.
CefInitialize(main_args, settings, app.get()); CefInitialize(main_args, settings, app.get());

View File

@ -86,7 +86,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
CefSettings settings; CefSettings settings;
// Populate the settings based on command line arguments. // Populate the settings based on command line arguments.
AppGetSettings(settings, app); AppGetSettings(settings);
// Initialize CEF. // Initialize CEF.
CefInitialize(main_args, settings, app.get()); CefInitialize(main_args, settings, app.get());
@ -308,9 +308,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
CefWindowInfo info; CefWindowInfo info;
CefBrowserSettings settings; CefBrowserSettings settings;
// Populate the settings based on command line arguments.
AppGetBrowserSettings(settings);
if (AppIsOffScreenRenderingEnabled()) { if (AppIsOffScreenRenderingEnabled()) {
CefRefPtr<CefCommandLine> cmd_line = AppGetCommandLine(); CefRefPtr<CefCommandLine> cmd_line = AppGetCommandLine();
bool transparent = bool transparent =

View File

@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
@ -8,55 +8,20 @@
namespace cefclient { namespace cefclient {
const char kUrl[] = "url"; // CEF and Chromium support a wide range of command-line switches. This file
const char kExternalDevTools[] = "external-devtools"; // only contains command-line switches specific to the cefclient application.
// View CEF/Chromium documentation or search for *_switches.cc files in the
// Chromium source code to identify other existing command-line switches.
// Below is a partial listing of relevant *_switches.cc files:
// base/base_switches.cc
// cef/libcef/common/cef_switches.cc
// chrome/common/chrome_switches.cc (not all apply)
// content/public/common/content_switches.cc
// CefSettings attributes.
const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop"; const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop";
const char kCachePath[] = "cache-path"; const char kCachePath[] = "cache-path";
const char kUrl[] = "url";
// CefBrowserSettings attributes. const char kExternalDevTools[] = "external-devtools";
const char kRemoteFontsDisabled[] = "remote-fonts-disabled";
const char kDefaultEncoding[] = "default-encoding";
const char kEncodingDetectorEnabled[] = "encoding-detector-enabled";
const char kJavascriptDisabled[] = "javascript-disabled";
const char kJavascriptOpenWindowsDisallowed[] =
"javascript-open-windows-disallowed";
const char kJavascriptCloseWindowsDisallowed[] =
"javascript-close-windows-disallowed";
const char kJavascriptAccessClipboardDisallowed[] =
"javascript-access-clipboard-disallowed";
const char kDomPasteDisabled[] = "dom-paste-disabled";
const char kCaretBrowsingDisabled[] = "caret-browsing-enabled";
const char kJavaDisabled[] = "java-disabled";
const char kPluginsDisabled[] = "plugins-disabled";
const char kUniversalAccessFromFileUrlsAllowed[] =
"universal-access-from-file-urls-allowed";
const char kFileAccessFromFileUrlsAllowed[] =
"file-access-from-file-urls-allowed";
const char kWebSecurityDisabled[] = "web-security-disabled";
const char kXssAuditorEnabled[] = "xss-auditor-enabled";
const char kImageLoadingDisabled[] = "image-load-disabled";
const char kShrinkStandaloneImagesToFit[] = "shrink-standalone-images-to-fit";
const char kSiteSpecificQuirksDisabled[] = "site-specific-quirks-disabled";
const char kTextAreaResizeDisabled[] = "text-area-resize-disabled";
const char kPageCacheDisabled[] = "page-cache-disabled";
const char kTabToLinksDisabled[] = "tab-to-links-disabled";
const char kHyperlinkAuditingDisabled[] = "hyperlink-auditing-disabled";
const char kUserStyleSheetEnabled[] = "user-style-sheet-enabled";
const char kUserStyleSheetLocation[] = "user-style-sheet-location";
const char kAuthorAndUserStylesDisabled[] = "author-and-user-styles-disabled";
const char kLocalStorageDisabled[] = "local-storage-disabled";
const char kDatabasesDisabled[] = "databases-disabled";
const char kApplicationCacheDisabled[] = "application-cache-disabled";
const char kWebglDisabled[] = "webgl-disabled";
const char kAcceleratedCompositingDisabled[] =
"accelerated-compositing-disabled";
const char kAcceleratedLayersDisabled[] = "accelerated-layers-disabled";
const char kAcceleratedVideoDisabled[] = "accelerated-video-disabled";
const char kAcceledated2dCanvasDisabled[] = "accelerated-2d-canvas-disabled";
const char kAcceleratedPluginsDisabled[] = "accelerated-plugins-disabled";
const char kDeveloperToolsDisabled[] = "developer-tools-disabled";
const char kOffScreenRenderingEnabled[] = "off-screen-rendering-enabled"; const char kOffScreenRenderingEnabled[] = "off-screen-rendering-enabled";
const char kTransparentPaintingEnabled[] = "transparent-painting-enabled"; const char kTransparentPaintingEnabled[] = "transparent-painting-enabled";

View File

@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
@ -10,49 +10,10 @@
namespace cefclient { namespace cefclient {
extern const char kUrl[];
extern const char kExternalDevTools[];
// CefSettings attributes.
extern const char kMultiThreadedMessageLoop[]; extern const char kMultiThreadedMessageLoop[];
extern const char kCachePath[]; extern const char kCachePath[];
extern const char kUrl[];
// CefBrowserSettings attributes. extern const char kExternalDevTools[];
extern const char kRemoteFontsDisabled[];
extern const char kDefaultEncoding[];
extern const char kEncodingDetectorEnabled[];
extern const char kJavascriptDisabled[];
extern const char kJavascriptOpenWindowsDisallowed[];
extern const char kJavascriptCloseWindowsDisallowed[];
extern const char kJavascriptAccessClipboardDisallowed[];
extern const char kDomPasteDisabled[];
extern const char kCaretBrowsingDisabled[];
extern const char kJavaDisabled[];
extern const char kPluginsDisabled[];
extern const char kUniversalAccessFromFileUrlsAllowed[];
extern const char kFileAccessFromFileUrlsAllowed[];
extern const char kWebSecurityDisabled[];
extern const char kXssAuditorEnabled[];
extern const char kImageLoadingDisabled[];
extern const char kShrinkStandaloneImagesToFit[];
extern const char kSiteSpecificQuirksDisabled[];
extern const char kTextAreaResizeDisabled[];
extern const char kPageCacheDisabled[];
extern const char kTabToLinksDisabled[];
extern const char kHyperlinkAuditingDisabled[];
extern const char kUserStyleSheetEnabled[];
extern const char kUserStyleSheetLocation[];
extern const char kAuthorAndUserStylesDisabled[];
extern const char kLocalStorageDisabled[];
extern const char kDatabasesDisabled[];
extern const char kApplicationCacheDisabled[];
extern const char kWebglDisabled[];
extern const char kAcceleratedCompositingDisabled[];
extern const char kAcceleratedLayersDisabled[];
extern const char kAcceleratedVideoDisabled[];
extern const char kAcceledated2dCanvasDisabled[];
extern const char kAcceleratedPluginsDisabled[];
extern const char kDeveloperToolsDisabled[];
extern const char kOffScreenRenderingEnabled[]; extern const char kOffScreenRenderingEnabled[];
extern const char kTransparentPaintingEnabled[]; extern const char kTransparentPaintingEnabled[];