mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 95.0.4638.0 (#920003)
Known issues: - Windows ARM64 builds are currently failing due to https://crbug.com/1242884#c31
This commit is contained in:
@ -356,6 +356,11 @@ storage::SpecialStoragePolicy* AlloyBrowserContext::GetSpecialStoragePolicy() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::PlatformNotificationService*
|
||||
AlloyBrowserContext::GetPlatformNotificationService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::PushMessagingService* AlloyBrowserContext::GetPushMessagingService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PlatformNotificationService* GetPlatformNotificationService()
|
||||
override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::StorageNotificationService* GetStorageNotificationService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
|
@ -118,12 +118,14 @@
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
#include "net/base/auth.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "net/ssl/ssl_private_key.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||
#include "storage/browser/quota/quota_settings.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
#include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
|
||||
#include "third_party/blink/public/web/web_window_features.h"
|
||||
@ -1357,6 +1359,10 @@ std::string AlloyContentBrowserClient::GetUserAgent() {
|
||||
return embedder_support::GetUserAgent();
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetReducedUserAgent() {
|
||||
return embedder_support::GetReducedUserAgent();
|
||||
}
|
||||
|
||||
blink::UserAgentMetadata AlloyContentBrowserClient::GetUserAgentMetadata() {
|
||||
blink::UserAgentMetadata metadata;
|
||||
|
||||
@ -1385,7 +1391,7 @@ AlloyContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& url,
|
||||
const GURL& site_for_cookies,
|
||||
const net::SiteForCookies& site_for_cookies,
|
||||
const absl::optional<url::Origin>& top_frame_origin) {
|
||||
// Persistent MediaDevice IDs are allowed if cookies are allowed.
|
||||
return CookieSettingsFactory::GetForProfile(
|
||||
|
@ -208,13 +208,14 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
std::string GetProduct() override;
|
||||
std::string GetChromeProduct() override;
|
||||
std::string GetUserAgent() override;
|
||||
std::string GetReducedUserAgent() override;
|
||||
blink::UserAgentMetadata GetUserAgentMetadata() override;
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) override;
|
||||
bool ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& scope,
|
||||
const GURL& site_for_cookies,
|
||||
const net::SiteForCookies& site_for_cookies,
|
||||
const absl::optional<url::Origin>& top_frame_origin) override;
|
||||
bool ShouldAllowPluginCreation(
|
||||
const url::Origin& embedder_origin,
|
||||
|
@ -396,3 +396,9 @@ ChromeBrowserProcessAlloy::serial_policy_allowed_ports() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
breadcrumbs::BreadcrumbPersistentStorageManager*
|
||||
ChromeBrowserProcessAlloy::GetBreadcrumbPersistentStorageManager() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
override;
|
||||
BuildState* GetBuildState() override;
|
||||
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
|
||||
breadcrumbs::BreadcrumbPersistentStorageManager*
|
||||
GetBreadcrumbPersistentStorageManager() override;
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
|
@ -171,7 +171,7 @@ void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void ChromeProfileAlloy::RecordMainFrameNavigation() {
|
||||
void ChromeProfileAlloy::RecordPrimaryMainFrameNavigation() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class ChromeProfileAlloy : public Profile {
|
||||
ExitType GetLastSessionExitType() const override;
|
||||
base::Time GetCreationTime() const override;
|
||||
void SetCreationTimeForTesting(base::Time creation_time) override;
|
||||
void RecordMainFrameNavigation() override;
|
||||
void RecordPrimaryMainFrameNavigation() override;
|
||||
bool IsSignedIn() override;
|
||||
|
||||
private:
|
||||
|
@ -8,9 +8,11 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "extensions/browser/api/storage/backend_task_runner.h"
|
||||
#include "extensions/browser/api/storage/value_store_util.h"
|
||||
#include "extensions/browser/api/storage/weak_unlimited_settings_storage.h"
|
||||
#include "extensions/browser/value_store/value_store_factory.h"
|
||||
#include "extensions/common/api/storage.h"
|
||||
@ -37,8 +39,8 @@ SettingsStorageQuotaEnforcer::Limits GetLocalQuotaLimits() {
|
||||
} // namespace
|
||||
|
||||
SyncValueStoreCache::SyncValueStoreCache(
|
||||
const scoped_refptr<ValueStoreFactory>& factory)
|
||||
: storage_factory_(factory), quota_(GetLocalQuotaLimits()) {
|
||||
scoped_refptr<value_store::ValueStoreFactory> factory)
|
||||
: storage_factory_(std::move(factory)), quota_(GetLocalQuotaLimits()) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
}
|
||||
|
||||
@ -51,7 +53,7 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
|
||||
scoped_refptr<const Extension> extension) {
|
||||
DCHECK(IsOnBackendSequence());
|
||||
|
||||
ValueStore* storage = GetStorage(extension.get());
|
||||
value_store::ValueStore* storage = GetStorage(extension.get());
|
||||
|
||||
// A neat way to implement unlimited storage; if the extension has the
|
||||
// unlimited storage permission, force through all calls to Set().
|
||||
@ -67,29 +69,34 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
|
||||
void SyncValueStoreCache::DeleteStorageSoon(const std::string& extension_id) {
|
||||
DCHECK(IsOnBackendSequence());
|
||||
storage_map_.erase(extension_id);
|
||||
storage_factory_->DeleteSettings(settings_namespace::SYNC,
|
||||
ValueStoreFactory::ModelType::APP,
|
||||
extension_id);
|
||||
storage_factory_->DeleteSettings(settings_namespace::SYNC,
|
||||
ValueStoreFactory::ModelType::EXTENSION,
|
||||
extension_id);
|
||||
|
||||
value_store_util::DeleteValueStore(settings_namespace::SYNC,
|
||||
value_store_util::ModelType::APP,
|
||||
extension_id, storage_factory_);
|
||||
|
||||
value_store_util::DeleteValueStore(settings_namespace::SYNC,
|
||||
value_store_util::ModelType::EXTENSION,
|
||||
extension_id, storage_factory_);
|
||||
}
|
||||
|
||||
ValueStore* SyncValueStoreCache::GetStorage(const Extension* extension) {
|
||||
StorageMap::iterator iter = storage_map_.find(extension->id());
|
||||
value_store::ValueStore* SyncValueStoreCache::GetStorage(
|
||||
const Extension* extension) {
|
||||
auto iter = storage_map_.find(extension->id());
|
||||
if (iter != storage_map_.end())
|
||||
return iter->second.get();
|
||||
|
||||
ValueStoreFactory::ModelType model_type =
|
||||
extension->is_app() ? ValueStoreFactory::ModelType::APP
|
||||
: ValueStoreFactory::ModelType::EXTENSION;
|
||||
std::unique_ptr<ValueStore> store = storage_factory_->CreateSettingsStore(
|
||||
settings_namespace::SYNC, model_type, extension->id());
|
||||
value_store_util::ModelType model_type =
|
||||
extension->is_app() ? value_store_util::ModelType::APP
|
||||
: value_store_util::ModelType::EXTENSION;
|
||||
std::unique_ptr<value_store::ValueStore> store =
|
||||
value_store_util::CreateSettingsStore(settings_namespace::LOCAL,
|
||||
model_type, extension->id(),
|
||||
storage_factory_);
|
||||
std::unique_ptr<SettingsStorageQuotaEnforcer> storage(
|
||||
new SettingsStorageQuotaEnforcer(quota_, std::move(store)));
|
||||
DCHECK(storage.get());
|
||||
|
||||
ValueStore* storage_ptr = storage.get();
|
||||
value_store::ValueStore* storage_ptr = storage.get();
|
||||
storage_map_[extension->id()] = std::move(storage);
|
||||
return storage_ptr;
|
||||
}
|
||||
|
@ -14,10 +14,11 @@
|
||||
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
|
||||
#include "extensions/browser/api/storage/value_store_cache.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
namespace value_store {
|
||||
class ValueStoreFactory;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
// Based on LocalValueStoreCache
|
||||
@ -25,7 +26,8 @@ namespace cef {
|
||||
// another for extensions. Each backend takes care of persistence.
|
||||
class SyncValueStoreCache : public ValueStoreCache {
|
||||
public:
|
||||
explicit SyncValueStoreCache(const scoped_refptr<ValueStoreFactory>& factory);
|
||||
explicit SyncValueStoreCache(
|
||||
scoped_refptr<value_store::ValueStoreFactory> factory);
|
||||
~SyncValueStoreCache() override;
|
||||
|
||||
// ValueStoreCache implementation:
|
||||
@ -35,12 +37,13 @@ class SyncValueStoreCache : public ValueStoreCache {
|
||||
void DeleteStorageSoon(const std::string& extension_id) override;
|
||||
|
||||
private:
|
||||
using StorageMap = std::map<std::string, std::unique_ptr<ValueStore>>;
|
||||
using StorageMap =
|
||||
std::map<std::string, std::unique_ptr<value_store::ValueStore>>;
|
||||
|
||||
ValueStore* GetStorage(const Extension* extension);
|
||||
value_store::ValueStore* GetStorage(const Extension* extension);
|
||||
|
||||
// The Factory to use for creating new ValueStores.
|
||||
const scoped_refptr<ValueStoreFactory> storage_factory_;
|
||||
const scoped_refptr<value_store::ValueStoreFactory> storage_factory_;
|
||||
|
||||
// Quota limits (see SettingsStorageQuotaEnforcer).
|
||||
const SettingsStorageQuotaEnforcer::Limits quota_;
|
||||
@ -50,6 +53,7 @@ class SyncValueStoreCache : public ValueStoreCache {
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SyncValueStoreCache);
|
||||
};
|
||||
|
||||
} // namespace cef
|
||||
} // namespace extensions
|
||||
|
||||
|
@ -78,7 +78,7 @@ TabsCreateFunction::TabsCreateFunction() : cef_details_(this) {}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
|
||||
std::unique_ptr<tabs::Create::Params> params(
|
||||
tabs::Create::Params::Create(*args_));
|
||||
tabs::Create::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
||||
|
||||
CefExtensionFunctionDetails::OpenTabParams options;
|
||||
@ -119,7 +119,7 @@ content::WebContents* BaseAPIFunction::GetWebContents(int tab_id) {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||
std::unique_ptr<tabs::Update::Params> params(
|
||||
tabs::Update::Params::Create(*args_));
|
||||
tabs::Update::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
||||
|
||||
tab_id_ = params->tab_id ? *params->tab_id : -1;
|
||||
@ -256,11 +256,10 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
||||
if (init_result_)
|
||||
return init_result_.value();
|
||||
|
||||
const auto list_view = args_->GetList();
|
||||
if (list_view.size() < 2)
|
||||
if (args().size() < 2)
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
|
||||
const auto& tab_id_value = list_view[0];
|
||||
const auto& tab_id_value = args()[0];
|
||||
// |tab_id| is optional so it's ok if it's not there.
|
||||
int tab_id = -1;
|
||||
if (tab_id_value.is_int()) {
|
||||
@ -272,7 +271,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
||||
}
|
||||
|
||||
// |details| are not optional.
|
||||
const base::Value& details_value = list_view[1];
|
||||
const base::Value& details_value = args()[1];
|
||||
if (!details_value.is_dict())
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
std::unique_ptr<InjectDetails> details(new InjectDetails());
|
||||
@ -414,7 +413,7 @@ bool TabsRemoveCSSFunction::ShouldRemoveCSS() const {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::SetZoom::Params> params(
|
||||
tabs::SetZoom::Params::Create(*args_));
|
||||
tabs::SetZoom::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@ -444,7 +443,7 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoom::Params> params(
|
||||
tabs::GetZoom::Params::Create(*args_));
|
||||
tabs::GetZoom::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@ -463,7 +462,7 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
using api::tabs::ZoomSettings;
|
||||
|
||||
std::unique_ptr<tabs::SetZoomSettings::Params> params(
|
||||
tabs::SetZoomSettings::Params::Create(*args_));
|
||||
tabs::SetZoomSettings::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@ -512,7 +511,7 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoomSettings::Params> params(
|
||||
tabs::GetZoomSettings::Params::Create(*args_));
|
||||
tabs::GetZoomSettings::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
|
@ -420,7 +420,8 @@ StateStore* CefExtensionSystem::rules_store() {
|
||||
return rules_store_.get();
|
||||
}
|
||||
|
||||
scoped_refptr<ValueStoreFactory> CefExtensionSystem::store_factory() {
|
||||
scoped_refptr<value_store::ValueStoreFactory>
|
||||
CefExtensionSystem::store_factory() {
|
||||
return store_factory_;
|
||||
}
|
||||
|
||||
@ -518,18 +519,19 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
|
||||
}
|
||||
|
||||
void CefExtensionSystem::InitPrefs() {
|
||||
store_factory_ = new CefValueStoreFactory(browser_context_->GetPath());
|
||||
store_factory_ =
|
||||
new value_store::CefValueStoreFactory(browser_context_->GetPath());
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context_);
|
||||
|
||||
// Two state stores. The latter, which contains declarative rules, must be
|
||||
// loaded immediately so that the rules are ready before we issue network
|
||||
// requests.
|
||||
state_store_.reset(new StateStore(
|
||||
profile, store_factory_, ValueStoreFrontend::BackendType::STATE, true));
|
||||
state_store_ = std::make_unique<StateStore>(
|
||||
profile, store_factory_, StateStore::BackendType::STATE, true);
|
||||
|
||||
rules_store_.reset(new StateStore(
|
||||
profile, store_factory_, ValueStoreFrontend::BackendType::RULES, false));
|
||||
rules_store_ = std::make_unique<StateStore>(
|
||||
profile, store_factory_, StateStore::BackendType::RULES, false);
|
||||
}
|
||||
|
||||
// Implementation based on ComponentLoader::CreateExtension.
|
||||
|
@ -90,7 +90,7 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
UserScriptManager* user_script_manager() override;
|
||||
StateStore* state_store() override;
|
||||
StateStore* rules_store() override;
|
||||
scoped_refptr<ValueStoreFactory> store_factory() override;
|
||||
scoped_refptr<value_store::ValueStoreFactory> store_factory() override;
|
||||
InfoMap* info_map() override;
|
||||
QuotaService* quota_service() override;
|
||||
AppSorting* app_sorting() override;
|
||||
@ -176,7 +176,7 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
|
||||
std::unique_ptr<StateStore> state_store_;
|
||||
std::unique_ptr<StateStore> rules_store_;
|
||||
scoped_refptr<ValueStoreFactory> store_factory_;
|
||||
scoped_refptr<value_store::ValueStoreFactory> store_factory_;
|
||||
|
||||
// Signaled when the extension system has completed its startup tasks.
|
||||
base::OneShotEvent ready_;
|
||||
|
@ -65,7 +65,7 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
|
||||
|
||||
void CefExtensionsAPIClient::AddAdditionalValueStoreCaches(
|
||||
content::BrowserContext* context,
|
||||
const scoped_refptr<ValueStoreFactory>& factory,
|
||||
const scoped_refptr<value_store::ValueStoreFactory>& factory,
|
||||
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
|
||||
observers,
|
||||
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_API_CLIENT_H_
|
||||
|
||||
#include "extensions/browser/api/extensions_api_client.h"
|
||||
#include "extensions/browser/value_store/value_store_factory.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@ -31,7 +32,7 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
|
||||
// to |caches|. By default adds nothing.
|
||||
void AddAdditionalValueStoreCaches(
|
||||
content::BrowserContext* context,
|
||||
const scoped_refptr<ValueStoreFactory>& factory,
|
||||
const scoped_refptr<value_store::ValueStoreFactory>& factory,
|
||||
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
|
||||
observers,
|
||||
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches)
|
||||
|
@ -5,12 +5,14 @@
|
||||
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store.h"
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/notreached.h"
|
||||
|
||||
namespace value_store {
|
||||
|
||||
namespace {
|
||||
|
||||
const char kGenericErrorMessage[] = "CefValueStore configured to error";
|
||||
@ -23,9 +25,8 @@ ValueStore::Status CreateStatusCopy(const ValueStore::Status& status) {
|
||||
|
||||
} // namespace
|
||||
|
||||
CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {}
|
||||
|
||||
CefValueStore::~CefValueStore() {}
|
||||
CefValueStore::CefValueStore() = default;
|
||||
CefValueStore::~CefValueStore() = default;
|
||||
|
||||
void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
status_ = ValueStore::Status(status_code, kGenericErrorMessage);
|
||||
@ -33,19 +34,19 @@ void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::string& key) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
NOTREACHED() << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::vector<std::string>& keys) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
NOTREACHED() << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse() {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
NOTREACHED() << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
|
||||
const std::string& key,
|
||||
const base::Value& value) {
|
||||
base::DictionaryValue settings;
|
||||
settings.SetWithoutPathExpansion(key, value.CreateDeepCopy());
|
||||
settings.SetKey(key, value.Clone());
|
||||
return Set(options, settings);
|
||||
}
|
||||
|
||||
@ -134,4 +135,6 @@ ValueStore::WriteResult CefValueStore::Clear() {
|
||||
keys.push_back(it.key());
|
||||
}
|
||||
return Remove(keys);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace value_store
|
||||
|
@ -15,25 +15,29 @@
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/value_store/value_store.h"
|
||||
|
||||
// Implementation Based on TestingValueStore
|
||||
// ValueStore with an in-memory storage but the ability to
|
||||
// optionally fail all operations.
|
||||
namespace value_store {
|
||||
|
||||
// Implementation Based on TestingValueStore.
|
||||
// ValueStore with an in-memory storage but the ability to optionally fail all
|
||||
// operations.
|
||||
class CefValueStore : public ValueStore {
|
||||
public:
|
||||
CefValueStore();
|
||||
~CefValueStore() override;
|
||||
CefValueStore(const CefValueStore&) = delete;
|
||||
CefValueStore& operator=(const CefValueStore&) = delete;
|
||||
|
||||
// Sets the error code for requests. If OK, errors won't be thrown.
|
||||
// Defaults to OK.
|
||||
void set_status_code(StatusCode status_code);
|
||||
|
||||
// Accessors for the number of reads/writes done by this value store. Each
|
||||
// Get* operation (except for the BytesInUse ones) counts as one read, and
|
||||
// each Set*/Remove/Clear operation counts as one write. This is useful in
|
||||
// tests seeking to assert that some number of reads/writes to their
|
||||
// underlying value store have (or have not) happened.
|
||||
int read_count() const { return read_count_; }
|
||||
int write_count() const { return write_count_; }
|
||||
|
||||
// Sets the error code for requests. If OK, errors won't be thrown.
|
||||
// Defaults to OK.
|
||||
void set_status_code(StatusCode status_code);
|
||||
int read_count() { return read_count_; }
|
||||
int write_count() { return write_count_; }
|
||||
|
||||
// ValueStore implementation.
|
||||
size_t GetBytesInUse(const std::string& key) override;
|
||||
@ -53,11 +57,11 @@ class CefValueStore : public ValueStore {
|
||||
|
||||
private:
|
||||
base::DictionaryValue storage_;
|
||||
int read_count_;
|
||||
int write_count_;
|
||||
int read_count_ = 0;
|
||||
int write_count_ = 0;
|
||||
ValueStore::Status status_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueStore);
|
||||
};
|
||||
|
||||
} // namespace value_store
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_H_
|
||||
|
@ -5,9 +5,11 @@
|
||||
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store_factory.h"
|
||||
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store.h"
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "extensions/browser/value_store/leveldb_value_store.h"
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -15,177 +17,58 @@ const char kUMAClientName[] = "Cef";
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace extensions {
|
||||
|
||||
using SettingsNamespace = settings_namespace::Namespace;
|
||||
|
||||
CefValueStoreFactory::StorageHelper::StorageHelper() = default;
|
||||
|
||||
CefValueStoreFactory::StorageHelper::~StorageHelper() = default;
|
||||
|
||||
std::set<ExtensionId> CefValueStoreFactory::StorageHelper::GetKnownExtensionIDs(
|
||||
ModelType model_type) const {
|
||||
std::set<ExtensionId> ids;
|
||||
switch (model_type) {
|
||||
case ValueStoreFactory::ModelType::APP:
|
||||
for (const auto& key : app_stores_)
|
||||
ids.insert(key.first);
|
||||
break;
|
||||
case ValueStoreFactory::ModelType::EXTENSION:
|
||||
for (const auto& key : extension_stores_)
|
||||
ids.insert(key.first);
|
||||
break;
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::StorageHelper::Reset() {
|
||||
app_stores_.clear();
|
||||
extension_stores_.clear();
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::StorageHelper::AddValueStore(
|
||||
const ExtensionId& extension_id,
|
||||
ValueStore* value_store,
|
||||
ModelType model_type) {
|
||||
if (model_type == ValueStoreFactory::ModelType::APP) {
|
||||
DCHECK(app_stores_.find(extension_id) == app_stores_.end());
|
||||
app_stores_[extension_id] = value_store;
|
||||
} else {
|
||||
DCHECK(extension_stores_.find(extension_id) == extension_stores_.end());
|
||||
extension_stores_[extension_id] = value_store;
|
||||
}
|
||||
return value_store;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::StorageHelper::DeleteSettings(
|
||||
const ExtensionId& extension_id,
|
||||
ModelType model_type) {
|
||||
switch (model_type) {
|
||||
case ValueStoreFactory::ModelType::APP:
|
||||
app_stores_.erase(extension_id);
|
||||
break;
|
||||
case ValueStoreFactory::ModelType::EXTENSION:
|
||||
extension_stores_.erase(extension_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CefValueStoreFactory::StorageHelper::HasSettings(
|
||||
const ExtensionId& extension_id,
|
||||
ModelType model_type) const {
|
||||
switch (model_type) {
|
||||
case ValueStoreFactory::ModelType::APP:
|
||||
return app_stores_.find(extension_id) != app_stores_.end();
|
||||
case ValueStoreFactory::ModelType::EXTENSION:
|
||||
return extension_stores_.find(extension_id) != extension_stores_.end();
|
||||
}
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::StorageHelper::GetExisting(
|
||||
const ExtensionId& extension_id) const {
|
||||
auto it = app_stores_.find(extension_id);
|
||||
if (it != app_stores_.end())
|
||||
return it->second;
|
||||
it = extension_stores_.find(extension_id);
|
||||
if (it != extension_stores_.end())
|
||||
return it->second;
|
||||
return nullptr;
|
||||
}
|
||||
namespace value_store {
|
||||
|
||||
CefValueStoreFactory::CefValueStoreFactory() = default;
|
||||
|
||||
CefValueStoreFactory::CefValueStoreFactory(const base::FilePath& db_path)
|
||||
: db_path_(db_path) {}
|
||||
|
||||
CefValueStoreFactory::~CefValueStoreFactory() {}
|
||||
CefValueStoreFactory::~CefValueStoreFactory() = default;
|
||||
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateRulesStore() {
|
||||
if (db_path_.empty())
|
||||
last_created_store_ = new CefValueStore();
|
||||
else
|
||||
last_created_store_ = new LeveldbValueStore(kUMAClientName, db_path_);
|
||||
return base::WrapUnique(last_created_store_);
|
||||
}
|
||||
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateStateStore() {
|
||||
return CreateRulesStore();
|
||||
}
|
||||
|
||||
CefValueStoreFactory::StorageHelper& CefValueStoreFactory::GetStorageHelper(
|
||||
SettingsNamespace settings_namespace) {
|
||||
switch (settings_namespace) {
|
||||
case settings_namespace::LOCAL:
|
||||
return local_helper_;
|
||||
case settings_namespace::SYNC:
|
||||
return sync_helper_;
|
||||
case settings_namespace::MANAGED:
|
||||
return managed_helper_;
|
||||
case settings_namespace::INVALID:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
return local_helper_;
|
||||
}
|
||||
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateSettingsStore(
|
||||
SettingsNamespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) {
|
||||
std::unique_ptr<ValueStore> settings_store(CreateRulesStore());
|
||||
// Note: This factory is purposely keeping the raw pointers to each ValueStore
|
||||
// created. Tests using CefValueStoreFactory must be careful to keep
|
||||
// those ValueStore's alive for the duration of their test.
|
||||
GetStorageHelper(settings_namespace)
|
||||
.AddValueStore(extension_id, settings_store.get(), model_type);
|
||||
return settings_store;
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateValueStore(
|
||||
const base::FilePath& directory,
|
||||
const std::string& uma_client_name) {
|
||||
std::unique_ptr<ValueStore> value_store(CreateStore());
|
||||
// This factory is purposely keeping the raw pointers to each ValueStore
|
||||
// created. Cefs using CefValueStoreFactory must be careful to keep
|
||||
// those ValueStore's alive for the duration of their test.
|
||||
value_store_map_[directory] = value_store.get();
|
||||
return value_store;
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::LastCreatedStore() const {
|
||||
return last_created_store_;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::DeleteSettings(SettingsNamespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) {
|
||||
GetStorageHelper(settings_namespace).DeleteSettings(extension_id, model_type);
|
||||
void CefValueStoreFactory::DeleteValueStore(const base::FilePath& directory) {
|
||||
value_store_map_.erase(directory);
|
||||
}
|
||||
|
||||
bool CefValueStoreFactory::HasSettings(SettingsNamespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) {
|
||||
return GetStorageHelper(settings_namespace)
|
||||
.HasSettings(extension_id, model_type);
|
||||
}
|
||||
|
||||
std::set<ExtensionId> CefValueStoreFactory::GetKnownExtensionIDs(
|
||||
SettingsNamespace settings_namespace,
|
||||
ModelType model_type) const {
|
||||
return const_cast<CefValueStoreFactory*>(this)
|
||||
->GetStorageHelper(settings_namespace)
|
||||
.GetKnownExtensionIDs(model_type);
|
||||
bool CefValueStoreFactory::HasValueStore(const base::FilePath& directory) {
|
||||
return base::Contains(value_store_map_, directory);
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::GetExisting(
|
||||
const ExtensionId& extension_id) const {
|
||||
ValueStore* existing_store = local_helper_.GetExisting(extension_id);
|
||||
if (existing_store)
|
||||
return existing_store;
|
||||
existing_store = sync_helper_.GetExisting(extension_id);
|
||||
if (existing_store)
|
||||
return existing_store;
|
||||
existing_store = managed_helper_.GetExisting(extension_id);
|
||||
DCHECK(existing_store != nullptr);
|
||||
return existing_store;
|
||||
const base::FilePath& directory) const {
|
||||
auto it = value_store_map_.find(directory);
|
||||
DCHECK(it != value_store_map_.end());
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::Reset() {
|
||||
last_created_store_ = nullptr;
|
||||
local_helper_.Reset();
|
||||
sync_helper_.Reset();
|
||||
managed_helper_.Reset();
|
||||
value_store_map_.clear();
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateStore() {
|
||||
std::unique_ptr<ValueStore> store;
|
||||
if (db_path_.empty())
|
||||
store = std::make_unique<CefValueStore>();
|
||||
else
|
||||
store = std::make_unique<LeveldbValueStore>(kUMAClientName, db_path_);
|
||||
last_created_store_ = store.get();
|
||||
return store;
|
||||
}
|
||||
|
||||
} // namespace value_store
|
||||
|
@ -8,90 +8,54 @@
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "extensions/browser/value_store/value_store_factory.h"
|
||||
#include "extensions/common/extension_id.h"
|
||||
|
||||
namespace value_store {
|
||||
|
||||
class ValueStore;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
// Will either open a database on disk (if path provided) returning a
|
||||
// |LeveldbValueStore|. Otherwise a new |CefValueStore| instance will be
|
||||
// returned.
|
||||
// Based on TestValueStoreFactory. Will either open a database on disk (if path
|
||||
// provided) returning a |LeveldbValueStore|. Otherwise a new |CefingValueStore|
|
||||
// instance will be returned.
|
||||
class CefValueStoreFactory : public ValueStoreFactory {
|
||||
public:
|
||||
CefValueStoreFactory();
|
||||
explicit CefValueStoreFactory(const base::FilePath& db_path);
|
||||
CefValueStoreFactory(const CefValueStoreFactory&) = delete;
|
||||
CefValueStoreFactory& operator=(const CefValueStoreFactory&) = delete;
|
||||
|
||||
// ValueStoreFactory
|
||||
std::unique_ptr<ValueStore> CreateRulesStore() override;
|
||||
std::unique_ptr<ValueStore> CreateStateStore() override;
|
||||
std::unique_ptr<ValueStore> CreateSettingsStore(
|
||||
settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) override;
|
||||
void DeleteSettings(settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) override;
|
||||
bool HasSettings(settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) override;
|
||||
std::set<ExtensionId> GetKnownExtensionIDs(
|
||||
settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type) const override;
|
||||
std::unique_ptr<ValueStore> CreateValueStore(
|
||||
const base::FilePath& directory,
|
||||
const std::string& uma_client_name) override;
|
||||
void DeleteValueStore(const base::FilePath& directory) override;
|
||||
bool HasValueStore(const base::FilePath& directory) override;
|
||||
|
||||
// Return the last created |ValueStore|. Use with caution as this may return
|
||||
// a dangling pointer since the creator now owns the ValueStore which can be
|
||||
// deleted at any time.
|
||||
ValueStore* LastCreatedStore() const;
|
||||
// Return a previously created |ValueStore| for an extension.
|
||||
ValueStore* GetExisting(const ExtensionId& extension_id) const;
|
||||
// Return the previously created |ValueStore| in the given directory.
|
||||
ValueStore* GetExisting(const base::FilePath& directory) const;
|
||||
// Reset this class (as if just created).
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
// Manages a collection of |ValueStore|'s created for an app/extension.
|
||||
// One of these exists for each setting type.
|
||||
class StorageHelper {
|
||||
public:
|
||||
StorageHelper();
|
||||
~StorageHelper();
|
||||
std::set<ExtensionId> GetKnownExtensionIDs(ModelType model_type) const;
|
||||
ValueStore* AddValueStore(const ExtensionId& extension_id,
|
||||
ValueStore* value_store,
|
||||
ModelType model_type);
|
||||
void DeleteSettings(const ExtensionId& extension_id, ModelType model_type);
|
||||
bool HasSettings(const ExtensionId& extension_id,
|
||||
ModelType model_type) const;
|
||||
void Reset();
|
||||
ValueStore* GetExisting(const ExtensionId& extension_id) const;
|
||||
|
||||
private:
|
||||
std::map<ExtensionId, ValueStore*> app_stores_;
|
||||
std::map<ExtensionId, ValueStore*> extension_stores_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(StorageHelper);
|
||||
};
|
||||
|
||||
StorageHelper& GetStorageHelper(
|
||||
settings_namespace::Namespace settings_namespace);
|
||||
|
||||
~CefValueStoreFactory() override;
|
||||
|
||||
std::unique_ptr<ValueStore> CreateStore();
|
||||
|
||||
base::FilePath db_path_;
|
||||
ValueStore* last_created_store_ = nullptr;
|
||||
|
||||
// None of these value stores are owned by this factory, so care must be
|
||||
// taken when calling GetExisting.
|
||||
StorageHelper local_helper_;
|
||||
StorageHelper sync_helper_;
|
||||
StorageHelper managed_helper_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueStoreFactory);
|
||||
// A mapping from directories to their ValueStore. None of these value
|
||||
// stores are owned by this factory, so care must be taken when calling
|
||||
// GetExisting.
|
||||
std::map<base::FilePath, ValueStore*> value_store_map_;
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
} // namespace value_store
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_FACTORY_H_
|
||||
|
@ -205,8 +205,9 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint(
|
||||
const gfx::Rect& bounds_in_screen = window_x11_->GetBoundsInScreen();
|
||||
return gfx::Point(bounds_in_screen.x() + view.x(),
|
||||
bounds_in_screen.y() + view.y());
|
||||
#endif // defined(USE_X11)
|
||||
#else // !defined(USE_X11)
|
||||
return gfx::Point();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) {
|
||||
|
@ -357,7 +357,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
// Any unhandled keyboard/character messages are sent to DefWindowProc so that
|
||||
// shortcut keys work correctly.
|
||||
if (event.os_event) {
|
||||
const MSG& msg = event.os_event->native_event();
|
||||
const auto& msg = event.os_event->native_event();
|
||||
return !DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
} else {
|
||||
MSG msg = {};
|
||||
@ -402,7 +402,8 @@ CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
if (!event.os_event)
|
||||
return NULL;
|
||||
return const_cast<CefEventHandle>(&event.os_event->native_event());
|
||||
return ChromeToWindowsType(
|
||||
const_cast<CHROME_MSG*>(&event.os_event->native_event()));
|
||||
}
|
||||
|
||||
std::unique_ptr<CefFileDialogRunner>
|
||||
|
@ -69,7 +69,7 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
NSTimeInterval eventTime = [currentEvent timestamp];
|
||||
NSEvent* clickEvent = [NSEvent mouseEventWithType:NSRightMouseDown
|
||||
location:position
|
||||
modifierFlags:NSRightMouseDownMask
|
||||
modifierFlags:0
|
||||
timestamp:eventTime
|
||||
windowNumber:[window windowNumber]
|
||||
context:nil
|
||||
|
@ -572,7 +572,8 @@ void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||
|
||||
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) {
|
||||
const gfx::Rect& bounds,
|
||||
const gfx::Rect& anchor_rect) {
|
||||
DCHECK_EQ(parent_host_view_, parent_host_view);
|
||||
DCHECK(browser_impl_);
|
||||
|
||||
@ -591,8 +592,8 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
|
||||
CefRect view_rect;
|
||||
handler->GetViewRect(browser_impl_.get(), view_rect);
|
||||
gfx::Rect client_pos(pos.x() - view_rect.x, pos.y() - view_rect.y,
|
||||
pos.width(), pos.height());
|
||||
gfx::Rect client_pos(bounds.x() - view_rect.x, bounds.y() - view_rect.y,
|
||||
bounds.width(), bounds.height());
|
||||
|
||||
popup_position_ = client_pos;
|
||||
|
||||
|
@ -145,7 +145,8 @@ class CefRenderWidgetHostViewOSR
|
||||
// RenderWidgetHostViewBase implementation.
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
const gfx::Rect& bounds,
|
||||
const gfx::Rect& anchor_rect) override;
|
||||
void UpdateCursor(const content::WebCursor& cursor) override;
|
||||
void SetIsLoading(bool is_loading) override;
|
||||
void RenderProcessGone() override;
|
||||
|
@ -143,7 +143,8 @@ void SetChromePrefs(Profile* profile, blink::web_pref::WebPreferences& web) {
|
||||
|
||||
// Extension preferences.
|
||||
// Should match ChromeContentBrowserClientExtensionsPart::OverrideWebkitPrefs.
|
||||
void SetExtensionPrefs(content::RenderViewHost* rvh,
|
||||
void SetExtensionPrefs(content::WebContents* web_contents,
|
||||
content::RenderViewHost* rvh,
|
||||
blink::web_pref::WebPreferences& web) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
@ -161,7 +162,8 @@ void SetExtensionPrefs(content::RenderViewHost* rvh,
|
||||
// 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->GetMainFrame()->GetSiteInstance()->GetSiteURL();
|
||||
const GURL& site_url =
|
||||
web_contents->GetMainFrame()->GetSiteInstance()->GetSiteURL();
|
||||
if (!site_url.SchemeIs(extensions::kExtensionScheme))
|
||||
return;
|
||||
|
||||
@ -410,11 +412,13 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
|
||||
break;
|
||||
}
|
||||
|
||||
auto web_contents = content::WebContents::FromRenderViewHost(rvh);
|
||||
UpdatePreferredColorScheme(
|
||||
&web, rvh->GetMainFrame()->GetSiteInstance()->GetSiteURL(), native_theme);
|
||||
&web, web_contents->GetMainFrame()->GetSiteInstance()->GetSiteURL(),
|
||||
native_theme);
|
||||
|
||||
// Set preferences based on the extension.
|
||||
SetExtensionPrefs(rvh, web);
|
||||
SetExtensionPrefs(web_contents, rvh, web);
|
||||
|
||||
if (browser) {
|
||||
// Set preferences based on CefBrowserSettings.
|
||||
|
@ -55,11 +55,15 @@ bool CefSSLHostStateDelegate::DidHostRunInsecureContent(
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefSSLHostStateDelegate::AllowHttpForHost(const std::string& host) {
|
||||
void CefSSLHostStateDelegate::AllowHttpForHost(
|
||||
const std::string& host,
|
||||
content::WebContents* web_content) {
|
||||
// Intentional no-op.
|
||||
}
|
||||
|
||||
bool CefSSLHostStateDelegate::IsHttpAllowedForHost(const std::string& host) {
|
||||
bool CefSSLHostStateDelegate::IsHttpAllowedForHost(
|
||||
const std::string& host,
|
||||
content::WebContents* web_content) {
|
||||
// Intentional no-op. Return value does not matter as HTTPS-Only Mode is not
|
||||
// enabled.
|
||||
return false;
|
||||
|
@ -64,8 +64,10 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate {
|
||||
bool DidHostRunInsecureContent(const std::string& host,
|
||||
int child_id,
|
||||
InsecureContentType content_type) override;
|
||||
void AllowHttpForHost(const std::string& host) override;
|
||||
bool IsHttpAllowedForHost(const std::string& host) override;
|
||||
void AllowHttpForHost(const std::string& host,
|
||||
content::WebContents* web_content) override;
|
||||
bool IsHttpAllowedForHost(const std::string& host,
|
||||
content::WebContents* web_content) override;
|
||||
void RevokeUserAllowExceptions(const std::string& host) override;
|
||||
bool HasAllowException(const std::string& host,
|
||||
content::WebContents* web_contents) override;
|
||||
|
@ -359,7 +359,7 @@ void AlloyMainDelegate::PreSandboxStartup() {
|
||||
chrome::DIR_USER_DATA);
|
||||
|
||||
InitializeResourceBundle();
|
||||
MaybeInitializeGDI();
|
||||
MaybePatchGdiGetFontData();
|
||||
}
|
||||
|
||||
void AlloyMainDelegate::SandboxInitialized(const std::string& process_type) {
|
||||
@ -512,7 +512,7 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
||||
|
||||
if (base::PathExists(resources_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(resources_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
ui::kScaleFactorNone);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load resources.pak";
|
||||
}
|
||||
@ -520,19 +520,19 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
||||
// Always load the 1x data pack first as the 2x data pack contains both 1x
|
||||
// and 2x images. The 1x data pack only has 1x images, thus passes in an
|
||||
// accurate scale factor to gfx::ImageSkia::AddRepresentation.
|
||||
if (resource_util::IsScaleFactorSupported(ui::SCALE_FACTOR_100P)) {
|
||||
if (resource_util::IsScaleFactorSupported(ui::k100Percent)) {
|
||||
if (base::PathExists(chrome_100_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(chrome_100_percent_pak_file,
|
||||
ui::SCALE_FACTOR_100P);
|
||||
ui::k100Percent);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load chrome_100_percent.pak";
|
||||
}
|
||||
}
|
||||
|
||||
if (resource_util::IsScaleFactorSupported(ui::SCALE_FACTOR_200P)) {
|
||||
if (resource_util::IsScaleFactorSupported(ui::k200Percent)) {
|
||||
if (base::PathExists(chrome_200_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(chrome_200_percent_pak_file,
|
||||
ui::SCALE_FACTOR_200P);
|
||||
ui::k200Percent);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load chrome_200_percent.pak";
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "base/containers/contains.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/net_buildflags.h"
|
||||
#include "url/url_constants.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
@ -56,22 +55,19 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
||||
|
||||
bool IsInternalHandledScheme(const std::string& scheme) {
|
||||
static const char* schemes[] = {
|
||||
url::kAboutScheme,
|
||||
url::kBlobScheme,
|
||||
content::kChromeDevToolsScheme,
|
||||
content::kChromeUIScheme,
|
||||
url::kDataScheme,
|
||||
extensions::kExtensionScheme,
|
||||
url::kFileScheme,
|
||||
url::kFileSystemScheme,
|
||||
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
||||
url::kFtpScheme,
|
||||
#endif
|
||||
url::kHttpScheme,
|
||||
url::kHttpsScheme,
|
||||
url::kJavaScriptScheme,
|
||||
url::kWsScheme,
|
||||
url::kWssScheme,
|
||||
url::kAboutScheme,
|
||||
url::kBlobScheme,
|
||||
content::kChromeDevToolsScheme,
|
||||
content::kChromeUIScheme,
|
||||
url::kDataScheme,
|
||||
extensions::kExtensionScheme,
|
||||
url::kFileScheme,
|
||||
url::kFileSystemScheme,
|
||||
url::kHttpScheme,
|
||||
url::kHttpsScheme,
|
||||
url::kJavaScriptScheme,
|
||||
url::kWsScheme,
|
||||
url::kWssScheme,
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) {
|
||||
|
@ -50,7 +50,7 @@ bool CefResourceBundleDelegate::GetRawDataResource(
|
||||
if (handler.get()) {
|
||||
void* data = nullptr;
|
||||
size_t data_size = 0;
|
||||
if (scale_factor != ui::SCALE_FACTOR_NONE) {
|
||||
if (scale_factor != ui::kScaleFactorNone) {
|
||||
if (handler->GetDataResourceForScale(
|
||||
resource_id, static_cast<cef_scale_factor_t>(scale_factor),
|
||||
data, data_size)) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
#include "ui/base/resource/scale_factor.h"
|
||||
#include "ui/base/resource/resource_scale_factor.h"
|
||||
|
||||
namespace base {
|
||||
class CommandLine;
|
||||
|
@ -1107,7 +1107,7 @@ CefRefPtr<CefListValue> CefListValueImpl::Copy() {
|
||||
bool CefListValueImpl::SetSize(size_t size) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
|
||||
size_t current_size = const_value().GetSize();
|
||||
size_t current_size = const_value().GetList().size();
|
||||
if (size < current_size) {
|
||||
// Clean up any values above the requested size.
|
||||
for (size_t i = current_size - 1; i >= size; --i)
|
||||
@ -1121,7 +1121,7 @@ bool CefListValueImpl::SetSize(size_t size) {
|
||||
|
||||
size_t CefListValueImpl::GetSize() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, 0);
|
||||
return const_value().GetSize();
|
||||
return const_value().GetList().size();
|
||||
}
|
||||
|
||||
bool CefListValueImpl::Clear() {
|
||||
|
@ -30,7 +30,6 @@ class CefExtensionsRendererClient;
|
||||
class Dispatcher;
|
||||
class DispatcherDelegate;
|
||||
class ExtensionsClient;
|
||||
class ExtensionsGuestViewContainerDispatcher;
|
||||
class ExtensionsRendererClient;
|
||||
class ResourceRequestPolicy;
|
||||
} // namespace extensions
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "chrome/renderer/extensions/extension_process_policy.h"
|
||||
#include "chrome/renderer/extensions/resource_request_policy.h"
|
||||
#include "components/guest_view/renderer/guest_view_container_dispatcher.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "extensions/renderer/dispatcher.h"
|
||||
#include "extensions/renderer/extension_frame_helper.h"
|
||||
#include "extensions/renderer/extensions_render_frame_observer.h"
|
||||
#include "extensions/renderer/guest_view/extensions_guest_view_container_dispatcher.h"
|
||||
#include "extensions/renderer/renderer_extension_registry.h"
|
||||
#include "extensions/renderer/script_context.h"
|
||||
#include "third_party/blink/public/web/web_document.h"
|
||||
@ -82,13 +82,14 @@ bool CefExtensionsRendererClient::ExtensionAPIEnabledForServiceWorkerScript(
|
||||
void CefExtensionsRendererClient::RenderThreadStarted() {
|
||||
content::RenderThread* thread = content::RenderThread::Get();
|
||||
|
||||
extension_dispatcher_.reset(new extensions::Dispatcher(
|
||||
std::make_unique<extensions::CefExtensionsDispatcherDelegate>()));
|
||||
extension_dispatcher_ = std::make_unique<extensions::Dispatcher>(
|
||||
std::make_unique<extensions::CefExtensionsDispatcherDelegate>());
|
||||
extension_dispatcher_->OnRenderThreadStarted(thread);
|
||||
resource_request_policy_.reset(
|
||||
new extensions::ResourceRequestPolicy(extension_dispatcher_.get()));
|
||||
guest_view_container_dispatcher_.reset(
|
||||
new extensions::ExtensionsGuestViewContainerDispatcher());
|
||||
resource_request_policy_ =
|
||||
std::make_unique<extensions::ResourceRequestPolicy>(
|
||||
extension_dispatcher_.get());
|
||||
guest_view_container_dispatcher_ =
|
||||
std::make_unique<guest_view::GuestViewContainerDispatcher>();
|
||||
|
||||
thread->AddObserver(extension_dispatcher_.get());
|
||||
thread->AddObserver(guest_view_container_dispatcher_.get());
|
||||
|
@ -32,6 +32,10 @@ class RenderFrame;
|
||||
struct WebPluginInfo;
|
||||
} // namespace content
|
||||
|
||||
namespace guest_view {
|
||||
class GuestViewContainerDispatcher;
|
||||
}
|
||||
|
||||
namespace url {
|
||||
class Origin;
|
||||
}
|
||||
@ -40,7 +44,6 @@ namespace extensions {
|
||||
|
||||
class Dispatcher;
|
||||
class DispatcherDelegate;
|
||||
class ExtensionsGuestViewContainerDispatcher;
|
||||
class ResourceRequestPolicy;
|
||||
|
||||
class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
||||
@ -79,7 +82,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
||||
|
||||
private:
|
||||
std::unique_ptr<extensions::Dispatcher> extension_dispatcher_;
|
||||
std::unique_ptr<extensions::ExtensionsGuestViewContainerDispatcher>
|
||||
std::unique_ptr<guest_view::GuestViewContainerDispatcher>
|
||||
guest_view_container_dispatcher_;
|
||||
std::unique_ptr<extensions::ResourceRequestPolicy> resource_request_policy_;
|
||||
|
||||
|
Reference in New Issue
Block a user