mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: fold silent print into settings (#41873)
* refactor: fold silent print into settings * chore: feedback
This commit is contained in:
@@ -2865,7 +2865,6 @@ bool WebContents::IsCurrentlyAudible() {
|
||||
void WebContents::OnGetDeviceNameToUse(
|
||||
base::Value::Dict print_settings,
|
||||
printing::CompletionCallback print_callback,
|
||||
bool silent,
|
||||
// <error, device_name>
|
||||
std::pair<std::string, std::u16string> info) {
|
||||
// The content::WebContents might be already deleted at this point, and the
|
||||
@@ -2901,7 +2900,7 @@ void WebContents::OnGetDeviceNameToUse(
|
||||
? focused_frame
|
||||
: web_contents()->GetPrimaryMainFrame();
|
||||
|
||||
print_view_manager->PrintNow(rfh, silent, std::move(print_settings),
|
||||
print_view_manager->PrintNow(rfh, std::move(print_settings),
|
||||
std::move(print_callback));
|
||||
}
|
||||
|
||||
@@ -2922,9 +2921,10 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set optional silent printing
|
||||
// Set optional silent printing.
|
||||
bool silent = false;
|
||||
options.Get("silent", &silent);
|
||||
settings.Set("silent", silent);
|
||||
|
||||
bool print_background = false;
|
||||
options.Get("printBackground", &print_background);
|
||||
@@ -3065,7 +3065,7 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
FROM_HERE, base::BindOnce(&GetDeviceNameToUse, device_name),
|
||||
base::BindOnce(&WebContents::OnGetDeviceNameToUse,
|
||||
weak_factory_.GetWeakPtr(), std::move(settings),
|
||||
std::move(callback), silent));
|
||||
std::move(callback)));
|
||||
}
|
||||
|
||||
// Partially duplicated and modified from
|
||||
|
||||
@@ -237,7 +237,6 @@ class WebContents : public ExclusiveAccessContext,
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
void OnGetDeviceNameToUse(base::Value::Dict print_settings,
|
||||
printing::CompletionCallback print_callback,
|
||||
bool silent,
|
||||
// <error, device_name>
|
||||
std::pair<std::string, std::u16string> info);
|
||||
void Print(gin::Arguments* args);
|
||||
|
||||
Reference in New Issue
Block a user