Update to Chromium version 93.0.4577.0 (#902210)

This commit is contained in:
Marshall Greenblatt
2021-07-23 12:40:13 -04:00
parent 1ffa5528b3
commit b4ea0496e7
141 changed files with 1188 additions and 1061 deletions

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/download/download_prefs.cc chrome/browser/download/download_prefs.cc
index f5ce4b6b6649f..32a176a7cc8fe 100644
index d282ff9e1e7be..f698a1b235cca 100644
--- chrome/browser/download/download_prefs.cc
+++ chrome/browser/download/download_prefs.cc
@@ -24,6 +24,7 @@
@@ -10,34 +10,34 @@ index f5ce4b6b6649f..32a176a7cc8fe 100644
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/download/download_core_service_impl.h"
@@ -58,6 +59,10 @@
@@ -60,6 +61,10 @@
#include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
#endif
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/browser/alloy/alloy_browser_context.h"
+#include "cef/libcef/browser/alloy/alloy_download_util.h"
+#endif
+
using content::BrowserContext;
using content::BrowserThread;
using content::DownloadManager;
@@ -358,6 +363,11 @@ DownloadPrefs* DownloadPrefs::FromDownloadManager(
@@ -348,6 +353,11 @@ DownloadPrefs* DownloadPrefs::FromDownloadManager(
// static
DownloadPrefs* DownloadPrefs::FromBrowserContext(
content::BrowserContext* context) {
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsAlloyRuntimeEnabled()) {
+ return static_cast<AlloyBrowserContext*>(context)->GetDownloadPrefs();
+ return alloy::GetDownloadPrefsFromBrowserContext(context);
+ }
+#endif
return FromDownloadManager(context->GetDownloadManager());
}
diff --git chrome/browser/printing/print_preview_dialog_controller.cc chrome/browser/printing/print_preview_dialog_controller.cc
index 74536431f6649..3fc69b6560298 100644
index 4ff73fd2d9ec3..d56686d8284ba 100644
--- chrome/browser/printing/print_preview_dialog_controller.cc
+++ chrome/browser/printing/print_preview_dialog_controller.cc
@@ -17,6 +17,7 @@
@@ -15,6 +15,7 @@
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -45,7 +45,7 @@ index 74536431f6649..3fc69b6560298 100644
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/printing/print_view_manager.h"
@@ -410,8 +411,11 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog(
@@ -402,8 +403,11 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog(
content::HostZoomMap::Get(preview_dialog->GetSiteInstance())
->SetZoomLevelForHostAndScheme(print_url.scheme(), print_url.host(), 0);
PrintViewManager::CreateForWebContents(preview_dialog);
@@ -58,7 +58,7 @@ index 74536431f6649..3fc69b6560298 100644
// Add an entry to the map.
preview_dialog_map_[preview_dialog] = initiator;
diff --git chrome/browser/printing/print_view_manager_base.cc chrome/browser/printing/print_view_manager_base.cc
index 376f426b7bab4..c6039e0481712 100644
index 867227684ddba..98986fdad1e7f 100644
--- chrome/browser/printing/print_view_manager_base.cc
+++ chrome/browser/printing/print_view_manager_base.cc
@@ -21,6 +21,7 @@
@@ -80,7 +80,7 @@ index 376f426b7bab4..c6039e0481712 100644
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "chrome/browser/printing/print_error_dialog.h"
#include "chrome/browser/printing/print_view_manager.h"
@@ -237,8 +242,13 @@ PrintViewManager* GetPrintViewManager(int render_process_id,
@@ -215,8 +220,13 @@ PrintViewManager* GetPrintViewManager(int render_process_id,
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::WebContents* web_contents =
GetWebContentsForRenderFrame(render_process_id, render_frame_id);
@@ -97,7 +97,7 @@ index 376f426b7bab4..c6039e0481712 100644
void NotifySystemDialogCancelled(int render_process_id, int routing_id) {
diff --git chrome/browser/printing/print_view_manager_base.h chrome/browser/printing/print_view_manager_base.h
index 62f4dc6083a13..1371b43f6208a 100644
index 48e2baa05cdf6..b4da112845d86 100644
--- chrome/browser/printing/print_view_manager_base.h
+++ chrome/browser/printing/print_view_manager_base.h
@@ -124,9 +124,6 @@ class PrintViewManagerBase : public content::NotificationObserver,
@@ -127,7 +127,7 @@ index 920f646f06484..76c0b5e5ee04b 100644
$i18n{cancel}
</cr-button>
diff --git chrome/browser/ui/webui/constrained_web_dialog_ui.cc chrome/browser/ui/webui/constrained_web_dialog_ui.cc
index 3d415a60d4361..807ab41ee6ef1 100644
index dd3512b303c40..0627aa331492c 100644
--- chrome/browser/ui/webui/constrained_web_dialog_ui.cc
+++ chrome/browser/ui/webui/constrained_web_dialog_ui.cc
@@ -26,6 +26,8 @@
@@ -139,7 +139,7 @@ index 3d415a60d4361..807ab41ee6ef1 100644
using content::RenderFrameHost;
using content::WebContents;
using content::WebUIMessageHandler;
@@ -55,8 +57,10 @@ class ConstrainedWebDialogDelegateUserData
@@ -57,8 +59,10 @@ class ConstrainedWebDialogDelegateUserData
ConstrainedWebDialogUI::ConstrainedWebDialogUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -149,9 +149,9 @@ index 3d415a60d4361..807ab41ee6ef1 100644
+#endif
}
ConstrainedWebDialogUI::~ConstrainedWebDialogUI() {
ConstrainedWebDialogUI::~ConstrainedWebDialogUI() = default;
diff --git chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
index bb1a2238af55c..b825289863d57 100644
index 32c3e9c3cb267..011b333602bfb 100644
--- chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
+++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
@@ -21,6 +21,7 @@
@@ -162,18 +162,39 @@ index bb1a2238af55c..b825289863d57 100644
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_prefs.h"
@@ -61,6 +62,10 @@
@@ -62,6 +63,10 @@
#include "chromeos/lacros/lacros_service.h"
#endif
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
+#include "cef/libcef/browser/alloy/alloy_dialog_util.h"
+#endif
+
namespace printing {
namespace {
@@ -421,10 +426,27 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename,
@@ -414,16 +419,18 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename,
service->GetRemote<crosapi::mojom::DriveIntegrationService>()
->GetMountPointPath(
base::BindOnce(&PdfPrinterHandler::OnSaveLocationReady,
- weak_ptr_factory_.GetWeakPtr(),
+ weak_ptr_factory_.GetWeakPtr(), initiator,
std::move(default_filename), prompt_user));
return;
}
#endif
- OnSaveLocationReady(default_filename, prompt_user, GetSaveLocation());
+ OnSaveLocationReady(initiator, default_filename, prompt_user,
+ GetSaveLocation());
}
void PdfPrinterHandler::OnSaveLocationReady(
+ content::WebContents* initiator,
const base::FilePath& default_filename,
bool prompt_user,
const base::FilePath& path) {
@@ -441,10 +448,27 @@ void PdfPrinterHandler::OnSaveLocationReady(
// If the directory is empty there is no reason to create it or use the
// default location.
if (path.empty()) {
@@ -201,7 +222,7 @@ index bb1a2238af55c..b825289863d57 100644
// Get default download directory. This will be used as a fallback if the
// save directory does not exist.
DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(profile_);
@@ -432,8 +454,7 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename,
@@ -452,8 +476,7 @@ void PdfPrinterHandler::OnSaveLocationReady(
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&SelectSaveDirectory, path, default_path),
@@ -211,7 +232,7 @@ index bb1a2238af55c..b825289863d57 100644
}
void PdfPrinterHandler::PostPrintToPdfTask() {
@@ -479,6 +500,40 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename,
@@ -499,6 +522,36 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename,
platform_util::GetTopLevel(preview_web_contents_->GetNativeView()), NULL);
}
@@ -220,21 +241,17 @@ index bb1a2238af55c..b825289863d57 100644
+void PdfPrinterHandler::ShowCefSaveAsDialog(content::WebContents* initiator,
+ const base::FilePath& filename,
+ const base::FilePath& directory) {
+ CefRefPtr<AlloyBrowserHostImpl> cef_browser =
+ AlloyBrowserHostImpl::GetBrowserForContents(initiator);
+ if (!cef_browser)
+ return;
+
+ base::FilePath path = directory.Append(filename);
+
+ CefFileDialogRunner::FileChooserParams params;
+ blink::mojom::FileChooserParams params;
+ params.mode = blink::mojom::FileChooserParams::Mode::kSave;
+ params.default_file_name = path;
+ params.accept_types.push_back(CefString(path.Extension()));
+ params.accept_types.push_back(
+ alloy::FilePathTypeToString16(path.Extension()));
+
+ cef_browser->RunFileChooser(
+ params, base::BindOnce(&PdfPrinterHandler::SaveAsDialogDismissed,
+ weak_ptr_factory_.GetWeakPtr()));
+ alloy::RunFileChooser(initiator, params,
+ base::BindOnce(&PdfPrinterHandler::SaveAsDialogDismissed,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void PdfPrinterHandler::SaveAsDialogDismissed(
@@ -253,7 +270,7 @@ index bb1a2238af55c..b825289863d57 100644
#if BUILDFLAG(IS_CHROMEOS_ASH)
drive::DriveIntegrationService* drive_service =
diff --git chrome/browser/ui/webui/print_preview/pdf_printer_handler.h chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
index 143c97225fac7..90b6e9549589e 100644
index e326047aef5e9..4fc8898e95b6f 100644
--- chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
+++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
@@ -11,6 +11,7 @@
@@ -264,10 +281,16 @@ index 143c97225fac7..90b6e9549589e 100644
#include "chrome/browser/ui/webui/print_preview/printer_handler.h"
#include "ui/shell_dialogs/select_file_dialog.h"
@@ -91,6 +92,15 @@ class PdfPrinterHandler : public PrinterHandler,
@@ -91,10 +92,20 @@ class PdfPrinterHandler : public PrinterHandler,
void OnDirectorySelected(const base::FilePath& filename,
const base::FilePath& directory);
- void OnSaveLocationReady(const base::FilePath& default_filename,
+ void OnSaveLocationReady(content::WebContents* initiator,
+ const base::FilePath& default_filename,
bool prompt_user,
const base::FilePath& path);
+#if BUILDFLAG(ENABLE_CEF)
+ void ShowCefSaveAsDialog(content::WebContents* initiator,
+ const base::FilePath& filename,
@@ -281,27 +304,26 @@ index 143c97225fac7..90b6e9549589e 100644
base::FilePath GetSaveLocation() const;
diff --git chrome/browser/ui/webui/print_preview/print_preview_handler.cc chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 058c76f2a3f8c..3eda3a8f46d9a 100644
index 5cebaa1d75b74..3c2fae113c678 100644
--- chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -25,6 +25,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/account_manager_facade_factory.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/bad_message.h"
@@ -1107,7 +1108,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
}
return extension_printer_handler_.get();
@@ -1151,6 +1152,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
}
-#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) && !BUILDFLAG(ENABLE_CEF)
if (printer_type == PrinterType::kPrivet &&
#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
if (printer_type == mojom::PrinterType::kPrivet &&
+ !cef::IsAlloyRuntimeEnabled() &&
GetPrefs()->GetBoolean(prefs::kForceEnablePrivetPrinting)) {
if (!privet_printer_handler_) {
@@ -1116,6 +1117,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
privet_printer_handler_ =
@@ -1158,6 +1160,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
}
return privet_printer_handler_.get();
}
@@ -309,10 +331,10 @@ index 058c76f2a3f8c..3eda3a8f46d9a 100644
+ if (printer_type == PrinterType::kPrivet)
+ return nullptr;
#endif
if (printer_type == PrinterType::kPdf) {
if (printer_type == mojom::PrinterType::kPdf) {
if (!pdf_printer_handler_) {
diff --git chrome/browser/ui/webui/print_preview/print_preview_ui.cc chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index f98201bb37881..7e4d2f2ee19ff 100644
index 7d68582201d35..899df572ef835 100644
--- chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -29,6 +29,7 @@
@@ -323,7 +345,7 @@ index f98201bb37881..7e4d2f2ee19ff 100644
#include "chrome/browser/browser_process.h"
#include "chrome/browser/pdf/pdf_extension_util.h"
#include "chrome/browser/printing/background_printing_manager.h"
@@ -96,6 +97,13 @@ const char16_t kBasicPrintShortcut[] = u"\u0028\u21e7\u2318\u0050\u0029";
@@ -98,6 +99,13 @@ const char16_t kBasicPrintShortcut[] = u"\u0028\u21e7\u2318\u0050\u0029";
const char16_t kBasicPrintShortcut[] = u"(Ctrl+Shift+P)";
#endif
@@ -337,7 +359,7 @@ index f98201bb37881..7e4d2f2ee19ff 100644
constexpr char kInvalidArgsForDidStartPreview[] =
"Invalid arguments for DidStartPreview";
constexpr char kInvalidPageNumberForDidPreviewPage[] =
@@ -381,7 +389,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
@@ -383,7 +391,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
chrome::kCloudPrintCertificateErrorLearnMoreURL);
#if !defined(OS_CHROMEOS)