Update to Chromium version 94.0.4606.0 (#911515)

This commit is contained in:
Marshall Greenblatt
2021-08-19 19:40:49 -04:00
parent 955097ea77
commit 25c1947f1d
85 changed files with 745 additions and 726 deletions

View File

@@ -1316,9 +1316,9 @@ void AlloyBrowserHostImpl::WebContentsCreated(
std::move(platform_delegate), /*cef_extension=*/nullptr);
}
void AlloyBrowserHostImpl::DidNavigateMainFramePostCommit(
void AlloyBrowserHostImpl::DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) {
contents_delegate_->DidNavigateMainFramePostCommit(web_contents);
contents_delegate_->DidNavigatePrimaryMainFramePostCommit(web_contents);
}
content::JavaScriptDialogManager*

View File

@@ -251,7 +251,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) override;
void DidNavigateMainFramePostCommit(
void DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) override;
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
content::WebContents* source) override;

View File

@@ -30,6 +30,7 @@
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
#include "libcef/browser/plugins/plugin_service_filter.h"
#include "libcef/browser/prefs/renderer_prefs.h"
#include "libcef/browser/printing/print_view_manager.h"
#include "libcef/browser/speech_recognition_manager_delegate.h"
#include "libcef/browser/ssl_info_impl.h"
#include "libcef/browser/thread_util.h"
@@ -103,6 +104,7 @@
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_web_contents_observer.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
@@ -967,6 +969,28 @@ AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
return std::make_unique<CefDevToolsManagerDelegate>();
}
bool AlloyContentBrowserClient::BindAssociatedReceiverFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle* handle) {
if (interface_name == extensions::mojom::LocalFrameHost::Name_) {
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(
std::move(*handle)),
render_frame_host);
return true;
}
if (interface_name == printing::mojom::PrintManagerHost::Name_) {
printing::CefPrintViewManager::BindPrintManagerHost(
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>(
std::move(*handle)),
render_frame_host);
return true;
}
return false;
}
std::vector<std::unique_ptr<content::NavigationThrottle>>
AlloyContentBrowserClient::CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) {

View File

@@ -111,6 +111,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override;
bool BindAssociatedReceiverFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle* handle) override;
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override;

View File

@@ -161,7 +161,7 @@ bool CefBrowserContentsDelegate::DidAddMessageToConsole(
return false;
}
void CefBrowserContentsDelegate::DidNavigateMainFramePostCommit(
void CefBrowserContentsDelegate::DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) {
has_document_ = false;
OnStateChanged(State::kDocument);

View File

@@ -91,7 +91,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
void DidNavigateMainFramePostCommit(
void DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) override;
void EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,

View File

@@ -74,7 +74,7 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
}
// Default to creating a new/unique OffTheRecord profile.
ProfileCreated(nullptr, Profile::CreateStatus::CREATE_STATUS_CANCELED);
ProfileCreated(nullptr, Profile::CreateStatus::CREATE_STATUS_LOCAL_FAIL);
}
void ChromeBrowserContext::Shutdown() {

View File

@@ -170,10 +170,10 @@ bool ChromeBrowserDelegate::DidAddMessageToConsole(
return false;
}
void ChromeBrowserDelegate::DidNavigateMainFramePostCommit(
void ChromeBrowserDelegate::DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) {
if (auto delegate = GetDelegateForWebContents(web_contents)) {
delegate->DidNavigateMainFramePostCommit(web_contents);
delegate->DidNavigatePrimaryMainFramePostCommit(web_contents);
}
}

View File

@@ -73,7 +73,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
void DidNavigateMainFramePostCommit(
void DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) override;
void EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,

View File

@@ -11,13 +11,13 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/json/json_writer.h"
#include "base/json/values_util.h"
#include "base/lazy_instance.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/util/values/values_util.h"
#include "base/values.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
@@ -83,7 +83,7 @@ void CefDevToolsFileManager::Save(const std::string& url,
const base::Value* path_value;
if (file_map->Get(base::MD5String(url), &path_value)) {
absl::optional<base::FilePath> path = util::ValueToFilePath(*path_value);
absl::optional<base::FilePath> path = base::ValueToFilePath(*path_value);
if (path)
initial_path = std::move(*path);
}
@@ -145,7 +145,7 @@ void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
DictionaryPrefUpdate update(prefs_, prefs::kDevToolsEditedFiles);
base::DictionaryValue* files_map = update.Get();
files_map->SetKey(base::MD5String(url), util::FilePathToValue(path));
files_map->SetKey(base::MD5String(url), base::FilePathToValue(path));
std::string file_system_path = path.AsUTF8Unsafe();
std::move(callback).Run(file_system_path);
file_task_runner_->PostTask(FROM_HERE,

View File

@@ -66,17 +66,22 @@
namespace {
// This constant should be in sync with the constant in
// chrome/browser/devtools/devtools_ui_bindings.cc.
constexpr size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
constexpr int kMaxLogLineLength = 1024;
static std::string GetFrontendURL() {
return base::StringPrintf("%s://%s/devtools_app.html",
content::kChromeDevToolsScheme,
scheme::kChromeDevToolsHost);
}
std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
const net::HttpResponseHeaders* rh,
bool success,
int net_error) {
auto response = std::make_unique<base::DictionaryValue>();
base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
bool success,
int net_error) {
base::DictionaryValue response;
int responseCode = 200;
if (rh) {
responseCode = rh->response_code();
@@ -84,9 +89,9 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
// In case of no headers, assume file:// URL and failed to load
responseCode = 404;
}
response->SetInteger("statusCode", responseCode);
response->SetInteger("netError", net_error);
response->SetString("netErrorName", net::ErrorToString(net_error));
response.SetInteger("statusCode", responseCode);
response.SetInteger("netError", net_error);
response.SetString("netErrorName", net::ErrorToString(net_error));
auto headers = std::make_unique<base::DictionaryValue>();
size_t iterator = 0;
@@ -97,12 +102,10 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
headers->SetString(name, value);
response->Set("headers", std::move(headers));
response.Set("headers", std::move(headers));
return response;
}
const int kMaxLogLineLength = 1024;
void WriteTimestamp(std::stringstream& stream) {
#if defined(OS_WIN)
SYSTEMTIME local_time;
@@ -206,15 +209,16 @@ class CefDevToolsFrontend::NetworkResourceLoader
base::Value id(stream_id_);
base::Value encodedValue(encoded);
bindings_->CallClientFunction("DevToolsAPI.streamWrite", &id, &chunkValue,
&encodedValue);
bindings_->CallClientFunction("DevToolsAPI", "streamWrite", std::move(id),
std::move(chunkValue),
std::move(encodedValue));
std::move(resume).Run();
}
void OnComplete(bool success) override {
auto response = BuildObjectForResponse(response_headers_.get(), success,
loader_->NetError());
bindings_->SendMessageAck(request_id_, response.get());
bindings_->SendMessageAck(request_id_, std::move(response));
bindings_->loaders_.erase(bindings_->loaders_.find(this));
}
@@ -230,10 +234,6 @@ class CefDevToolsFrontend::NetworkResourceLoader
DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader);
};
// This constant should be in sync with
// the constant at devtools_ui_bindings.cc.
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
// static
CefDevToolsFrontend* CefDevToolsFrontend::Show(
AlloyBrowserHostImpl* inspected_browser,
@@ -368,44 +368,53 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
base::Value message) {
std::string method;
base::ListValue* params = nullptr;
base::DictionaryValue* dict = nullptr;
if (!message.GetAsDictionary(&dict) || !dict->GetString("method", &method)) {
if (!message.is_dict())
return;
const std::string* method = message.FindStringKey("method");
if (!method)
return;
}
int request_id = 0;
dict->GetInteger("id", &request_id);
dict->GetList("params", &params);
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
std::string protocol_message;
if (!agent_host_ || !params->GetString(0, &protocol_message))
int request_id = message.FindIntKey("id").value_or(0);
base::Value* params_value = message.FindListKey("params");
// Since we've received message by value, we can take the list.
base::Value::ListStorage params;
if (params_value) {
params = std::move(*params_value).TakeList();
}
if (*method == "dispatchProtocolMessage") {
if (params.size() < 1)
return;
const std::string* protocol_message = params[0].GetIfString();
if (!agent_host_ || !protocol_message)
return;
if (ProtocolLoggingEnabled()) {
LogProtocolMessage(ProtocolMessageType::METHOD, protocol_message);
LogProtocolMessage(ProtocolMessageType::METHOD, *protocol_message);
}
agent_host_->DispatchProtocolMessage(
this, base::as_bytes(base::make_span(protocol_message)));
} else if (method == "loadCompleted") {
this, base::as_bytes(base::make_span(*protocol_message)));
} else if (*method == "loadCompleted") {
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
u"DevToolsAPI.setUseSoftMenu(true);", base::NullCallback());
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
} else if (*method == "loadNetworkResource") {
if (params.size() < 3)
return;
// TODO(pfeldman): handle some of the embedder messages in content.
std::string url;
std::string headers;
int stream_id;
if (!params->GetString(0, &url) || !params->GetString(1, &headers) ||
!params->GetInteger(2, &stream_id)) {
const std::string* url = params[0].GetIfString();
const std::string* headers = params[1].GetIfString();
absl::optional<const int> stream_id = params[2].GetIfInt();
if (!url || !headers || !stream_id.has_value()) {
return;
}
GURL gurl(url);
GURL gurl(*url);
if (!gurl.is_valid()) {
base::DictionaryValue response;
response.SetInteger("statusCode", 404);
response.SetBoolean("urlValid", false);
SendMessageAck(request_id, &response);
SendMessageAck(request_id, std::move(response));
return;
}
@@ -442,7 +451,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
// implementation. We really need to pass proper first party origin from
// the front-end.
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
resource_request->headers.AddHeadersFromString(headers);
resource_request->headers.AddHeadersFromString(*headers);
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
if (gurl.SchemeIsFile()) {
@@ -456,7 +465,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
} else if (content::HasWebUIScheme(gurl)) {
base::DictionaryValue response;
response.SetInteger("statusCode", 403);
SendMessageAck(request_id, &response);
SendMessageAck(request_id, std::move(response));
return;
} else {
auto* partition =
@@ -467,64 +476,71 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
auto simple_url_loader = network::SimpleURLLoader::Create(
std::move(resource_request), traffic_annotation);
auto resource_loader = std::make_unique<NetworkResourceLoader>(
stream_id, this, std::move(simple_url_loader), url_loader_factory.get(),
request_id);
*stream_id, this, std::move(simple_url_loader),
url_loader_factory.get(), request_id);
loaders_.insert(std::move(resource_loader));
return;
} else if (method == "getPreferences") {
SendMessageAck(request_id,
GetPrefs()->GetDictionary(prefs::kDevToolsPreferences));
} else if (*method == "getPreferences") {
SendMessageAck(
request_id,
GetPrefs()->GetDictionary(prefs::kDevToolsPreferences)->Clone());
return;
} else if (method == "setPreference") {
std::string name;
std::string value;
if (!params->GetString(0, &name) || !params->GetString(1, &value)) {
} else if (*method == "setPreference") {
if (params.size() < 2)
return;
}
const std::string* name = params[0].GetIfString();
// We're just setting params[1] as a value anyways, so just make sure it's
// the type we want, but don't worry about getting it.
if (!name || !params[1].is_string())
return;
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
update.Get()->SetKey(name, base::Value(value));
} else if (method == "removePreference") {
std::string name;
if (!params->GetString(0, &name))
update.Get()->SetKey(*name, std::move(params[1]));
} else if (*method == "removePreference") {
const std::string* name = params[0].GetIfString();
if (!name)
return;
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
} else if (method == "requestFileSystems") {
update.Get()->RemoveKey(*name);
} else if (*method == "requestFileSystems") {
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
u"DevToolsAPI.fileSystemsLoaded([]);", base::NullCallback());
} else if (method == "reattach") {
} else if (*method == "reattach") {
if (!agent_host_)
return;
agent_host_->DetachClient(this);
agent_host_->AttachClient(this);
} else if (method == "registerExtensionsAPI") {
std::string origin;
std::string script;
if (!params->GetString(0, &origin) || !params->GetString(1, &script))
} else if (*method == "registerExtensionsAPI") {
if (params.size() < 2)
return;
extensions_api_[origin + "/"] = script;
} else if (method == "save" && params->GetSize() == 3) {
std::string url;
std::string content;
bool save_as;
if (!params->GetString(0, &url) || !params->GetString(1, &content) ||
!params->GetBoolean(2, &save_as)) {
const std::string* origin = params[0].GetIfString();
const std::string* script = params[1].GetIfString();
if (!origin || !script)
return;
}
file_manager_.SaveToFile(url, content, save_as);
} else if (method == "append" && params->GetSize() == 2) {
std::string url;
std::string content;
if (!params->GetString(0, &url) || !params->GetString(1, &content)) {
extensions_api_[*origin + "/"] = *script;
} else if (*method == "save") {
if (params.size() < 3)
return;
}
file_manager_.AppendToFile(url, content);
const std::string* url = params[0].GetIfString();
const std::string* content = params[1].GetIfString();
absl::optional<bool> save_as = params[2].GetIfBool();
if (!url || !content || !save_as.has_value())
return;
file_manager_.SaveToFile(*url, *content, *save_as);
} else if (*method == "append") {
if (params.size() < 2)
return;
const std::string* url = params[0].GetIfString();
const std::string* content = params[1].GetIfString();
if (!url || !content)
return file_manager_.AppendToFile(*url, *content);
} else {
return;
}
if (request_id)
SendMessageAck(request_id, nullptr);
SendMessageAck(request_id, base::Value());
}
void CefDevToolsFrontend::DispatchProtocolMessage(
@@ -545,57 +561,54 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
: ProtocolMessageType::RESULT,
str_message);
}
if (str_message.length() < kMaxMessageChunkSize) {
std::string param;
base::EscapeJSONString(str_message, true, &param);
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
std::u16string javascript = base::UTF8ToUTF16(code);
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
javascript, base::NullCallback());
return;
}
size_t total_size = str_message.length();
for (size_t pos = 0; pos < str_message.length();
pos += kMaxMessageChunkSize) {
std::string param;
base::EscapeJSONString(str_message.substr(pos, kMaxMessageChunkSize), true,
&param);
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
std::to_string(pos ? 0 : total_size) + ");";
std::u16string javascript = base::UTF8ToUTF16(code);
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
javascript, base::NullCallback());
if (str_message.length() < kMaxMessageChunkSize) {
CallClientFunction("DevToolsAPI", "dispatchMessage",
base::Value(std::string(str_message)));
} else {
size_t total_size = str_message.length();
for (size_t pos = 0; pos < str_message.length();
pos += kMaxMessageChunkSize) {
base::StringPiece str_message_chunk =
str_message.substr(pos, kMaxMessageChunkSize);
CallClientFunction(
"DevToolsAPI", "dispatchMessageChunk",
base::Value(std::string(str_message_chunk)),
base::Value(base::NumberToString(pos ? 0 : total_size)));
}
}
}
void CefDevToolsFrontend::CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3) {
std::string javascript = function_name + "(";
if (arg1) {
std::string json;
base::JSONWriter::Write(*arg1, &json);
javascript.append(json);
if (arg2) {
base::JSONWriter::Write(*arg2, &json);
javascript.append(", ").append(json);
if (arg3) {
base::JSONWriter::Write(*arg3, &json);
javascript.append(", ").append(json);
void CefDevToolsFrontend::CallClientFunction(
const std::string& object_name,
const std::string& method_name,
base::Value arg1,
base::Value arg2,
base::Value arg3,
base::OnceCallback<void(base::Value)> cb) {
std::string javascript;
web_contents()->GetMainFrame()->AllowInjectingJavaScript();
base::Value arguments(base::Value::Type::LIST);
if (!arg1.is_none()) {
arguments.Append(std::move(arg1));
if (!arg2.is_none()) {
arguments.Append(std::move(arg2));
if (!arg3.is_none()) {
arguments.Append(std::move(arg3));
}
}
}
javascript.append(");");
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::UTF8ToUTF16(javascript), base::NullCallback());
web_contents()->GetMainFrame()->ExecuteJavaScriptMethod(
base::ASCIIToUTF16(object_name), base::ASCIIToUTF16(method_name),
std::move(arguments), std::move(cb));
}
void CefDevToolsFrontend::SendMessageAck(int request_id,
const base::Value* arg) {
base::Value id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
void CefDevToolsFrontend::SendMessageAck(int request_id, base::Value arg) {
CallClientFunction("DevToolsAPI", "embedderMessageAck",
base::Value(request_id), std::move(arg));
}
bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {

View File

@@ -54,10 +54,13 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
void InspectElementAt(int x, int y);
void Close();
void CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3);
void CallClientFunction(
const std::string& object_name,
const std::string& method_name,
const base::Value arg1 = {},
const base::Value arg2 = {},
const base::Value arg3 = {},
base::OnceCallback<void(base::Value)> cb = base::NullCallback());
private:
CefDevToolsFrontend(AlloyBrowserHostImpl* frontend_browser,
@@ -80,7 +83,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
content::RenderFrameHost* render_frame_host) override;
void WebContentsDestroyed() override;
void SendMessageAck(int request_id, const base::Value* arg1);
void SendMessageAck(int request_id, base::Value arg);
bool ProtocolLoggingEnabled() const;
void LogProtocolMessage(ProtocolMessageType type,

View File

@@ -256,17 +256,27 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
if (init_result_)
return init_result_.value();
// |tab_id| is optional so it's ok if it's not there.
int tab_id = -1;
if (args_->GetInteger(0, &tab_id) && tab_id < 0)
const auto list_view = args_->GetList();
if (list_view.size() < 2)
return set_init_result(VALIDATION_FAILURE);
const auto& tab_id_value = list_view[0];
// |tab_id| is optional so it's ok if it's not there.
int tab_id = -1;
if (tab_id_value.is_int()) {
// But if it is present, it needs to be non-negative.
tab_id = tab_id_value.GetInt();
if (tab_id < 0) {
return set_init_result(VALIDATION_FAILURE);
}
}
// |details| are not optional.
base::DictionaryValue* details_value = nullptr;
if (!args_->GetDictionary(1, &details_value))
const base::Value& details_value = list_view[1];
if (!details_value.is_dict())
return set_init_result(VALIDATION_FAILURE);
std::unique_ptr<InjectDetails> details(new InjectDetails());
if (!InjectDetails::Populate(*details_value, details.get()))
if (!InjectDetails::Populate(details_value, details.get()))
return set_init_result(VALIDATION_FAILURE);
// Find a browser that we can access, or fail with error.

View File

@@ -237,7 +237,8 @@ void SaveCookies(content::BrowserContext* browser_context,
net::CookieInclusionStatus returned_status;
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
request.url, cookie_string, base::Time::Now(),
absl::make_optional(response_date), &returned_status);
absl::make_optional(response_date), net::CookiePartitionKey::Todo(),
&returned_status);
if (!returned_status.IsInclude()) {
continue;
}

View File

@@ -290,7 +290,7 @@ bool CefCookieManagerImpl::SetCookieInternal(
expiration_time,
base::Time(), // Last access time.
cookie.secure ? true : false, cookie.httponly ? true : false, same_site,
priority, /*same_party=*/false);
priority, /*same_party=*/false, net::CookiePartitionKey::Todo());
if (!canonical_cookie) {
SetCookieCallbackImpl(

View File

@@ -10,9 +10,11 @@
#include "base/callback.h"
#include "base/threading/thread_checker.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "net/http/http_byte_range.h"
#include "services/network/public/cpp/net_adapters.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"

View File

@@ -350,8 +350,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
prefs::kEnableDoNotTrack, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(prefs::kCaretBrowsingEnabled, false);
registry->RegisterBooleanPref(prefs::kCloudPrintDeprecationWarningsSuppressed,
false);
registry->RegisterStringPref(prefs::kWebRTCIPHandlingPolicy,
blink::kWebRTCIPHandlingDefault);
@@ -407,6 +405,9 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
case ui::NativeTheme::PreferredContrast::kLess:
web.preferred_contrast = blink::mojom::PreferredContrast::kLess;
break;
case ui::NativeTheme::PreferredContrast::kCustom:
web.preferred_contrast = blink::mojom::PreferredContrast::kCustom;
break;
}
UpdatePreferredColorScheme(

View File

@@ -182,6 +182,19 @@ CefPrintViewManager::~CefPrintViewManager() {
TerminatePdfPrintJob();
}
// static
void CefPrintViewManager::BindPrintManagerHost(
mojo::PendingAssociatedReceiver<mojom::PrintManagerHost> receiver,
content::RenderFrameHost* rfh) {
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
if (!web_contents)
return;
auto* print_manager = CefPrintViewManager::FromWebContents(web_contents);
if (!print_manager)
return;
print_manager->BindReceiver(std::move(receiver), rfh);
}
bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
const base::FilePath& path,
const CefPdfPrintSettings& settings,

View File

@@ -13,6 +13,7 @@
#include "components/printing/common/print.mojom-forward.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "printing/mojom/print.mojom.h"
namespace content {
class RenderFrameHost;
@@ -30,6 +31,10 @@ class CefPrintViewManager : public PrintViewManager,
public:
~CefPrintViewManager() override;
static void BindPrintManagerHost(
mojo::PendingAssociatedReceiver<mojom::PrintManagerHost> receiver,
content::RenderFrameHost* rfh);
// Callback executed on PDF printing completion.
typedef base::OnceCallback<void(bool /*ok*/)> PdfPrintCallback;

View File

@@ -21,6 +21,7 @@
#include "content/public/common/child_process_host.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/dns/host_resolver.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/network_context.mojom.h"

View File

@@ -341,7 +341,7 @@ CefRefPtr<CefWindow> CefWindowView::GetCefWindow() const {
void CefWindowView::DeleteDelegate() {
// Remove all child Views before deleting the Window so that notifications
// resolve correctly.
RemoveAllChildViews(true);
RemoveAllChildViews();
window_delegate_->OnWindowViewDeleted();
}

View File

@@ -131,7 +131,7 @@ std::u16string AlloyContentClient::GetLocalizedString(
base::StringPiece AlloyContentClient::GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) {
ui::ResourceScaleFactor scale_factor) {
base::StringPiece value =
ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
resource_id, scale_factor);

View File

@@ -28,8 +28,9 @@ class AlloyContentClient : public content::ContentClient {
std::u16string GetLocalizedString(int message_id) override;
std::u16string GetLocalizedString(int message_id,
const std::u16string& replacement) override;
base::StringPiece GetDataResource(int resource_id,
ui::ScaleFactor scale_factor) override;
base::StringPiece GetDataResource(
int resource_id,
ui::ResourceScaleFactor scale_factor) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
gfx::Image& GetNativeImageNamed(int resource_id) override;

View File

@@ -23,7 +23,6 @@
#include "base/strings/string_util.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/child/pdf_child_init.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
@@ -237,16 +236,15 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
base::NumberToString(settings_->uncaught_exception_stack_size));
}
#if defined(OS_WIN)
std::vector<std::string> disable_features;
#if defined(OS_WIN)
if (features::kCalculateNativeWinOcclusion.default_state ==
base::FEATURE_ENABLED_BY_DEFAULT) {
// TODO: Add support for occlusion detection in combination with native
// parent windows (see issue #2805).
disable_features.push_back(features::kCalculateNativeWinOcclusion.name);
}
#endif // defined(OS_WIN)
if (!disable_features.empty()) {
DCHECK(!base::FeatureList::GetInstance());
@@ -260,33 +258,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
command_line->AppendSwitchASCII(switches::kDisableFeatures,
disable_features_str);
}
std::vector<std::string> enable_features;
if (media_router::kDialMediaRouteProvider.default_state ==
base::FEATURE_DISABLED_BY_DEFAULT) {
// Enable discovery of DIAL devices.
enable_features.push_back(media_router::kDialMediaRouteProvider.name);
}
if (media_router::kCastMediaRouteProvider.default_state ==
base::FEATURE_DISABLED_BY_DEFAULT) {
// Enable discovery of Cast devices.
enable_features.push_back(media_router::kCastMediaRouteProvider.name);
}
if (!enable_features.empty()) {
DCHECK(!base::FeatureList::GetInstance());
std::string enable_features_str =
command_line->GetSwitchValueASCII(switches::kEnableFeatures);
for (auto feature_str : enable_features) {
if (!enable_features_str.empty())
enable_features_str += ",";
enable_features_str += feature_str;
}
command_line->AppendSwitchASCII(switches::kEnableFeatures,
enable_features_str);
}
#endif // defined(OS_WIN)
}
if (application_) {

View File

@@ -4,7 +4,7 @@
base::FilePath CefResourceBundleDelegate::GetPathForResourcePack(
const base::FilePath& pack_path,
ui::ScaleFactor scale_factor) {
ui::ResourceScaleFactor scale_factor) {
// Only allow the cef pack file to load.
if (!pack_loading_disabled_ && allow_pack_file_load_) {
return pack_path;
@@ -30,7 +30,7 @@ gfx::Image CefResourceBundleDelegate::GetNativeImageNamed(int resource_id) {
base::RefCountedStaticMemory* CefResourceBundleDelegate::LoadDataResourceBytes(
int resource_id,
ui::ScaleFactor scale_factor) {
ui::ResourceScaleFactor scale_factor) {
return nullptr;
}
@@ -41,7 +41,7 @@ absl::optional<std::string> CefResourceBundleDelegate::LoadDataResourceString(
bool CefResourceBundleDelegate::GetRawDataResource(
int resource_id,
ui::ScaleFactor scale_factor,
ui::ResourceScaleFactor scale_factor,
base::StringPiece* value) const {
auto application = CefAppManager::Get()->GetApplication();
if (application) {

View File

@@ -22,18 +22,19 @@ class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
private:
// ui::ResourceBundle::Delegate methods.
base::FilePath GetPathForResourcePack(const base::FilePath& pack_path,
ui::ScaleFactor scale_factor) override;
base::FilePath GetPathForResourcePack(
const base::FilePath& pack_path,
ui::ResourceScaleFactor scale_factor) override;
base::FilePath GetPathForLocalePack(const base::FilePath& pack_path,
const std::string& locale) override;
gfx::Image GetImageNamed(int resource_id) override;
gfx::Image GetNativeImageNamed(int resource_id) override;
base::RefCountedStaticMemory* LoadDataResourceBytes(
int resource_id,
ui::ScaleFactor scale_factor) override;
ui::ResourceScaleFactor scale_factor) override;
absl::optional<std::string> LoadDataResourceString(int resource_id) override;
bool GetRawDataResource(int resource_id,
ui::ScaleFactor scale_factor,
ui::ResourceScaleFactor scale_factor,
base::StringPiece* value) const override;
bool GetLocalizedString(int message_id, std::u16string* value) const override;

View File

@@ -29,7 +29,7 @@ CefRefPtr<CefBinaryValue> CefResourceBundleImpl::GetDataResourceForScale(
base::RefCountedMemory* result =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
resource_id, static_cast<ui::ScaleFactor>(scale_factor));
resource_id, static_cast<ui::ResourceScaleFactor>(scale_factor));
if (!result)
return nullptr;

View File

@@ -219,9 +219,8 @@ void OverrideUserDataDir(CefSettings* settings,
}
// Same as ui::ResourceBundle::IsScaleFactorSupported.
bool IsScaleFactorSupported(ui::ScaleFactor scale_factor) {
const std::vector<ui::ScaleFactor>& supported_scale_factors =
ui::GetSupportedScaleFactors();
bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) {
const auto& supported_scale_factors = ui::GetSupportedResourceScaleFactors();
return std::find(supported_scale_factors.begin(),
supported_scale_factors.end(),
scale_factor) != supported_scale_factors.end();

View File

@@ -30,7 +30,7 @@ void OverrideUserDataDir(CefSettings* settings,
const base::CommandLine* command_line);
// Returns true if |scale_factor| is supported by this platform.
bool IsScaleFactorSupported(ui::ScaleFactor scale_factor);
bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor);
#if defined(OS_LINUX)
// Look for binary files (*.bin, *.dat, *.pak, chrome-sandbox, libGLESv2.so,

View File

@@ -1026,7 +1026,7 @@ CefListValueImpl::CefListValueImpl(base::ListValue* value,
base::ListValue* CefListValueImpl::CopyValue() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return const_value().DeepCopy();
return static_cast<base::ListValue*>(const_value().DeepCopy());
}
base::ListValue* CefListValueImpl::CopyOrDetachValue(
@@ -1099,9 +1099,9 @@ bool CefListValueImpl::IsEqual(CefRefPtr<CefListValue> that) {
CefRefPtr<CefListValue> CefListValueImpl::Copy() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return new CefListValueImpl(const_value().DeepCopy(), nullptr,
CefListValueImpl::kOwnerWillDelete, false,
nullptr);
return new CefListValueImpl(
static_cast<base::ListValue*>(const_value().DeepCopy()), nullptr,
CefListValueImpl::kOwnerWillDelete, false, nullptr);
}
bool CefListValueImpl::SetSize(size_t size) {

View File

@@ -50,7 +50,9 @@ void AlloyRenderThreadObserver::UnregisterMojoInterfaces(
void AlloyRenderThreadObserver::SetInitialConfiguration(
bool is_incognito_process,
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener) {
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener,
mojo::PendingRemote<content_settings::mojom::ContentSettingsManager>
content_settings_manager) {
is_incognito_process_ = is_incognito_process;
}

View File

@@ -37,8 +37,9 @@ class AlloyRenderThreadObserver : public content::RenderThreadObserver,
// chrome::mojom::RendererConfiguration:
void SetInitialConfiguration(
bool is_incognito_process,
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener)
override;
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener,
mojo::PendingRemote<content_settings::mojom::ContentSettingsManager>
content_settings_manager) override;
void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
void SetContentSettingRules(
const RendererContentSettingRules& rules) override;