- Remove unimplemented and unused settings (issue #643).

- Set the kJavaScriptFlags switch based on CefSettings.javascript_flags.
- Fix indentation in CefResourceRequestJob::Start().

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@694 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-06-12 15:53:39 +00:00
parent 315414ec26
commit 85bf734046
11 changed files with 44 additions and 195 deletions

View File

@ -168,12 +168,6 @@ typedef struct _cef_settings_t {
///
cef_string_t locale;
///
// List of fully qualified paths to plugins (including plugin name) that will
// be loaded in addition to any plugins found in the default search paths.
///
cef_string_list_t extra_plugin_paths;
///
// 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
@ -187,36 +181,18 @@ typedef struct _cef_settings_t {
///
cef_log_severity_t log_severity;
///
// The graphics implementation that CEF will use for rendering GPU accelerated
// content like WebGL, accelerated layers and 3D CSS.
///
cef_graphics_implementation_t graphics_implementation;
///
// Quota limit for localStorage data across all origins. Default size is 5MB.
///
unsigned int local_storage_quota;
///
// Quota limit for sessionStorage data per namespace. Default size is 5MB.
///
unsigned int session_storage_quota;
///
// Custom flags that will be used when initializing the V8 JavaScript engine.
// The consequences of using custom flags may not be well tested.
///
cef_string_t javascript_flags;
#if defined(OS_WIN)
///
// Set to true (1) to use the system proxy resolver on Windows when
// "Automatically detect settings" is checked. This setting is disabled
// by default for performance reasons.
///
bool auto_detect_proxy_settings_enabled;
#endif
///
// The fully qualified path for the cef.pak file. If this value is empty
@ -262,21 +238,6 @@ typedef struct _cef_browser_settings_t {
///
size_t size;
///
// Disable drag & drop of URLs from other windows.
///
bool drag_drop_disabled;
///
// Disable default navigation resulting from drag & drop of URLs.
///
bool load_drops_disabled;
///
// Disable history back/forward navigation.
///
bool history_disabled;
// The below values map to WebPreferences settings.
///

View File

@ -55,14 +55,6 @@ typedef struct _cef_main_args_t {
char** argv;
} cef_main_args_t;
///
// Supported graphics implementations.
///
enum cef_graphics_implementation_t {
DESKTOP_IN_PROCESS = 0,
DESKTOP_IN_PROCESS_COMMAND_BUFFER,
};
///
// Class representing window information.
///

View File

@ -69,14 +69,6 @@ typedef struct _cef_main_args_t {
char** argv;
} cef_main_args_t;
///
// Supported graphics implementations.
///
enum cef_graphics_implementation_t {
DESKTOP_IN_PROCESS = 0,
DESKTOP_IN_PROCESS_COMMAND_BUFFER,
};
///
// Class representing window information.
///

View File

@ -54,16 +54,6 @@ typedef struct _cef_main_args_t {
HINSTANCE instance;
} cef_main_args_t;
///
// Supported graphics implementations.
///
enum cef_graphics_implementation_t {
ANGLE_IN_PROCESS = 0,
ANGLE_IN_PROCESS_COMMAND_BUFFER,
DESKTOP_IN_PROCESS,
DESKTOP_IN_PROCESS_COMMAND_BUFFER,
};
///
// Structure representing window information.
///

View File

@ -262,8 +262,6 @@ struct CefSettingsTraits {
cef_string_clear(&s->user_agent);
cef_string_clear(&s->product_version);
cef_string_clear(&s->locale);
if (s->extra_plugin_paths)
cef_string_list_free(s->extra_plugin_paths);
cef_string_clear(&s->log_file);
cef_string_clear(&s->javascript_flags);
cef_string_clear(&s->pack_file_path);
@ -287,24 +285,14 @@ struct CefSettingsTraits {
&target->product_version, copy);
cef_string_set(src->locale.str, src->locale.length, &target->locale, copy);
if (target->extra_plugin_paths)
cef_string_list_free(target->extra_plugin_paths);
target->extra_plugin_paths = src->extra_plugin_paths ?
cef_string_list_copy(src->extra_plugin_paths) : NULL;
cef_string_set(src->log_file.str, src->log_file.length, &target->log_file,
copy);
target->log_severity = src->log_severity;
target->graphics_implementation = src->graphics_implementation;
target->local_storage_quota = src->local_storage_quota;
target->session_storage_quota = src->session_storage_quota;
cef_string_set(src->javascript_flags.str, src->javascript_flags.length,
&target->javascript_flags, copy);
#if defined(OS_WIN)
target->auto_detect_proxy_settings_enabled =
src->auto_detect_proxy_settings_enabled;
#endif
cef_string_set(src->pack_file_path.str, src->pack_file_path.length,
&target->pack_file_path, copy);
@ -341,10 +329,6 @@ struct CefBrowserSettingsTraits {
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
target->drag_drop_disabled = src->drag_drop_disabled;
target->load_drops_disabled = src->load_drops_disabled;
target->history_disabled = src->history_disabled;
cef_string_set(src->standard_font_family.str,
src->standard_font_family.length, &target->standard_font_family, copy);
cef_string_set(src->fixed_font_family.str, src->fixed_font_family.length,

View File

@ -140,50 +140,50 @@ void CefResourceRequestJob::Start() {
cef_request_ = CefRequest::CreateRequest();
// Populate the request data.
static_cast<CefRequestImpl*>(cef_request_.get())->Set(request_);
// Populate the request data.
static_cast<CefRequestImpl*>(cef_request_.get())->Set(request_);
// Add default headers if not already specified.
const net::URLRequestContext* context = request_->context();
if (context) {
CefRequest::HeaderMap::const_iterator it;
CefRequest::HeaderMap headerMap;
cef_request_->GetHeaderMap(headerMap);
bool changed = false;
// Add default headers if not already specified.
const net::URLRequestContext* context = request_->context();
if (context) {
CefRequest::HeaderMap::const_iterator it;
CefRequest::HeaderMap headerMap;
cef_request_->GetHeaderMap(headerMap);
bool changed = false;
if (!context->accept_language().empty()) {
it = headerMap.find(net::HttpRequestHeaders::kAcceptLanguage);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kAcceptLanguage,
context->accept_language()));
}
changed = true;
}
if (!context->accept_charset().empty()) {
it = headerMap.find(net::HttpRequestHeaders::kAcceptCharset);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kAcceptCharset,
context->accept_charset()));
}
changed = true;
}
it = headerMap.find(net::HttpRequestHeaders::kUserAgent);
if (!context->accept_language().empty()) {
it = headerMap.find(net::HttpRequestHeaders::kAcceptLanguage);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kUserAgent,
context->GetUserAgent(request_->url())));
changed = true;
std::make_pair(net::HttpRequestHeaders::kAcceptLanguage,
context->accept_language()));
}
if (changed)
cef_request_->SetHeaderMap(headerMap);
changed = true;
}
AddCookieHeaderAndStart();
if (!context->accept_charset().empty()) {
it = headerMap.find(net::HttpRequestHeaders::kAcceptCharset);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kAcceptCharset,
context->accept_charset()));
}
changed = true;
}
it = headerMap.find(net::HttpRequestHeaders::kUserAgent);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kUserAgent,
context->GetUserAgent(request_->url())));
changed = true;
}
if (changed)
cef_request_->SetHeaderMap(headerMap);
}
AddCookieHeaderAndStart();
}
void CefResourceRequestJob::Kill() {

View File

@ -188,6 +188,11 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
CefString(&settings.locale));
}
if (settings.javascript_flags.length > 0) {
command_line->AppendSwitchASCII(switches::kJavaScriptFlags,
CefString(&settings.javascript_flags));
}
if (settings.pack_loading_disabled) {
command_line->AppendSwitch(switches::kPackLoadingDisabled);
} else {

View File

@ -106,31 +106,6 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {
}
}
{
std::string str = g_command_line->GetSwitchValue(cefclient::kGraphicsImpl);
if (!str.empty()) {
#if defined(OS_WIN)
if (str == cefclient::kGraphicsImpl_Angle)
settings.graphics_implementation = ANGLE_IN_PROCESS;
else if (str == cefclient::kGraphicsImpl_AngleCmdBuffer)
settings.graphics_implementation = ANGLE_IN_PROCESS_COMMAND_BUFFER;
else
#endif
if (str == cefclient::kGraphicsImpl_Desktop)
settings.graphics_implementation = DESKTOP_IN_PROCESS;
else if (str == cefclient::kGraphicsImpl_DesktopCmdBuffer)
settings.graphics_implementation = DESKTOP_IN_PROCESS_COMMAND_BUFFER;
}
}
settings.local_storage_quota = GetIntValue(
g_command_line->GetSwitchValue(cefclient::kLocalStorageQuota));
settings.session_storage_quota = GetIntValue(
g_command_line->GetSwitchValue(cefclient::kSessionStorageQuota));
CefString(&settings.javascript_flags) =
g_command_line->GetSwitchValue(cefclient::kJavascriptFlags);
// Retrieve command-line proxy configuration, if any.
bool has_proxy = false;
cef_proxy_type_t proxy_type = PROXY_TYPE_DIRECT;
@ -164,12 +139,6 @@ void AppGetBrowserSettings(CefBrowserSettings& settings) {
if (!g_command_line.get())
return;
settings.drag_drop_disabled =
g_command_line->HasSwitch(cefclient::kDragDropDisabled);
settings.load_drops_disabled =
g_command_line->HasSwitch(cefclient::kLoadDropsDisabled);
settings.history_disabled =
g_command_line->HasSwitch(cefclient::kHistoryDisabled);
settings.remote_fonts_disabled =
g_command_line->HasSwitch(cefclient::kRemoteFontsDisabled);

View File

@ -19,19 +19,8 @@ const char kLogSeverity_Warning[] = "warning";
const char kLogSeverity_Error[] = "error";
const char kLogSeverity_ErrorReport[] = "error-report";
const char kLogSeverity_Disable[] = "disable";
const char kGraphicsImpl[] = "graphics-implementation";
const char kGraphicsImpl_Angle[] = "angle";
const char kGraphicsImpl_AngleCmdBuffer[] = "angle-command-buffer";
const char kGraphicsImpl_Desktop[] = "desktop";
const char kGraphicsImpl_DesktopCmdBuffer[] = "desktop-command-buffer";
const char kLocalStorageQuota[] = "local-storage-quota";
const char kSessionStorageQuota[] = "session-storage-quota";
const char kJavascriptFlags[] = "javascript-flags";
// CefBrowserSettings attributes.
const char kDragDropDisabled[] = "drag-drop-disabled";
const char kLoadDropsDisabled[] = "load-drops-disabled";
const char kHistoryDisabled[] = "history-disabled";
const char kRemoteFontsDisabled[] = "remote-fonts-disabled";
const char kDefaultEncoding[] = "default-encoding";
const char kEncodingDetectorEnabled[] = "encoding-detector-enabled";

View File

@ -21,19 +21,8 @@ extern const char kLogSeverity_Warning[];
extern const char kLogSeverity_Error[];
extern const char kLogSeverity_ErrorReport[];
extern const char kLogSeverity_Disable[];
extern const char kGraphicsImpl[];
extern const char kGraphicsImpl_Angle[];
extern const char kGraphicsImpl_AngleCmdBuffer[];
extern const char kGraphicsImpl_Desktop[];
extern const char kGraphicsImpl_DesktopCmdBuffer[];
extern const char kLocalStorageQuota[];
extern const char kSessionStorageQuota[];
extern const char kJavascriptFlags[];
// CefBrowserSettings attributes.
extern const char kDragDropDisabled[];
extern const char kLoadDropsDisabled[];
extern const char kHistoryDisabled[];
extern const char kRemoteFontsDisabled[];
extern const char kDefaultEncoding[];
extern const char kEncodingDetectorEnabled[];

View File

@ -79,34 +79,12 @@ void CefTestSuite::GetSettings(CefSettings& settings) {
}
}
{
std::string str =
commandline_->GetSwitchValueASCII(cefclient::kGraphicsImpl);
if (!str.empty()) {
#if defined(OS_WIN)
if (str == cefclient::kGraphicsImpl_Angle)
settings.graphics_implementation = ANGLE_IN_PROCESS;
else if (str == cefclient::kGraphicsImpl_AngleCmdBuffer)
settings.graphics_implementation = ANGLE_IN_PROCESS_COMMAND_BUFFER;
else
#endif
if (str == cefclient::kGraphicsImpl_Desktop)
settings.graphics_implementation = DESKTOP_IN_PROCESS;
else if (str == cefclient::kGraphicsImpl_DesktopCmdBuffer)
settings.graphics_implementation = DESKTOP_IN_PROCESS_COMMAND_BUFFER;
}
}
settings.local_storage_quota = atoi(commandline_->GetSwitchValueASCII(
cefclient::kLocalStorageQuota).c_str());
settings.session_storage_quota = atoi(commandline_->GetSwitchValueASCII(
cefclient::kSessionStorageQuota).c_str());
// Always expose the V8 gc() function to give tests finer-grained control over
// memory management.
std::string javascript_flags = "--expose-gc";
// Value of kJavascriptFlags switch.
std::string other_javascript_flags =
commandline_->GetSwitchValueASCII(cefclient::kJavascriptFlags);
commandline_->GetSwitchValueASCII("js-flags");
if (!other_javascript_flags.empty())
javascript_flags += " " + other_javascript_flags;
CefString(&settings.javascript_flags) = javascript_flags;