mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-20 06:00:41 +01:00
- Support runtime configuration of renderer-related preferences (issue #1501).
- Persist modified user preferences including per-host zoom settings when a cache_path value is specified and persist_user_preferences is set to true via CefSettings or CefRequestContextSettings. - Avoid the need to duplicate files from chrome/ by having CefBrowserContext extend Chrome's Profile class.
This commit is contained in:
parent
156dc552b9
commit
c32584d266
47
cef.gyp
47
cef.gyp
@ -612,10 +612,11 @@
|
||||
'target_name': 'cef_locales',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
|
||||
'<(DEPTH)/chrome/chrome_resources.gyp:platform_locale_settings',
|
||||
'<(DEPTH)/components/components_strings.gyp:components_strings',
|
||||
'<(DEPTH)/content/app/strings/content_strings.gyp:content_strings',
|
||||
'<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings',
|
||||
'<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
|
||||
'cef_strings',
|
||||
],
|
||||
'actions': [
|
||||
@ -811,6 +812,7 @@
|
||||
'action_name': 'make_pack_strings_header',
|
||||
'variables': {
|
||||
'header_inputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/chrome/grit/platform_locale_settings.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/components/strings/grit/components_strings.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/content/app/strings/grit/content_strings.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/extensions/strings/grit/extensions_strings.h',
|
||||
@ -854,6 +856,7 @@
|
||||
'<(DEPTH)/cef/libcef/resources/grit_stub',
|
||||
'<(DEPTH)/cef/libcef/resources/grit_stub/chrome',
|
||||
'<(grit_out_dir)',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/chrome',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/components',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/resources',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/strings',
|
||||
@ -957,14 +960,12 @@
|
||||
'libcef/browser/browser_message_filter.h',
|
||||
'libcef/browser/browser_message_loop.cc',
|
||||
'libcef/browser/browser_message_loop.h',
|
||||
'libcef/browser/browser_pref_store.cc',
|
||||
'libcef/browser/browser_pref_store.h',
|
||||
'libcef/browser/browser_settings.cc',
|
||||
'libcef/browser/browser_settings.h',
|
||||
'libcef/browser/browser_urlrequest_impl.cc',
|
||||
'libcef/browser/browser_urlrequest_impl.h',
|
||||
'libcef/browser/chrome_browser_process_stub.cc',
|
||||
'libcef/browser/chrome_browser_process_stub.h',
|
||||
'libcef/browser/chrome_profile_stub.cc',
|
||||
'libcef/browser/chrome_profile_stub.h',
|
||||
'libcef/browser/chrome_scheme_handler.cc',
|
||||
'libcef/browser/chrome_scheme_handler.h',
|
||||
'libcef/browser/content_browser_client.cc',
|
||||
@ -1051,6 +1052,10 @@
|
||||
'libcef/browser/plugins/plugin_info_message_filter.h',
|
||||
'libcef/browser/plugins/plugin_service_filter.cc',
|
||||
'libcef/browser/plugins/plugin_service_filter.h',
|
||||
'libcef/browser/prefs/browser_prefs.cc',
|
||||
'libcef/browser/prefs/browser_prefs.h',
|
||||
'libcef/browser/prefs/renderer_prefs.cc',
|
||||
'libcef/browser/prefs/renderer_prefs.h',
|
||||
'libcef/browser/print_settings_impl.cc',
|
||||
'libcef/browser/print_settings_impl.h',
|
||||
'libcef/browser/printing/printing_message_filter.cc',
|
||||
@ -1223,16 +1228,10 @@
|
||||
'<(DEPTH)/chrome/common/chrome_switches.cc',
|
||||
'<(DEPTH)/chrome/common/chrome_switches.h',
|
||||
# Include sources for proxy support.
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.cc',
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.h',
|
||||
'<(DEPTH)/chrome/browser/net/proxy_service_factory.cc',
|
||||
'<(DEPTH)/chrome/browser/net/proxy_service_factory.h',
|
||||
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc',
|
||||
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h',
|
||||
'<(DEPTH)/chrome/common/pref_names.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names.h',
|
||||
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_switches.cc',
|
||||
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h',
|
||||
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc',
|
||||
@ -1357,6 +1356,32 @@
|
||||
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.h',
|
||||
'<(DEPTH)/components/nacl/common/nacl_constants.cc',
|
||||
'<(DEPTH)/components/nacl/common/nacl_constants.h',
|
||||
# Include sources for preferences support.
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.cc',
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.h',
|
||||
'<(DEPTH)/chrome/browser/accessibility/animation_policy_prefs.cc',
|
||||
'<(DEPTH)/chrome/browser/accessibility/animation_policy_prefs.h',
|
||||
'<(DEPTH)/chrome/browser/character_encoding.cc',
|
||||
'<(DEPTH)/chrome/browser/character_encoding.h',
|
||||
'<(DEPTH)/chrome/browser/defaults.cc',
|
||||
'<(DEPTH)/chrome/browser/defaults.h',
|
||||
'<(DEPTH)/chrome/browser/extensions/extension_webkit_preferences.cc',
|
||||
'<(DEPTH)/chrome/browser/extensions/extension_webkit_preferences.h',
|
||||
'<(DEPTH)/chrome/browser/font_family_cache.cc',
|
||||
'<(DEPTH)/chrome/browser/font_family_cache.h',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h',
|
||||
'<(DEPTH)/chrome/browser/renderer_preferences_util.cc',
|
||||
'<(DEPTH)/chrome/browser/renderer_preferences_util.h',
|
||||
'<(DEPTH)/chrome/browser/ui/prefs/prefs_tab_helper.cc',
|
||||
'<(DEPTH)/chrome/browser/ui/prefs/prefs_tab_helper.h',
|
||||
'<(DEPTH)/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc',
|
||||
'<(DEPTH)/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h',
|
||||
'<(DEPTH)/chrome/common/pref_font_webkit_names.h',
|
||||
'<(DEPTH)/chrome/common/pref_names.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names.h',
|
||||
'<(DEPTH)/chrome/common/pref_names_util.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names_util.h',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
|
5
cef.gypi
5
cef.gypi
@ -24,6 +24,11 @@
|
||||
# Strip symbols and create dSYM files for the Release target.
|
||||
'mac_strip_release': 1,
|
||||
}],
|
||||
['os_posix==1 and OS!="mac" and OS!="android"', {
|
||||
# Disable theme support on Linux so we don't need to implement
|
||||
# ThemeService[Factory] classes.
|
||||
'enable_themes': 0,
|
||||
}]
|
||||
]
|
||||
}, 'conditions': [
|
||||
['os_posix==1 and OS!="mac" and OS!="android"', {
|
||||
|
@ -218,15 +218,25 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
// To persist session cookies (cookies without an expiry date or validity
|
||||
// interval) by default when using the global cookie manager set this value to
|
||||
// true. Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. A |cache_path| value must also be specified
|
||||
// to enable this feature. Also configurable using the
|
||||
// true (1). Session cookies are generally intended to be transient and most
|
||||
// Web browsers do not persist them. A |cache_path| value must also be
|
||||
// specified to enable this feature. Also configurable using the
|
||||
// "persist-session-cookies" command-line switch. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.persist_session_cookies value.
|
||||
///
|
||||
int persist_session_cookies;
|
||||
|
||||
///
|
||||
// To persist user preferences as a JSON file in the cache path directory set
|
||||
// this value to true (1). A |cache_path| value must also be specified
|
||||
// to enable this feature. Also configurable using the
|
||||
// "persist-user-preferences" command-line switch. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.persist_user_preferences value.
|
||||
///
|
||||
int persist_user_preferences;
|
||||
|
||||
///
|
||||
// Value that will be returned as the User-Agent HTTP header. If empty the
|
||||
// default User-Agent string will be used. Also configurable using the
|
||||
@ -394,13 +404,21 @@ typedef struct _cef_request_context_settings_t {
|
||||
///
|
||||
// To persist session cookies (cookies without an expiry date or validity
|
||||
// interval) by default when using the global cookie manager set this value to
|
||||
// true. Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. Can be set globally using the
|
||||
// true (1). Session cookies are generally intended to be transient and most
|
||||
// Web browsers do not persist them. Can be set globally using the
|
||||
// CefSettings.persist_session_cookies value. This value will be ignored if
|
||||
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
|
||||
///
|
||||
int persist_session_cookies;
|
||||
|
||||
///
|
||||
// To persist user preferences as a JSON file in the cache path directory set
|
||||
// this value to true (1). Can be set globally using the
|
||||
// CefSettings.persist_user_preferences value. This value will be ignored if
|
||||
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
|
||||
///
|
||||
int persist_user_preferences;
|
||||
|
||||
///
|
||||
// Set to true (1) to ignore errors related to invalid SSL certificates.
|
||||
// Enabling this setting can lead to potential security vulnerabilities like
|
||||
|
@ -489,6 +489,7 @@ struct CefSettingsTraits {
|
||||
cef_string_set(src->user_data_path.str, src->user_data_path.length,
|
||||
&target->user_data_path, copy);
|
||||
target->persist_session_cookies = src->persist_session_cookies;
|
||||
target->persist_user_preferences = src->persist_user_preferences;
|
||||
|
||||
cef_string_set(src->user_agent.str, src->user_agent.length,
|
||||
&target->user_agent, copy);
|
||||
@ -541,6 +542,7 @@ struct CefRequestContextSettingsTraits {
|
||||
cef_string_set(src->cache_path.str, src->cache_path.length,
|
||||
&target->cache_path, copy);
|
||||
target->persist_session_cookies = src->persist_session_cookies;
|
||||
target->persist_user_preferences = src->persist_user_preferences;
|
||||
target->ignore_certificate_errors = src->ignore_certificate_errors;
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length, &target->accept_language_list, copy);
|
||||
|
@ -5,12 +5,15 @@
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
base::AtomicRefCount CefBrowserContext::DebugObjCt = 0;
|
||||
@ -24,16 +27,8 @@ CefBrowserContext::CefBrowserContext()
|
||||
}
|
||||
|
||||
CefBrowserContext::~CefBrowserContext() {
|
||||
if (resource_context_.get()) {
|
||||
// Destruction of the ResourceContext will trigger destruction of all
|
||||
// associated URLRequests.
|
||||
content::BrowserThread::DeleteSoon(
|
||||
content::BrowserThread::IO, FROM_HERE, resource_context_.release());
|
||||
}
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
this);
|
||||
// Should be cleared in Shutdown().
|
||||
DCHECK(!resource_context_.get());
|
||||
|
||||
#ifndef NDEBUG
|
||||
base::AtomicRefCountDec(&DebugObjCt);
|
||||
@ -68,6 +63,27 @@ void CefBrowserContext::Initialize() {
|
||||
extension_system_->Init();
|
||||
}
|
||||
|
||||
void CefBrowserContext::Shutdown() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (resource_context_.get()) {
|
||||
// Destruction of the ResourceContext will trigger destruction of all
|
||||
// associated URLRequests.
|
||||
content::BrowserThread::DeleteSoon(
|
||||
content::BrowserThread::IO, FROM_HERE, resource_context_.release());
|
||||
}
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations. This must be
|
||||
// called before the ProxyService owned by CefBrowserContextImpl is destroyed.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
this);
|
||||
}
|
||||
|
||||
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
||||
return resource_context_.get();
|
||||
}
|
||||
|
||||
ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
|
||||
return static_cast<ChromeZoomLevelPrefs*>(
|
||||
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "libcef/browser/chrome_profile_stub.h"
|
||||
#include "libcef/browser/resource_context.h"
|
||||
#include "libcef/browser/url_request_context_getter_impl.h"
|
||||
|
||||
@ -115,7 +116,7 @@ class CefExtensionSystem;
|
||||
// of this class is passed to WebContents::Create in CefBrowserHostImpl::
|
||||
// CreateInternal. Only accessed on the UI thread unless otherwise indicated.
|
||||
class CefBrowserContext
|
||||
: public content::BrowserContext,
|
||||
: public ChromeProfileStub,
|
||||
public base::RefCountedThreadSafe<
|
||||
CefBrowserContext, content::BrowserThread::DeleteOnUIThread> {
|
||||
public:
|
||||
@ -127,6 +128,9 @@ class CefBrowserContext
|
||||
// BrowserContext methods.
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
|
||||
// Profile methods.
|
||||
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
|
||||
|
||||
// Returns the settings associated with this object. Safe to call from any
|
||||
// thread.
|
||||
virtual const CefRequestContextSettings& GetSettings() const = 0;
|
||||
@ -148,9 +152,6 @@ class CefBrowserContext
|
||||
// Settings for plugins and extensions.
|
||||
virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
|
||||
|
||||
// Preferences.
|
||||
virtual PrefService* GetPrefs() = 0;
|
||||
|
||||
CefResourceContext* resource_context() const {
|
||||
return resource_context_.get();
|
||||
}
|
||||
@ -166,6 +167,9 @@ class CefBrowserContext
|
||||
protected:
|
||||
~CefBrowserContext() override;
|
||||
|
||||
// Must be called before the child object destructor has completed.
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
// Only allow deletion via scoped_refptr().
|
||||
friend struct content::BrowserThread::DeleteOnThread<
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/permission_manager.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
@ -22,9 +23,12 @@
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "chrome/browser/net/proxy_service_factory.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/guest_view/browser/guest_view_manager.h"
|
||||
#include "components/ui/zoom/zoom_event_manager.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
@ -131,6 +135,12 @@ CefBrowserContextImpl::CefBrowserContextImpl(
|
||||
}
|
||||
|
||||
CefBrowserContextImpl::~CefBrowserContextImpl() {
|
||||
Shutdown();
|
||||
|
||||
// The FontFamilyCache references the ProxyService so delete it before the
|
||||
// ProxyService is deleted.
|
||||
SetUserData(&kFontFamilyCacheKey, NULL);
|
||||
|
||||
pref_proxy_config_tracker_->DetachFromPrefService();
|
||||
|
||||
if (host_content_settings_map_.get())
|
||||
@ -166,10 +176,11 @@ void CefBrowserContextImpl::Initialize() {
|
||||
CefString(&CefContext::Get()->settings().accept_language_list);
|
||||
}
|
||||
|
||||
// Initialize user preferences.
|
||||
pref_store_ = new CefBrowserPrefStore();
|
||||
pref_store_->SetInitializationCompleted();
|
||||
pref_service_ = pref_store_->CreateService().Pass();
|
||||
// Initialize preferences.
|
||||
base::FilePath pref_path;
|
||||
if (!cache_path_.empty() && settings_.persist_user_preferences)
|
||||
pref_path = cache_path_.AppendASCII(browser_prefs::kUserPrefsFileName);
|
||||
pref_service_ = browser_prefs::CreatePrefService(pref_path);
|
||||
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
@ -239,8 +250,14 @@ base::FilePath CefBrowserContextImpl::GetPath() const {
|
||||
}
|
||||
|
||||
scoped_ptr<content::ZoomLevelDelegate>
|
||||
CefBrowserContextImpl::CreateZoomLevelDelegate(const base::FilePath&) {
|
||||
return scoped_ptr<content::ZoomLevelDelegate>();
|
||||
CefBrowserContextImpl::CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) {
|
||||
if (cache_path_.empty())
|
||||
return scoped_ptr<content::ZoomLevelDelegate>();
|
||||
|
||||
return make_scoped_ptr(new ChromeZoomLevelPrefs(
|
||||
GetPrefs(), cache_path_, partition_path,
|
||||
ui_zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool CefBrowserContextImpl::IsOffTheRecord() const {
|
||||
@ -313,6 +330,14 @@ content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
|
||||
return permission_manager_.get();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextImpl::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextImpl::GetPrefs() const {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
|
||||
return settings_;
|
||||
}
|
||||
@ -380,7 +405,3 @@ HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
|
||||
}
|
||||
return host_content_settings_map_.get();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextImpl::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "libcef/browser/browser_pref_store.h"
|
||||
#include "libcef/browser/url_request_context_getter_impl.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
@ -16,11 +15,6 @@
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
|
||||
namespace content {
|
||||
class DownloadManagerDelegate;
|
||||
class SpeechRecognitionPreferences;
|
||||
}
|
||||
|
||||
class CefBrowserContextProxy;
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefSSLHostStateDelegate;
|
||||
@ -75,6 +69,10 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
const PrefService* GetPrefs() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
const CefRequestContextSettings& GetSettings() const override;
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||
@ -89,7 +87,6 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||
override;
|
||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||
PrefService* GetPrefs() override;
|
||||
|
||||
// Guaranteed to exist once this object has been initialized.
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context() const {
|
||||
@ -112,7 +109,6 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
typedef std::vector<const CefBrowserContextProxy*> ProxyList;
|
||||
ProxyList proxy_list_;
|
||||
|
||||
scoped_refptr<CefBrowserPrefStore> pref_store_;
|
||||
scoped_ptr<PrefService> pref_service_;
|
||||
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "libcef/browser/url_request_context_getter_proxy.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "components/guest_view/common/guest_view_constants.h"
|
||||
#include "content/browser/streams/stream_context.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
@ -27,6 +28,12 @@ bool ShouldProxyUserData(const void* key) {
|
||||
if (key == guest_view::kGuestViewManagerKeyName)
|
||||
return true;
|
||||
|
||||
// If this value is not proxied then there will be a use-after-free while
|
||||
// destroying the FontFamilyCache because it will try to access the
|
||||
// ProxyService owned by CefBrowserContextImpl (which has already been freed).
|
||||
if (key == kFontFamilyCacheKey)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -43,6 +50,8 @@ CefBrowserContextProxy::CefBrowserContextProxy(
|
||||
}
|
||||
|
||||
CefBrowserContextProxy::~CefBrowserContextProxy() {
|
||||
Shutdown();
|
||||
|
||||
parent_->RemoveProxy(this);
|
||||
}
|
||||
|
||||
@ -142,6 +151,14 @@ content::PermissionManager* CefBrowserContextProxy::GetPermissionManager() {
|
||||
return parent_->GetPermissionManager();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextProxy::GetPrefs() const {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
|
||||
return parent_->GetSettings();
|
||||
}
|
||||
@ -173,7 +190,3 @@ net::URLRequestContextGetter*
|
||||
HostContentSettingsMap* CefBrowserContextProxy::GetHostContentSettingsMap() {
|
||||
return parent_->GetHostContentSettingsMap();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
@ -13,11 +13,6 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
namespace content {
|
||||
class DownloadManagerDelegate;
|
||||
class SpeechRecognitionPreferences;
|
||||
}
|
||||
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefURLRequestContextGetterProxy;
|
||||
|
||||
@ -56,6 +51,10 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
const PrefService* GetPrefs() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
const CefRequestContextSettings& GetSettings() const override;
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||
@ -70,7 +69,6 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||
override;
|
||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||
PrefService* GetPrefs() override;
|
||||
|
||||
scoped_refptr<CefBrowserContextImpl> parent() const {
|
||||
return parent_;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_pref_store.h"
|
||||
#include "libcef/browser/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
@ -40,6 +39,7 @@
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/common/view_messages.h"
|
||||
@ -3039,6 +3039,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
CefString(), CefString(),
|
||||
CefFrameHostImpl::kInvalidFrameId);
|
||||
|
||||
PrefsTabHelper::CreateForWebContents(web_contents_.get());
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents_.get());
|
||||
|
||||
// Make sure RenderViewCreated is called at least one time.
|
||||
|
@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2013 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_
|
||||
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/prefs/testing_pref_store.h"
|
||||
|
||||
class PrefService;
|
||||
|
||||
class CefBrowserPrefStore : public TestingPrefStore {
|
||||
public:
|
||||
CefBrowserPrefStore();
|
||||
|
||||
scoped_ptr<PrefService> CreateService();
|
||||
|
||||
protected:
|
||||
~CefBrowserPrefStore() override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserPrefStore);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_
|
@ -1,128 +0,0 @@
|
||||
// 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/browser_settings.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
|
||||
// Set default preferences based on CEF command-line flags. Chromium command-
|
||||
// line flags should not exist for these preferences.
|
||||
void SetDefaults(content::WebPreferences& web) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
if (command_line->HasSwitch(switches::kDefaultEncoding)) {
|
||||
web.default_encoding =
|
||||
command_line->GetSwitchValueASCII(switches::kDefaultEncoding);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 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
|
||||
// WebPreferences constructor by default. Only override features that are
|
||||
// explicitly enabled or disabled.
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web) {
|
||||
SetDefaults(web);
|
||||
|
||||
if (cef.standard_font_family.length > 0) {
|
||||
web.standard_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.standard_font_family);
|
||||
}
|
||||
if (cef.fixed_font_family.length > 0) {
|
||||
web.fixed_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fixed_font_family);
|
||||
}
|
||||
if (cef.serif_font_family.length > 0) {
|
||||
web.serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.serif_font_family);
|
||||
}
|
||||
if (cef.sans_serif_font_family.length > 0) {
|
||||
web.sans_serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.sans_serif_font_family);
|
||||
}
|
||||
if (cef.cursive_font_family.length > 0) {
|
||||
web.cursive_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.cursive_font_family);
|
||||
}
|
||||
if (cef.fantasy_font_family.length > 0) {
|
||||
web.fantasy_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fantasy_font_family);
|
||||
}
|
||||
|
||||
if (cef.default_font_size > 0)
|
||||
web.default_font_size = cef.default_font_size;
|
||||
if (cef.default_fixed_font_size > 0)
|
||||
web.default_fixed_font_size = cef.default_fixed_font_size;
|
||||
if (cef.minimum_font_size > 0)
|
||||
web.minimum_font_size = cef.minimum_font_size;
|
||||
if (cef.minimum_logical_font_size > 0)
|
||||
web.minimum_logical_font_size = cef.minimum_logical_font_size;
|
||||
|
||||
if (cef.default_encoding.length > 0)
|
||||
web.default_encoding = CefString(&cef.default_encoding);
|
||||
|
||||
SET_STATE(cef.remote_fonts, web.remote_fonts_enabled);
|
||||
SET_STATE(cef.javascript, web.javascript_enabled);
|
||||
SET_STATE(cef.javascript_open_windows,
|
||||
web.javascript_can_open_windows_automatically);
|
||||
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.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.tab_to_links, web.tabs_to_links);
|
||||
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
|
||||
// GPU blacklist is not being checked here.
|
||||
if (cef.webgl == STATE_DISABLED)
|
||||
web.experimental_webgl_enabled = false;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
namespace content {
|
||||
struct WebPreferences;
|
||||
}
|
||||
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web);
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
@ -12,8 +12,8 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
// This file provides a stub implementation of chrome::BrowserProcess so that
|
||||
// PrintJobWorker can determine the current locale.
|
||||
// This file provides a stub implementation of Chrome's BrowserProcess object
|
||||
// for use as an interop layer between CEF and files that live in chrome/.
|
||||
|
||||
class BackgroundModeManager {
|
||||
public:
|
||||
|
222
libcef/browser/chrome_profile_stub.cc
Normal file
222
libcef/browser/chrome_profile_stub.cc
Normal file
@ -0,0 +1,222 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2012 The Chromium 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/chrome_profile_stub.h"
|
||||
|
||||
// Profile implementation.
|
||||
// Based on chrome/browser/profiles/profile.cc.
|
||||
|
||||
Profile::Profile() {
|
||||
}
|
||||
|
||||
Profile::~Profile() {
|
||||
}
|
||||
|
||||
// static
|
||||
Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) {
|
||||
// This is safe; this is the only implementation of the browser context.
|
||||
return static_cast<Profile*>(browser_context);
|
||||
}
|
||||
|
||||
// static
|
||||
Profile* Profile::FromWebUI(content::WebUI* web_ui) {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TestingProfile* Profile::AsTestingProfile() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ChromeZoomLevelPrefs* Profile::GetZoomLevelPrefs() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// static
|
||||
void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::string Profile::GetDebugName() {
|
||||
NOTIMPLEMENTED();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
bool Profile::IsGuestSession() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Profile::IsSystemProfile() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Profile::IsNewProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Profile::IsSyncAllowed() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Profile::MaybeSendDestroyedNotification() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ProfileCompare::operator()(Profile* a, Profile* b) const {
|
||||
DCHECK(a && b);
|
||||
if (a->IsSameProfile(b))
|
||||
return false;
|
||||
return a->GetOriginalProfile() < b->GetOriginalProfile();
|
||||
}
|
||||
|
||||
double Profile::GetDefaultZoomLevelForProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// ChromeProfileStub implementation.
|
||||
|
||||
ChromeProfileStub::ChromeProfileStub(){
|
||||
}
|
||||
|
||||
ChromeProfileStub::~ChromeProfileStub() {
|
||||
}
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
||||
NOTIMPLEMENTED();
|
||||
return scoped_refptr<base::SequencedTaskRunner>();
|
||||
}
|
||||
|
||||
std::string ChromeProfileStub::GetProfileUserName() const {
|
||||
NOTIMPLEMENTED();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
Profile::ProfileType ChromeProfileStub::GetProfileType() const {
|
||||
NOTIMPLEMENTED();
|
||||
return REGULAR_PROFILE;
|
||||
}
|
||||
|
||||
Profile* ChromeProfileStub::GetOffTheRecordProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
Profile* ChromeProfileStub::GetOriginalProfile() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSupervised() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsChild() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsLegacySupervised() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
ExtensionSpecialStoragePolicy*
|
||||
ChromeProfileStub::GetExtensionSpecialStoragePolicy() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PrefService* ChromeProfileStub::GetOffTheRecordPrefs() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
ChromeProfileStub::GetRequestContextForExtensions() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net::SSLConfigService* ChromeProfileStub::GetSSLConfigService() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
base::Time ChromeProfileStub::GetStartTime() const {
|
||||
NOTIMPLEMENTED();
|
||||
return base::Time();
|
||||
}
|
||||
|
||||
base::FilePath ChromeProfileStub::last_selected_directory() {
|
||||
NOTIMPLEMENTED();
|
||||
return base::FilePath();
|
||||
}
|
||||
|
||||
void ChromeProfileStub::set_last_selected_directory(
|
||||
const base::FilePath& path) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
PrefProxyConfigTracker* ChromeProfileStub::GetProxyConfigTracker() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DevToolsNetworkControllerHandle*
|
||||
ChromeProfileStub::GetDevToolsNetworkControllerHandle() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::ClearNetworkingHistorySince(
|
||||
base::Time time,
|
||||
const base::Closure& completion) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
GURL ChromeProfileStub::GetHomePage() {
|
||||
NOTIMPLEMENTED();
|
||||
return GURL();
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::WasCreatedByVersionOrLater(
|
||||
const std::string& version) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::SetExitType(ExitType exit_type) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
Profile::ExitType ChromeProfileStub::GetLastSessionExitType() {
|
||||
NOTIMPLEMENTED();
|
||||
return EXIT_NORMAL;
|
||||
}
|
57
libcef/browser/chrome_profile_stub.h
Normal file
57
libcef/browser/chrome_profile_stub.h
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This class gathers state related to a single user profile.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_
|
||||
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
|
||||
// This file provides a stub implementation of Chrome's Profile object for use
|
||||
// as an interop layer between CEF and files that live in chrome/.
|
||||
|
||||
class ChromeProfileStub : public Profile {
|
||||
public:
|
||||
ChromeProfileStub();
|
||||
~ChromeProfileStub() override;
|
||||
|
||||
protected:
|
||||
// Profile methods.
|
||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||
std::string GetProfileUserName() const override;
|
||||
ProfileType GetProfileType() const override;
|
||||
Profile* GetOffTheRecordProfile() override;
|
||||
void DestroyOffTheRecordProfile() override;
|
||||
bool HasOffTheRecordProfile() override;
|
||||
Profile* GetOriginalProfile() override;
|
||||
bool IsSupervised() const override;
|
||||
bool IsChild() const override;
|
||||
bool IsLegacySupervised() const override;
|
||||
ExtensionSpecialStoragePolicy*
|
||||
GetExtensionSpecialStoragePolicy() override;
|
||||
PrefService* GetOffTheRecordPrefs() override;
|
||||
net::URLRequestContextGetter* GetRequestContextForExtensions() override;
|
||||
net::SSLConfigService* GetSSLConfigService() override;
|
||||
bool IsSameProfile(Profile* profile) override;
|
||||
base::Time GetStartTime() const override;
|
||||
base::FilePath last_selected_directory() override;
|
||||
void set_last_selected_directory(const base::FilePath& path) override;
|
||||
PrefProxyConfigTracker* GetProxyConfigTracker() override;
|
||||
chrome_browser_net::Predictor* GetNetworkPredictor() override;
|
||||
DevToolsNetworkControllerHandle*
|
||||
GetDevToolsNetworkControllerHandle() override;
|
||||
void ClearNetworkingHistorySince(base::Time time,
|
||||
const base::Closure& completion) override;
|
||||
GURL GetHomePage() override;
|
||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||
void SetExitType(ExitType exit_type) override;
|
||||
ExitType GetLastSessionExitType() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_
|
@ -10,7 +10,6 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/browser_main.h"
|
||||
#include "libcef/browser/browser_message_filter.h"
|
||||
#include "libcef/browser/browser_settings.h"
|
||||
#include "libcef/browser/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_delegate.h"
|
||||
@ -20,6 +19,7 @@
|
||||
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/browser/printing/printing_message_filter.h"
|
||||
#include "libcef/browser/resource_dispatcher_host_delegate.h"
|
||||
#include "libcef/browser/speech_recognition_manager_delegate.h"
|
||||
@ -1004,24 +1004,10 @@ void CefContentBrowserClient::ResourceDispatcherHostCreated() {
|
||||
void CefContentBrowserClient::OverrideWebkitPrefs(
|
||||
content::RenderViewHost* rvh,
|
||||
content::WebPreferences* prefs) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
extensions::GetOwnerBrowserForHost(rvh);
|
||||
if (browser.get()) {
|
||||
// Populate WebPreferences based on CefBrowserSettings.
|
||||
BrowserToWebSettings(browser->settings(), *prefs);
|
||||
}
|
||||
|
||||
prefs->base_background_color = GetBaseBackgroundColor(browser);
|
||||
if (rvh->GetView())
|
||||
rvh->GetView()->SetBackgroundColor(prefs->base_background_color);
|
||||
|
||||
prefs->asynchronous_spell_checking_enabled = true;
|
||||
// Auto-correct does not work in combination with the unified text checker.
|
||||
prefs->unified_textchecker_enabled =
|
||||
!command_line->HasSwitch(switches::kEnableSpellingAutoCorrect);
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
||||
@ -1161,27 +1147,3 @@ CefContentBrowserClient::browser_context() const {
|
||||
CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {
|
||||
return browser_main_parts_->devtools_delegate();
|
||||
}
|
||||
|
||||
// static
|
||||
SkColor CefContentBrowserClient::GetBaseBackgroundColor(
|
||||
CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
if (browser.get()) {
|
||||
const CefBrowserSettings& browser_settings = browser->settings();
|
||||
if (CefColorGetA(browser_settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(browser_settings.background_color),
|
||||
CefColorGetG(browser_settings.background_color),
|
||||
CefColorGetB(browser_settings.background_color));
|
||||
}
|
||||
}
|
||||
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
}
|
||||
|
||||
return SK_ColorWHITE;
|
||||
}
|
||||
|
@ -170,8 +170,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
CefDevToolsDelegate* devtools_delegate() const;
|
||||
|
||||
private:
|
||||
static SkColor GetBaseBackgroundColor(CefRefPtr<CefBrowserHostImpl> browser);
|
||||
|
||||
CefBrowserMainParts* browser_main_parts_;
|
||||
|
||||
scoped_ptr<content::PluginServiceFilter> plugin_service_filter_;
|
||||
|
@ -360,6 +360,9 @@ void CefContext::PopulateRequestContextSettings(
|
||||
settings->persist_session_cookies =
|
||||
settings_.persist_session_cookies ||
|
||||
command_line->HasSwitch(switches::kPersistSessionCookies);
|
||||
settings->persist_user_preferences =
|
||||
settings_.persist_user_preferences ||
|
||||
command_line->HasSwitch(switches::kPersistUserPreferences);
|
||||
settings->ignore_certificate_errors =
|
||||
settings_.ignore_certificate_errors ||
|
||||
command_line->HasSwitch(switches::kIgnoreCertificateErrors);
|
||||
|
@ -6,12 +6,14 @@
|
||||
|
||||
#include "libcef/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
PrefsTabHelper::GetServiceInstance();
|
||||
RendererStartupHelperFactory::GetInstance();
|
||||
StreamsPrivateAPI::GetFactoryInstance();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/extensions/pdf_web_contents_helper_client.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||
|
||||
namespace extensions {
|
||||
@ -33,6 +34,7 @@ CefExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||
|
||||
void CefExtensionsAPIClient::AttachWebContentsHelpers(
|
||||
content::WebContents* web_contents) const {
|
||||
PrefsTabHelper::CreateForWebContents(web_contents);
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents);
|
||||
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
|
||||
web_contents,
|
||||
|
@ -2,15 +2,20 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/browser_pref_store.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/prefs/json_pref_store.h"
|
||||
#include "base/prefs/pref_filter.h"
|
||||
#include "base/prefs/pref_registry_simple.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/prefs/pref_service_factory.h"
|
||||
#include "base/prefs/pref_registry_simple.h"
|
||||
#include "base/prefs/testing_pref_store.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/prefs/command_line_pref_store.h"
|
||||
@ -20,10 +25,13 @@
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
||||
#include "components/proxy_config/proxy_config_dictionary.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "extensions/browser/extension_prefs.h"
|
||||
#include "grit/cef_strings.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
namespace browser_prefs {
|
||||
|
||||
namespace {
|
||||
|
||||
// A helper function for registering localized values.
|
||||
@ -73,31 +81,56 @@ void RegisterLocalizedValue(PrefRegistrySimple* registry,
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserPrefStore::CefBrowserPrefStore() {
|
||||
}
|
||||
const char kUserPrefsFileName[] = "UserPrefs.json";
|
||||
|
||||
scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() {
|
||||
scoped_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
base::PrefServiceFactory factory;
|
||||
factory.set_command_line_prefs(
|
||||
new CommandLinePrefStore(command_line));
|
||||
factory.set_user_prefs(this);
|
||||
|
||||
// Used to store command-line preferences, most of which will be evaluated in
|
||||
// the CommandLinePrefStore constructor. Preferences set in this manner cannot
|
||||
// be overridden by the user.
|
||||
scoped_refptr<CommandLinePrefStore> command_line_pref_store(
|
||||
new CommandLinePrefStore(command_line));
|
||||
renderer_prefs::SetCommandLinePrefDefaults(command_line_pref_store.get());
|
||||
factory.set_command_line_prefs(command_line_pref_store);
|
||||
|
||||
// Used to store user preferences.
|
||||
scoped_refptr<PersistentPrefStore> user_pref_store;
|
||||
if (!pref_path.empty()) {
|
||||
// Store preferences on disk.
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner =
|
||||
JsonPrefStore::GetTaskRunnerForFile(
|
||||
pref_path,
|
||||
content::BrowserThread::GetBlockingPool());
|
||||
scoped_refptr<JsonPrefStore> json_pref_store =
|
||||
new JsonPrefStore(pref_path, task_runner, scoped_ptr<PrefFilter>());
|
||||
factory.set_user_prefs(json_pref_store.get());
|
||||
} else {
|
||||
// Store preferences in memory.
|
||||
scoped_refptr<TestingPrefStore> testing_pref_store = new TestingPrefStore();
|
||||
testing_pref_store->SetInitializationCompleted();
|
||||
factory.set_user_prefs(testing_pref_store.get());
|
||||
}
|
||||
|
||||
// Registry that will be populated with all known preferences. Preferences
|
||||
// are registered with default values that may be changed via a *PrefStore.
|
||||
scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
|
||||
new user_prefs::PrefRegistrySyncable());
|
||||
|
||||
// Default settings.
|
||||
// Default preferences.
|
||||
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
||||
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
||||
renderer_prefs::RegisterProfilePrefs(registry.get());
|
||||
|
||||
// Print settings.
|
||||
// Print preferences.
|
||||
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
|
||||
|
||||
// Spell checking settings.
|
||||
// Spell checking preferences.
|
||||
// Based on SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
registry->RegisterListPref(prefs::kSpellCheckDictionaries,
|
||||
new base::ListValue);
|
||||
@ -119,18 +152,18 @@ scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() {
|
||||
registry->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect,
|
||||
command_line->HasSwitch(switches::kEnableSpellingAutoCorrect));
|
||||
|
||||
// Pepper flash settings.
|
||||
// Pepper flash preferences.
|
||||
// Based on DeviceIDFetcher::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kEnableDRM, false);
|
||||
registry->RegisterStringPref(prefs::kDRMSalt, "");
|
||||
|
||||
// Plugin settings.
|
||||
// Plugin preferences.
|
||||
// Based on chrome::RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false);
|
||||
registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false);
|
||||
|
||||
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
|
||||
// Register preferences used with unit tests.
|
||||
// Preferences used with unit tests.
|
||||
registry->RegisterBooleanPref("test.bool", true);
|
||||
registry->RegisterIntegerPref("test.int", 2);
|
||||
registry->RegisterDoublePref("test.double", 5.0);
|
||||
@ -139,8 +172,8 @@ scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() {
|
||||
registry->RegisterDictionaryPref("test.dict");
|
||||
}
|
||||
|
||||
// Build the PrefService that manages the PrefRegistry and PrefStores.
|
||||
return factory.Create(registry.get());
|
||||
}
|
||||
|
||||
CefBrowserPrefStore::~CefBrowserPrefStore() {
|
||||
}
|
||||
} // namespace browser_prefs
|
26
libcef/browser/prefs/browser_prefs.h
Normal file
26
libcef/browser/prefs/browser_prefs.h
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2013 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_
|
||||
#define CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_
|
||||
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
class PrefService;
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
}
|
||||
|
||||
namespace browser_prefs {
|
||||
|
||||
// Name for the user prefs JSON file.
|
||||
extern const char kUserPrefsFileName[];
|
||||
|
||||
// Create the PrefService used to manage pref registration and storage.
|
||||
scoped_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path);
|
||||
|
||||
} // namespace browser_prefs
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_
|
393
libcef/browser/prefs/renderer_prefs.cc
Normal file
393
libcef/browser/prefs/renderer_prefs.cc
Normal file
@ -0,0 +1,393 @@
|
||||
// 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/prefs/renderer_prefs.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/prefs/pref_store.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/accessibility/animation_policy_prefs.h"
|
||||
#include "chrome/browser/character_encoding.h"
|
||||
#include "chrome/browser/defaults.h"
|
||||
#include "chrome/browser/extensions/extension_webkit_preferences.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "chrome/browser/prefs/command_line_pref_store.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/site_instance.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/view_type_utils.h"
|
||||
#include "extensions/common/constants.h"
|
||||
|
||||
namespace renderer_prefs {
|
||||
|
||||
namespace {
|
||||
|
||||
// Set default values based on CEF command-line flags for preferences that are
|
||||
// not available via the PrefService. Chromium command-line flags should not
|
||||
// exist for these preferences.
|
||||
void SetDefaultPrefs(content::WebPreferences& web) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
web.allow_scripts_to_close_windows =
|
||||
!command_line->HasSwitch(switches::kDisableJavascriptCloseWindows);
|
||||
web.javascript_can_access_clipboard =
|
||||
!command_line->HasSwitch(switches::kDisableJavascriptAccessClipboard);
|
||||
web.caret_browsing_enabled =
|
||||
command_line->HasSwitch(switches::kEnableCaretBrowsing);
|
||||
web.allow_universal_access_from_file_urls =
|
||||
command_line->HasSwitch(switches::kAllowUniversalAccessFromFileUrls);
|
||||
web.shrinks_standalone_images_to_fit =
|
||||
command_line->HasSwitch(switches::kImageShrinkStandaloneToFit);
|
||||
web.text_areas_are_resizable =
|
||||
!command_line->HasSwitch(switches::kDisableTextAreaResize);
|
||||
|
||||
web.asynchronous_spell_checking_enabled = true;
|
||||
// Auto-correct does not work in combination with the unified text checker.
|
||||
web.unified_textchecker_enabled =
|
||||
!command_line->HasSwitch(switches::kEnableSpellingAutoCorrect);
|
||||
}
|
||||
|
||||
// Chrome preferences.
|
||||
// Should match ChromeContentBrowserClient::OverrideWebkitPrefs.
|
||||
void SetChromePrefs(CefBrowserContext* profile,
|
||||
content::WebPreferences& web) {
|
||||
PrefService* prefs = profile->GetPrefs();
|
||||
|
||||
// Fill per-script font preferences.
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitStandardFontFamilyMap,
|
||||
&web.standard_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitFixedFontFamilyMap,
|
||||
&web.fixed_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitSerifFontFamilyMap,
|
||||
&web.serif_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitSansSerifFontFamilyMap,
|
||||
&web.sans_serif_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitCursiveFontFamilyMap,
|
||||
&web.cursive_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitFantasyFontFamilyMap,
|
||||
&web.fantasy_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitPictographFontFamilyMap,
|
||||
&web.pictograph_font_family_map);
|
||||
|
||||
web.default_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitDefaultFontSize);
|
||||
web.default_fixed_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
|
||||
web.minimum_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitMinimumFontSize);
|
||||
web.minimum_logical_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
|
||||
|
||||
web.default_encoding = prefs->GetString(prefs::kDefaultCharset);
|
||||
|
||||
web.javascript_can_open_windows_automatically =
|
||||
prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically);
|
||||
web.dom_paste_enabled =
|
||||
prefs->GetBoolean(prefs::kWebKitDomPasteEnabled);
|
||||
web.tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks);
|
||||
|
||||
if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled))
|
||||
web.javascript_enabled = false;
|
||||
if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled))
|
||||
web.web_security_enabled = false;
|
||||
if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled))
|
||||
web.plugins_enabled = false;
|
||||
web.loads_images_automatically =
|
||||
prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically);
|
||||
|
||||
if (prefs->GetBoolean(prefs::kDisable3DAPIs))
|
||||
web.experimental_webgl_enabled = false;
|
||||
|
||||
web.allow_displaying_insecure_content =
|
||||
prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent);
|
||||
web.allow_running_insecure_content =
|
||||
prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
|
||||
|
||||
web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
|
||||
|
||||
web.uses_universal_detector =
|
||||
prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector);
|
||||
web.text_areas_are_resizable =
|
||||
prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable);
|
||||
web.hyperlink_auditing_enabled =
|
||||
prefs->GetBoolean(prefs::kEnableHyperlinkAuditing);
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
std::string image_animation_policy =
|
||||
prefs->GetString(prefs::kAnimationPolicy);
|
||||
if (image_animation_policy == kAnimationPolicyOnce)
|
||||
web.animation_policy =
|
||||
content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE;
|
||||
else if (image_animation_policy == kAnimationPolicyNone)
|
||||
web.animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION;
|
||||
else
|
||||
web.animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED;
|
||||
}
|
||||
|
||||
// Make sure we will set the default_encoding with canonical encoding name.
|
||||
web.default_encoding =
|
||||
CharacterEncoding::GetCanonicalEncodingNameByAliasName(
|
||||
web.default_encoding);
|
||||
if (web.default_encoding.empty()) {
|
||||
prefs->ClearPref(prefs::kDefaultCharset);
|
||||
web.default_encoding = prefs->GetString(prefs::kDefaultCharset);
|
||||
}
|
||||
DCHECK(!web.default_encoding.empty());
|
||||
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnablePotentiallyAnnoyingSecurityFeatures)) {
|
||||
web.disable_reading_from_canvas = true;
|
||||
web.strict_mixed_content_checking = true;
|
||||
web.strict_powerful_feature_restrictions = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Extension preferences.
|
||||
// Should match ChromeContentBrowserClientExtensionsPart::OverrideWebkitPrefs.
|
||||
void SetExtensionPrefs(content::RenderViewHost* rvh,
|
||||
content::WebPreferences& web) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
|
||||
const extensions::ExtensionRegistry* registry =
|
||||
extensions::ExtensionRegistry::Get(
|
||||
rvh->GetProcess()->GetBrowserContext());
|
||||
if (!registry)
|
||||
return;
|
||||
|
||||
// Note: it's not possible for kExtensionsScheme to change during the lifetime
|
||||
// of the process.
|
||||
//
|
||||
// Ensure that we are only granting extension preferences to URLs with the
|
||||
// correct scheme. Without this check, chrome-guest:// schemes used by webview
|
||||
// tags as well as hosts that happen to match the id of an installed extension
|
||||
// would get the wrong preferences.
|
||||
const GURL& site_url = rvh->GetSiteInstance()->GetSiteURL();
|
||||
if (!site_url.SchemeIs(extensions::kExtensionScheme))
|
||||
return;
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderViewHost(rvh);
|
||||
extensions::ViewType view_type = extensions::GetViewType(web_contents);
|
||||
const extensions::Extension* extension =
|
||||
registry->enabled_extensions().GetByID(site_url.host());
|
||||
extension_webkit_preferences::SetPreferences(extension, view_type, &web);
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
// Set preferences based on CefBrowserSettings.
|
||||
void SetCefPrefs(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web) {
|
||||
if (cef.standard_font_family.length > 0) {
|
||||
web.standard_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.standard_font_family);
|
||||
}
|
||||
if (cef.fixed_font_family.length > 0) {
|
||||
web.fixed_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fixed_font_family);
|
||||
}
|
||||
if (cef.serif_font_family.length > 0) {
|
||||
web.serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.serif_font_family);
|
||||
}
|
||||
if (cef.sans_serif_font_family.length > 0) {
|
||||
web.sans_serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.sans_serif_font_family);
|
||||
}
|
||||
if (cef.cursive_font_family.length > 0) {
|
||||
web.cursive_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.cursive_font_family);
|
||||
}
|
||||
if (cef.fantasy_font_family.length > 0) {
|
||||
web.fantasy_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fantasy_font_family);
|
||||
}
|
||||
|
||||
if (cef.default_font_size > 0)
|
||||
web.default_font_size = cef.default_font_size;
|
||||
if (cef.default_fixed_font_size > 0)
|
||||
web.default_fixed_font_size = cef.default_fixed_font_size;
|
||||
if (cef.minimum_font_size > 0)
|
||||
web.minimum_font_size = cef.minimum_font_size;
|
||||
if (cef.minimum_logical_font_size > 0)
|
||||
web.minimum_logical_font_size = cef.minimum_logical_font_size;
|
||||
|
||||
if (cef.default_encoding.length > 0)
|
||||
web.default_encoding = CefString(&cef.default_encoding);
|
||||
|
||||
SET_STATE(cef.remote_fonts, web.remote_fonts_enabled);
|
||||
SET_STATE(cef.javascript, web.javascript_enabled);
|
||||
SET_STATE(cef.javascript_open_windows,
|
||||
web.javascript_can_open_windows_automatically);
|
||||
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.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.tab_to_links, web.tabs_to_links);
|
||||
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
|
||||
// GPU blacklist is not being checked here.
|
||||
if (cef.webgl == STATE_DISABLED)
|
||||
web.experimental_webgl_enabled = false;
|
||||
}
|
||||
|
||||
void SetString(CommandLinePrefStore* prefs,
|
||||
const std::string& key,
|
||||
const std::string& value) {
|
||||
prefs->SetValue(
|
||||
key,
|
||||
make_scoped_ptr(new base::StringValue(value)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
}
|
||||
|
||||
void SetBool(CommandLinePrefStore* prefs,
|
||||
const std::string& key,
|
||||
bool value) {
|
||||
prefs->SetValue(key,
|
||||
make_scoped_ptr(new base::FundamentalValue(value)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
}
|
||||
|
||||
SkColor GetBaseBackgroundColor(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
if (browser.get()) {
|
||||
const CefBrowserSettings& browser_settings = browser->settings();
|
||||
if (CefColorGetA(browser_settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(browser_settings.background_color),
|
||||
CefColorGetG(browser_settings.background_color),
|
||||
CefColorGetB(browser_settings.background_color));
|
||||
}
|
||||
}
|
||||
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
}
|
||||
|
||||
return SK_ColorWHITE;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
if (command_line->HasSwitch(switches::kDefaultEncoding)) {
|
||||
SetString(prefs, prefs::kDefaultCharset,
|
||||
command_line->GetSwitchValueASCII(switches::kDefaultEncoding));
|
||||
}
|
||||
|
||||
if (command_line->HasSwitch(switches::kDisableJavascriptOpenWindows))
|
||||
SetBool(prefs, prefs::kWebKitJavascriptCanOpenWindowsAutomatically, false);
|
||||
if (command_line->HasSwitch(switches::kDisableJavascriptDomPaste))
|
||||
SetBool(prefs, prefs::kWebKitDomPasteEnabled, false);
|
||||
if (command_line->HasSwitch(switches::kDisableImageLoading))
|
||||
SetBool(prefs, prefs::kWebKitLoadsImagesAutomatically, false);
|
||||
if (command_line->HasSwitch(switches::kDisableTabToLinks))
|
||||
SetBool(prefs, prefs::kWebkitTabsToLinks, false);
|
||||
}
|
||||
|
||||
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
||||
PrefsTabHelper::RegisterProfilePrefs(registry);
|
||||
RegisterAnimationPolicyPrefs(registry);
|
||||
|
||||
// From chrome::RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(
|
||||
prefs::kEnableDoNotTrack,
|
||||
false,
|
||||
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
||||
#if defined(ENABLE_WEBRTC)
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCMultipleRoutesEnabled, true);
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCNonProxiedUdpEnabled, true);
|
||||
#endif
|
||||
#if !defined(OS_MACOSX)
|
||||
registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true);
|
||||
#endif
|
||||
|
||||
// From ChromeContentBrowserClient::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false);
|
||||
registry->RegisterBooleanPref(prefs::kEnableHyperlinkAuditing, true);
|
||||
|
||||
// From Profile::RegisterProfilePrefs.
|
||||
registry->RegisterDictionaryPref(prefs::kPartitionDefaultZoomLevel);
|
||||
registry->RegisterDictionaryPref(prefs::kPartitionPerHostZoomLevels);
|
||||
}
|
||||
|
||||
void PopulateWebPreferences(content::RenderViewHost* rvh,
|
||||
content::WebPreferences& web) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
extensions::GetOwnerBrowserForHost(rvh);
|
||||
|
||||
// Set defaults for preferences that are not handled by PrefService.
|
||||
SetDefaultPrefs(web);
|
||||
|
||||
// Set preferences based on the context's PrefService.
|
||||
if (browser.get()) {
|
||||
CefBrowserContext* profile =
|
||||
static_cast<CefBrowserContext*>(
|
||||
browser->web_contents()->GetBrowserContext());
|
||||
SetChromePrefs(profile, web);
|
||||
}
|
||||
|
||||
// Set preferences based on the extension.
|
||||
SetExtensionPrefs(rvh, web);
|
||||
|
||||
// Set preferences based on CefBrowserSettings.
|
||||
if (browser.get())
|
||||
SetCefPrefs(browser->settings(), web);
|
||||
|
||||
// Set the background color for the WebView.
|
||||
web.base_background_color = GetBaseBackgroundColor(browser);
|
||||
}
|
||||
|
||||
} // namespace renderer_prefs
|
39
libcef/browser/prefs/renderer_prefs.h
Normal file
39
libcef/browser/prefs/renderer_prefs.h
Normal file
@ -0,0 +1,39 @@
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PREFS_RENDERER_PREFS_H_
|
||||
#define CEF_LIBCEF_BROWSER_PREFS_RENDERER_PREFS_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
class CommandLinePrefStore;
|
||||
|
||||
namespace content {
|
||||
class RenderViewHost;
|
||||
struct WebPreferences;
|
||||
}
|
||||
|
||||
namespace user_prefs {
|
||||
class PrefRegistrySyncable;
|
||||
}
|
||||
|
||||
namespace renderer_prefs {
|
||||
|
||||
// Register additional renderer-related preferences.
|
||||
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
||||
|
||||
// Set default values based on CEF command-line flags for preferences that are
|
||||
// available via the PrefService. Chromium command-line flags should not exist
|
||||
// for these preferences.
|
||||
void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs);
|
||||
|
||||
// Populate WebPreferences based on a combination of command-line values,
|
||||
// PrefService and CefBrowserSettings.
|
||||
void PopulateWebPreferences(content::RenderViewHost* rvh,
|
||||
content::WebPreferences& web);
|
||||
|
||||
} // namespace renderer_prefs
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PREFS_RENDERER_PREFS_H_
|
@ -73,6 +73,9 @@ const char kDisableTabToLinks[] = "disable-tab-to-links";
|
||||
// Persist session cookies.
|
||||
const char kPersistSessionCookies[] = "persist-session-cookies";
|
||||
|
||||
// Persist user preferences.
|
||||
const char kPersistUserPreferences[] = "persist-user-preferences";
|
||||
|
||||
// Enable media (WebRTC audio/video) streaming.
|
||||
const char kEnableMediaStream[] = "enable-media-stream";
|
||||
|
||||
|
@ -34,6 +34,7 @@ extern const char kImageShrinkStandaloneToFit[];
|
||||
extern const char kDisableTextAreaResize[];
|
||||
extern const char kDisableTabToLinks[];
|
||||
extern const char kPersistSessionCookies[];
|
||||
extern const char kPersistUserPreferences[];
|
||||
extern const char kEnableMediaStream[];
|
||||
extern const char kEnableSpeechInput[];
|
||||
extern const char kEnableProfanityFilter[];
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/child/pdf_child_init.h"
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
@ -682,6 +683,9 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
locale,
|
||||
&content_client_,
|
||||
ui::ResourceBundle::LOAD_COMMON_RESOURCES);
|
||||
if (!loaded_locale.empty() && g_browser_process)
|
||||
g_browser_process->SetApplicationLocale(loaded_locale);
|
||||
|
||||
ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance();
|
||||
|
||||
if (!content_client_.pack_loading_disabled()) {
|
||||
|
@ -402,6 +402,84 @@ need to be translated for each locale.-->
|
||||
Hide This Plugin
|
||||
</message>
|
||||
</if>
|
||||
|
||||
<!-- Preferences. -->
|
||||
<!-- The default value for HTTP Accept-Language header. -->
|
||||
<message name="IDS_ACCEPT_LANGUAGES" use_name_for_id="true">
|
||||
en-US,en
|
||||
</message>
|
||||
<!-- The default value for |WebPreference::default_encoding|. -->
|
||||
<message name="IDS_DEFAULT_ENCODING" use_name_for_id="true">
|
||||
windows-1252
|
||||
</message>
|
||||
<!-- The default value for |WebPreference::uses_universal_detector|. -->
|
||||
<message name="IDS_USES_UNIVERSAL_DETECTOR" use_name_for_id="true">
|
||||
false
|
||||
</message>
|
||||
<!-- Locale-dependent static encodings string -->
|
||||
<message name="IDS_STATIC_ENCODING_LIST" use_name_for_id="true">
|
||||
windows-1252
|
||||
</message>
|
||||
<message name="IDS_ENCODING_DISPLAY_TEMPLATE" desc="The format of encodings in the encoding menu. Encoding categories are Unicode, Western, Turkish, Cyrillic, Chinese Simplified, Thai, Arabic, Hebrew and so forth. Encoding names are UTF-8, Windows-1252, ISO-8859-8, GB2312, etc.">
|
||||
<ph name="ENCODING_CATEGORY">$1<ex>Japanese</ex></ph> (<ph name="ENCODING_NAME">$2<ex>Shift_JIS</ex></ph>)
|
||||
</message>
|
||||
<message name="IDS_ENCODING_UNICODE" desc="The text label of Unicode encodings">
|
||||
Unicode
|
||||
</message>
|
||||
<message name="IDS_ENCODING_WESTERN" desc="The text label of West European character encoding">
|
||||
Western
|
||||
</message>
|
||||
<message name="IDS_ENCODING_SIMP_CHINESE" desc="The text label of Simplified Chinese encodings">
|
||||
Chinese Simplified
|
||||
</message>
|
||||
<message name="IDS_ENCODING_TRAD_CHINESE" desc="The text label of Traditional Chinese encodings">
|
||||
Chinese Traditional
|
||||
</message>
|
||||
<message name="IDS_ENCODING_KOREAN" desc="The text label of Korean encoding">
|
||||
Korean
|
||||
</message>
|
||||
<message name="IDS_ENCODING_JAPANESE" desc="The text label of Japanese encodings">
|
||||
Japanese
|
||||
</message>
|
||||
<message name="IDS_ENCODING_THAI" desc="The text label of encoding thai language">
|
||||
Thai
|
||||
</message>
|
||||
<message name="IDS_ENCODING_CENTRAL_EUROPEAN" desc="The text label of encoding Central European">
|
||||
Central European
|
||||
</message>
|
||||
<message name="IDS_ENCODING_CYRILLIC" desc="The text label of Cyrillic encodings">
|
||||
Cyrillic
|
||||
</message>
|
||||
<message name="IDS_ENCODING_GREEK" desc="The text label of Greek encodings">
|
||||
Greek
|
||||
</message>
|
||||
<message name="IDS_ENCODING_BALTIC" desc="The text label of Baltic encodings">
|
||||
Baltic
|
||||
</message>
|
||||
<message name="IDS_ENCODING_SOUTH_EUROPEAN" desc="The text label of South European encodings">
|
||||
South European
|
||||
</message>
|
||||
<message name="IDS_ENCODING_NORDIC" desc="The text label of Nordic encoding">
|
||||
Nordic
|
||||
</message>
|
||||
<message name="IDS_ENCODING_CELTIC" desc="The text label of Celtic encodings">
|
||||
Celtic
|
||||
</message>
|
||||
<message name="IDS_ENCODING_ROMANIAN" desc="The text label of Romanian encoding">
|
||||
Romanian
|
||||
</message>
|
||||
<message name="IDS_ENCODING_TURKISH" desc="The text label of Turkish encodings">
|
||||
Turkish
|
||||
</message>
|
||||
<message name="IDS_ENCODING_ARABIC" desc="The text label of Arabic encodings">
|
||||
Arabic
|
||||
</message>
|
||||
<message name="IDS_ENCODING_HEBREW" desc="The text label of Hebrew encodings">
|
||||
Hebrew
|
||||
</message>
|
||||
<message name="IDS_ENCODING_VIETNAMESE" desc="The text label of Vietnamese encoding">
|
||||
Vietnamese
|
||||
</message>
|
||||
</messages>
|
||||
</release>
|
||||
</grit>
|
||||
|
@ -218,4 +218,17 @@ patches = [
|
||||
'name': 'extension_process_policy_543230',
|
||||
'path': '../chrome/common/extensions/',
|
||||
},
|
||||
{
|
||||
# Fix missing check for defined(ENABLE_THEMES) in
|
||||
# renderer_preferences_util.cc on Linux.
|
||||
# https://code.google.com/p/chromium/issues/detail?id=545103
|
||||
'name': 'renderer_preferences_util_545103',
|
||||
'path': '../chrome/browser/',
|
||||
},
|
||||
{
|
||||
# Expose the FontFamilyCache UserData key.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1501
|
||||
'name': 'font_family_cache_1501',
|
||||
'path': '../chrome/browser/',
|
||||
},
|
||||
]
|
||||
|
13
patch/patches/font_family_cache_1501.patch
Normal file
13
patch/patches/font_family_cache_1501.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git font_family_cache.h font_family_cache.h
|
||||
index d5ff699..71fa27b 100644
|
||||
--- font_family_cache.h
|
||||
+++ font_family_cache.h
|
||||
@@ -19,6 +19,8 @@ class Profile;
|
||||
|
||||
FORWARD_DECLARE_TEST(FontFamilyCacheTest, Caching);
|
||||
|
||||
+extern const char kFontFamilyCacheKey[];
|
||||
+
|
||||
// Caches font family preferences associated with a PrefService. This class
|
||||
// relies on the assumption that each concatenation of map_name + '.' + script
|
||||
// is a unique string. It also relies on the assumption that the (const char*)
|
24
patch/patches/renderer_preferences_util_545103.patch
Normal file
24
patch/patches/renderer_preferences_util_545103.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git renderer_preferences_util.cc renderer_preferences_util.cc
|
||||
index f7628fe..e2f1451 100644
|
||||
--- renderer_preferences_util.cc
|
||||
+++ renderer_preferences_util.cc
|
||||
@@ -25,7 +25,8 @@
|
||||
#include "ui/views/controls/textfield/textfield.h"
|
||||
#endif
|
||||
|
||||
-#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
+#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) && \
|
||||
+ defined(ENABLE_THEMES)
|
||||
#include "chrome/browser/themes/theme_service.h"
|
||||
#include "chrome/browser/themes/theme_service_factory.h"
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
@@ -81,7 +82,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs,
|
||||
prefs->caret_blink_interval = views::Textfield::GetCaretBlinkMs() / 1000.0;
|
||||
#endif
|
||||
|
||||
-#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
+#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) && \
|
||||
+ defined(ENABLE_THEMES)
|
||||
views::LinuxUI* linux_ui = views::LinuxUI::instance();
|
||||
if (linux_ui) {
|
||||
if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) {
|
@ -196,6 +196,11 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
command_line->HasSwitch("proxy-pac-url") ||
|
||||
command_line->HasSwitch("proxy-server"));
|
||||
|
||||
// If allow running insecure content is enabled via the command-line then it
|
||||
// cannot be enabled via preferences.
|
||||
dict->SetBool("allow_running_insecure_content",
|
||||
command_line->HasSwitch("allow-running-insecure-content"));
|
||||
|
||||
// Serialize the state to JSON and return to the JavaScript caller.
|
||||
callback->Success(GetJSON(dict));
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<input type="checkbox" id="enable_spellchecking"/> Enable spell checking
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<br/>
|
||||
<input type="checkbox" id="allow_running_insecure_content"/> Allow running insecure content
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<br/>
|
||||
@ -214,6 +220,19 @@
|
||||
response.browser.enable_spellchecking;
|
||||
}
|
||||
|
||||
// Web content settings.
|
||||
if (preferences_state.allow_running_insecure_content) {
|
||||
// Cannot disable running insecure content when enabled via the
|
||||
// command-line.
|
||||
document.getElementById("allow_running_insecure_content").checked =
|
||||
true;
|
||||
document.getElementById("allow_running_insecure_content").disabled =
|
||||
true;
|
||||
} else {
|
||||
document.getElementById("allow_running_insecure_content").checked =
|
||||
response.webkit.webprefs.allow_running_insecure_content;
|
||||
}
|
||||
|
||||
// Proxy settings.
|
||||
document.getElementById("proxy_type").value = response.proxy.mode;
|
||||
|
||||
@ -252,6 +271,16 @@
|
||||
document.getElementById("enable_spellchecking").checked;
|
||||
}
|
||||
|
||||
// Web content settings.
|
||||
if (!preferences_state.allow_running_insecure_content) {
|
||||
has_preferences = true;
|
||||
|
||||
preferences.webkit = {};
|
||||
preferences.webkit.webprefs = {};
|
||||
preferences.webkit.webprefs.allow_running_insecure_content =
|
||||
document.getElementById("allow_running_insecure_content").checked;
|
||||
}
|
||||
|
||||
// Proxy settings.
|
||||
if (!preferences_state.proxy_configured) {
|
||||
has_preferences = true;
|
||||
|
@ -692,11 +692,13 @@ class OSRTestHandler : public RoutingTestHandler,
|
||||
// first pixel of border
|
||||
#if defined(OS_MACOSX)
|
||||
EXPECT_EQ(0xff5d99d6, *(reinterpret_cast<const uint32*>(buffer)));
|
||||
#else
|
||||
#elif defined(OS_LINUX) || defined(OS_WIN)
|
||||
if (scale_factor_ == 1.0f)
|
||||
EXPECT_EQ(0xffd69c2b, *(reinterpret_cast<const uint32*>(buffer)));
|
||||
EXPECT_EQ(0xff6497ea, *(reinterpret_cast<const uint32*>(buffer)));
|
||||
else if (scale_factor_ == 2.0f)
|
||||
EXPECT_EQ(0xffe59700, *(reinterpret_cast<const uint32*>(buffer)));
|
||||
EXPECT_EQ(0xff4d90fe, *(reinterpret_cast<const uint32*>(buffer)));
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
EXPECT_EQ(expanded_select_rect.width, width);
|
||||
EXPECT_EQ(expanded_select_rect.height, height);
|
||||
|
@ -54,6 +54,11 @@ def calc_inputs(locale):
|
||||
"""Determine the files that need processing for the given locale."""
|
||||
inputs = []
|
||||
|
||||
#e.g.
|
||||
# '<(SHARED_INTERMEDIATE_DIR)/chrome/platform_locale_settings_da.pak'
|
||||
inputs.append(os.path.join(SHARE_INT_DIR, 'chrome',
|
||||
'platform_locale_settings_%s.pak' % locale))
|
||||
|
||||
#e.g.
|
||||
# '<(SHARED_INTERMEDIATE_DIR)/components/strings/components_strings_da.pak'
|
||||
inputs.append(os.path.join(SHARE_INT_DIR, 'components', 'strings',
|
||||
|
Loading…
x
Reference in New Issue
Block a user