mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add Google SafeSearch support with NetworkService (see issue #1917)
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||||
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
||||||
|
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||||
#include "chrome/browser/themes/theme_service_factory.h"
|
#include "chrome/browser/themes/theme_service_factory.h"
|
||||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||||
@@ -20,6 +21,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
|||||||
CookieSettingsFactory::GetInstance();
|
CookieSettingsFactory::GetInstance();
|
||||||
PluginPrefsFactory::GetInstance();
|
PluginPrefsFactory::GetInstance();
|
||||||
PrefsTabHelper::GetServiceInstance();
|
PrefsTabHelper::GetServiceInstance();
|
||||||
|
RendererUpdaterFactory::GetInstance();
|
||||||
SpellcheckServiceFactory::GetInstance();
|
SpellcheckServiceFactory::GetInstance();
|
||||||
ThemeServiceFactory::GetInstance();
|
ThemeServiceFactory::GetInstance();
|
||||||
|
|
||||||
|
@@ -56,10 +56,14 @@
|
|||||||
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h"
|
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h"
|
||||||
#include "chrome/browser/plugins/plugin_utils.h"
|
#include "chrome/browser/plugins/plugin_utils.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
|
#include "chrome/browser/profiles/renderer_updater.h"
|
||||||
|
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||||
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
|
#include "chrome/common/google_url_loader_throttle.h"
|
||||||
|
#include "chrome/common/pref_names.h"
|
||||||
#include "chrome/common/webui_url_constants.h"
|
#include "chrome/common/webui_url_constants.h"
|
||||||
#include "chrome/grit/browser_resources.h"
|
#include "chrome/grit/browser_resources.h"
|
||||||
#include "chrome/grit/generated_resources.h"
|
#include "chrome/grit/generated_resources.h"
|
||||||
@@ -67,6 +71,7 @@
|
|||||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||||
#include "components/navigation_interception/navigation_params.h"
|
#include "components/navigation_interception/navigation_params.h"
|
||||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||||
|
#include "components/variations/variations_http_header_provider.h"
|
||||||
#include "components/version_info/version_info.h"
|
#include "components/version_info/version_info.h"
|
||||||
#include "content/browser/frame_host/navigation_handle_impl.h"
|
#include "content/browser/frame_host/navigation_handle_impl.h"
|
||||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||||
@@ -540,8 +545,10 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
|||||||
host->RemoveObserver(CefBrowserInfoManager::GetInstance());
|
host->RemoveObserver(CefBrowserInfoManager::GetInstance());
|
||||||
host->AddObserver(CefBrowserInfoManager::GetInstance());
|
host->AddObserver(CefBrowserInfoManager::GetInstance());
|
||||||
|
|
||||||
host->Send(
|
// Forwards dynamic parameters to CefRenderThreadObserver.
|
||||||
new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
|
Profile* original_profile = profile->GetOriginalProfile();
|
||||||
|
RendererUpdaterFactory::GetForProfile(original_profile)
|
||||||
|
->InitializeRenderer(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
||||||
@@ -1107,6 +1114,18 @@ CefContentBrowserClient::CreateURLLoaderThrottles(
|
|||||||
result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
|
result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
|
||||||
request.resource_type, frame_tree_node_id));
|
request.resource_type, frame_tree_node_id));
|
||||||
|
|
||||||
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||||
|
bool is_off_the_record = profile->IsOffTheRecord();
|
||||||
|
|
||||||
|
chrome::mojom::DynamicParams dynamic_params = {
|
||||||
|
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
|
||||||
|
profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict),
|
||||||
|
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps),
|
||||||
|
variations::VariationsHttpHeaderProvider::GetInstance()
|
||||||
|
->GetClientDataHeader(false /* is_signed_in */)};
|
||||||
|
result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
||||||
|
is_off_the_record, std::move(dynamic_params)));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
|
#include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
|
||||||
#include "chrome/common/buildflags.h"
|
#include "chrome/common/buildflags.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
|
#include "chrome/common/net/safe_search_util.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "chrome/grit/locale_settings.h"
|
#include "chrome/grit/locale_settings.h"
|
||||||
#include "components/certificate_transparency/pref_names.h"
|
#include "components/certificate_transparency/pref_names.h"
|
||||||
@@ -232,6 +233,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
|
|
||||||
// Print preferences.
|
// Print preferences.
|
||||||
// Based on ProfileImpl::RegisterProfilePrefs.
|
// Based on ProfileImpl::RegisterProfilePrefs.
|
||||||
|
registry->RegisterBooleanPref(prefs::kForceGoogleSafeSearch, false);
|
||||||
|
registry->RegisterIntegerPref(prefs::kForceYouTubeRestrict,
|
||||||
|
safe_search_util::YOUTUBE_RESTRICT_OFF);
|
||||||
|
registry->RegisterStringPref(prefs::kAllowedDomainsForApps, std::string());
|
||||||
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
|
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
|
||||||
registry->RegisterBooleanPref(prefs::kPrintPreviewDisabled,
|
registry->RegisterBooleanPref(prefs::kPrintPreviewDisabled,
|
||||||
!extensions::PrintPreviewEnabled());
|
!extensions::PrintPreviewEnabled());
|
||||||
|
@@ -147,11 +147,6 @@ IPC_MESSAGE_ROUTED0(CefMsg_DidStopLoading)
|
|||||||
// Based on ChromeViewMsg_LoadBlockedPlugins.
|
// Based on ChromeViewMsg_LoadBlockedPlugins.
|
||||||
IPC_MESSAGE_ROUTED1(CefViewMsg_LoadBlockedPlugins, std::string /* identifier */)
|
IPC_MESSAGE_ROUTED1(CefViewMsg_LoadBlockedPlugins, std::string /* identifier */)
|
||||||
|
|
||||||
// Sent on process startup to indicate whether this process is running in
|
|
||||||
// incognito mode. Based on ChromeViewMsg_SetIsIncognitoProcess.
|
|
||||||
IPC_MESSAGE_CONTROL1(CefProcessMsg_SetIsIncognitoProcess,
|
|
||||||
bool /* is_incognito_processs */)
|
|
||||||
|
|
||||||
// Sent to child processes to add or remove a cross-origin whitelist entry.
|
// Sent to child processes to add or remove a cross-origin whitelist entry.
|
||||||
IPC_MESSAGE_CONTROL2(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
IPC_MESSAGE_CONTROL2(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
||||||
bool /* add */,
|
bool /* add */,
|
||||||
|
@@ -15,12 +15,24 @@
|
|||||||
#include "content/public/common/service_manager_connection.h"
|
#include "content/public/common/service_manager_connection.h"
|
||||||
#include "content/public/common/simple_connection_filter.h"
|
#include "content/public/common/simple_connection_filter.h"
|
||||||
#include "content/public/renderer/render_thread.h"
|
#include "content/public/renderer/render_thread.h"
|
||||||
|
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||||
#include "net/base/net_module.h"
|
#include "net/base/net_module.h"
|
||||||
#include "services/service_manager/public/cpp/binder_registry.h"
|
#include "services/service_manager/public/cpp/binder_registry.h"
|
||||||
|
#include "services/service_manager/public/cpp/connector.h"
|
||||||
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||||
#include "third_party/blink/public/platform/web_string.h"
|
#include "third_party/blink/public/platform/web_string.h"
|
||||||
#include "third_party/blink/public/platform/web_url.h"
|
#include "third_party/blink/public/platform/web_url.h"
|
||||||
#include "third_party/blink/public/web/web_security_policy.h"
|
#include "third_party/blink/public/web/web_security_policy.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
chrome::mojom::DynamicParams* GetDynamicConfigParams() {
|
||||||
|
static base::NoDestructor<chrome::mojom::DynamicParams> dynamic_params;
|
||||||
|
return dynamic_params.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
bool CefRenderThreadObserver::is_incognito_process_ = false;
|
bool CefRenderThreadObserver::is_incognito_process_ = false;
|
||||||
|
|
||||||
CefRenderThreadObserver::CefRenderThreadObserver()
|
CefRenderThreadObserver::CefRenderThreadObserver()
|
||||||
@@ -40,12 +52,16 @@ CefRenderThreadObserver::CefRenderThreadObserver()
|
|||||||
|
|
||||||
CefRenderThreadObserver::~CefRenderThreadObserver() {}
|
CefRenderThreadObserver::~CefRenderThreadObserver() {}
|
||||||
|
|
||||||
|
// static
|
||||||
|
const chrome::mojom::DynamicParams&
|
||||||
|
CefRenderThreadObserver::GetDynamicParams() {
|
||||||
|
return *GetDynamicConfigParams();
|
||||||
|
}
|
||||||
|
|
||||||
bool CefRenderThreadObserver::OnControlMessageReceived(
|
bool CefRenderThreadObserver::OnControlMessageReceived(
|
||||||
const IPC::Message& message) {
|
const IPC::Message& message) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(CefRenderThreadObserver, message)
|
IPC_BEGIN_MESSAGE_MAP(CefRenderThreadObserver, message)
|
||||||
IPC_MESSAGE_HANDLER(CefProcessMsg_SetIsIncognitoProcess,
|
|
||||||
OnSetIsIncognitoProcess)
|
|
||||||
IPC_MESSAGE_HANDLER(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
IPC_MESSAGE_HANDLER(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
||||||
OnModifyCrossOriginWhitelistEntry)
|
OnModifyCrossOriginWhitelistEntry)
|
||||||
IPC_MESSAGE_HANDLER(CefProcessMsg_ClearCrossOriginWhitelist,
|
IPC_MESSAGE_HANDLER(CefProcessMsg_ClearCrossOriginWhitelist,
|
||||||
@@ -55,11 +71,44 @@ bool CefRenderThreadObserver::OnControlMessageReceived(
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderThreadObserver::OnSetIsIncognitoProcess(
|
void CefRenderThreadObserver::RegisterMojoInterfaces(
|
||||||
bool is_incognito_process) {
|
blink::AssociatedInterfaceRegistry* associated_interfaces) {
|
||||||
|
associated_interfaces->AddInterface(base::Bind(
|
||||||
|
&CefRenderThreadObserver::OnRendererConfigurationAssociatedRequest,
|
||||||
|
base::Unretained(this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRenderThreadObserver::UnregisterMojoInterfaces(
|
||||||
|
blink::AssociatedInterfaceRegistry* associated_interfaces) {
|
||||||
|
associated_interfaces->RemoveInterface(
|
||||||
|
chrome::mojom::RendererConfiguration::Name_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRenderThreadObserver::SetInitialConfiguration(
|
||||||
|
bool is_incognito_process,
|
||||||
|
chrome::mojom::ChromeOSListenerRequest chromeos_listener_request) {
|
||||||
is_incognito_process_ = is_incognito_process;
|
is_incognito_process_ = is_incognito_process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefRenderThreadObserver::SetConfiguration(
|
||||||
|
chrome::mojom::DynamicParamsPtr params) {
|
||||||
|
*GetDynamicConfigParams() = std::move(*params);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRenderThreadObserver::SetContentSettingRules(
|
||||||
|
const RendererContentSettingRules& rules) {}
|
||||||
|
|
||||||
|
void CefRenderThreadObserver::SetFieldTrialGroup(
|
||||||
|
const std::string& trial_name,
|
||||||
|
const std::string& group_name) {
|
||||||
|
content::RenderThread::Get()->SetFieldTrialGroup(trial_name, group_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRenderThreadObserver::OnRendererConfigurationAssociatedRequest(
|
||||||
|
chrome::mojom::RendererConfigurationAssociatedRequest request) {
|
||||||
|
renderer_configuration_bindings_.AddBinding(this, std::move(request));
|
||||||
|
}
|
||||||
|
|
||||||
void CefRenderThreadObserver::OnModifyCrossOriginWhitelistEntry(
|
void CefRenderThreadObserver::OnModifyCrossOriginWhitelistEntry(
|
||||||
bool add,
|
bool add,
|
||||||
const Cef_CrossOriginWhiteListEntry_Params& params) {
|
const Cef_CrossOriginWhiteListEntry_Params& params) {
|
||||||
|
@@ -9,7 +9,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
|
#include "chrome/common/renderer_configuration.mojom.h"
|
||||||
|
#include "components/content_settings/core/common/content_settings.h"
|
||||||
#include "content/public/renderer/render_thread_observer.h"
|
#include "content/public/renderer/render_thread_observer.h"
|
||||||
|
#include "mojo/public/cpp/bindings/associated_binding_set.h"
|
||||||
|
|
||||||
namespace visitedlink {
|
namespace visitedlink {
|
||||||
class VisitedLinkSlave;
|
class VisitedLinkSlave;
|
||||||
@@ -17,24 +20,45 @@ class VisitedLinkSlave;
|
|||||||
|
|
||||||
struct Cef_CrossOriginWhiteListEntry_Params;
|
struct Cef_CrossOriginWhiteListEntry_Params;
|
||||||
|
|
||||||
// This class sends and receives control messages on the renderer process.
|
// This class sends and receives control messages in the renderer process.
|
||||||
class CefRenderThreadObserver : public content::RenderThreadObserver {
|
class CefRenderThreadObserver : public content::RenderThreadObserver,
|
||||||
|
public chrome::mojom::RendererConfiguration {
|
||||||
public:
|
public:
|
||||||
CefRenderThreadObserver();
|
CefRenderThreadObserver();
|
||||||
~CefRenderThreadObserver() override;
|
~CefRenderThreadObserver() override;
|
||||||
|
|
||||||
static bool is_incognito_process() { return is_incognito_process_; }
|
static bool is_incognito_process() { return is_incognito_process_; }
|
||||||
|
|
||||||
// RenderThreadObserver implementation.
|
// Return the dynamic parameters - those that may change while the
|
||||||
bool OnControlMessageReceived(const IPC::Message& message) override;
|
// render process is running.
|
||||||
|
static const chrome::mojom::DynamicParams& GetDynamicParams();
|
||||||
|
|
||||||
visitedlink::VisitedLinkSlave* visited_link_slave() {
|
visitedlink::VisitedLinkSlave* visited_link_slave() {
|
||||||
return visited_link_slave_.get();
|
return visited_link_slave_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// content::RenderThreadObserver:
|
||||||
|
bool OnControlMessageReceived(const IPC::Message& message) override;
|
||||||
|
void RegisterMojoInterfaces(
|
||||||
|
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
|
||||||
|
void UnregisterMojoInterfaces(
|
||||||
|
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
|
||||||
|
|
||||||
|
// chrome::mojom::RendererConfiguration:
|
||||||
|
void SetInitialConfiguration(bool is_incognito_process,
|
||||||
|
chrome::mojom::ChromeOSListenerRequest
|
||||||
|
chromeos_listener_request) override;
|
||||||
|
void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
|
||||||
|
void SetContentSettingRules(
|
||||||
|
const RendererContentSettingRules& rules) override;
|
||||||
|
void SetFieldTrialGroup(const std::string& trial_name,
|
||||||
|
const std::string& group_name) override;
|
||||||
|
|
||||||
|
void OnRendererConfigurationAssociatedRequest(
|
||||||
|
chrome::mojom::RendererConfigurationAssociatedRequest request);
|
||||||
|
|
||||||
// Message handlers called on the render thread.
|
// Message handlers called on the render thread.
|
||||||
void OnSetIsIncognitoProcess(bool is_incognito_process);
|
|
||||||
void OnModifyCrossOriginWhitelistEntry(
|
void OnModifyCrossOriginWhitelistEntry(
|
||||||
bool add,
|
bool add,
|
||||||
const Cef_CrossOriginWhiteListEntry_Params& params);
|
const Cef_CrossOriginWhiteListEntry_Params& params);
|
||||||
@@ -44,6 +68,9 @@ class CefRenderThreadObserver : public content::RenderThreadObserver {
|
|||||||
|
|
||||||
std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
|
std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
|
||||||
|
|
||||||
|
mojo::AssociatedBindingSet<chrome::mojom::RendererConfiguration>
|
||||||
|
renderer_configuration_bindings_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefRenderThreadObserver);
|
DISALLOW_COPY_AND_ASSIGN(CefRenderThreadObserver);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -5,10 +5,12 @@
|
|||||||
#include "libcef/renderer/url_loader_throttle_provider_impl.h"
|
#include "libcef/renderer/url_loader_throttle_provider_impl.h"
|
||||||
|
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
|
#include "libcef/renderer/render_thread_observer.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
|
#include "chrome/common/google_url_loader_throttle.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/renderer/render_frame.h"
|
#include "content/public/renderer/render_frame.h"
|
||||||
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
|
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
|
||||||
@@ -70,6 +72,10 @@ CefURLLoaderThrottleProviderImpl::CreateThrottles(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throttles.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
||||||
|
CefRenderThreadObserver::is_incognito_process(),
|
||||||
|
CefRenderThreadObserver::GetDynamicParams()));
|
||||||
|
|
||||||
return throttles;
|
return throttles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -204,6 +204,9 @@ patches = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
# Make some methods of ProfileManager virtual.
|
# Make some methods of ProfileManager virtual.
|
||||||
|
#
|
||||||
|
# Don't create IdentityManager in RendererUpdater.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/1917
|
||||||
'name': 'chrome_browser_profiles',
|
'name': 'chrome_browser_profiles',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -42,3 +42,37 @@ index 87ecf1fc998b..924c24fa42a2 100644
|
|||||||
|
|
||||||
// Get the path of the last used profile, or if that's undefined, the default
|
// Get the path of the last used profile, or if that's undefined, the default
|
||||||
// profile.
|
// profile.
|
||||||
|
diff --git chrome/browser/profiles/renderer_updater.cc chrome/browser/profiles/renderer_updater.cc
|
||||||
|
index 9dd42523f970..b8f5ae89ae3d 100644
|
||||||
|
--- chrome/browser/profiles/renderer_updater.cc
|
||||||
|
+++ chrome/browser/profiles/renderer_updater.cc
|
||||||
|
@@ -7,6 +7,7 @@
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
|
+#include "cef/libcef/features/features.h"
|
||||||
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||||
|
#include "chrome/browser/profiles/profile.h"
|
||||||
|
#include "chrome/browser/signin/identity_manager_factory.h"
|
||||||
|
@@ -60,8 +61,12 @@ void GetGuestViewDefaultContentSettingRules(
|
||||||
|
|
||||||
|
RendererUpdater::RendererUpdater(Profile* profile)
|
||||||
|
: profile_(profile), identity_manager_observer_(this) {
|
||||||
|
+#if !BUILDFLAG(ENABLE_CEF)
|
||||||
|
identity_manager_ = IdentityManagerFactory::GetForProfile(profile);
|
||||||
|
identity_manager_observer_.Add(identity_manager_);
|
||||||
|
+#else
|
||||||
|
+ identity_manager_ = nullptr;
|
||||||
|
+#endif
|
||||||
|
#if defined(OS_CHROMEOS)
|
||||||
|
oauth2_login_manager_ =
|
||||||
|
chromeos::OAuth2LoginManagerFactory::GetForProfile(profile_);
|
||||||
|
@@ -228,7 +233,7 @@ void RendererUpdater::UpdateRenderer(
|
||||||
|
force_google_safesearch_.GetValue(),
|
||||||
|
force_youtube_restrict_.GetValue(),
|
||||||
|
allowed_domains_for_apps_.GetValue(),
|
||||||
|
- identity_manager_->HasPrimaryAccount()
|
||||||
|
+ identity_manager_ && identity_manager_->HasPrimaryAccount()
|
||||||
|
? cached_variation_ids_header_signed_in_
|
||||||
|
: cached_variation_ids_header_));
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user