Also expose in webview.
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
+#include "chrome/browser/printing/print_preview_message_handler.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/guest_host.h"
#include "content/public/browser/navigation_details.h"
inspectable_web_contents_ = managed_web_contents();
Observe(GetWebContents());
+ printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents);
}
WebContents::~WebContents() {
callback);
}
+<<<<<<< HEAD
void WebContents::SetAudioMuted(bool muted) {
web_contents()->SetAudioMuted(muted);
}
return web_contents()->IsAudioMuted();
}
+void WebContents::PrintToPDF(mate::Arguments* args) {
+ mate::Dictionary options;
+ base::Callback<void(int)> callback;
+ if (!(args->Length() == 1 && args->GetNext(&callback)) &&
+ !(args->Length() == 2 && args->GetNext(&options)
+ && args->GetNext(&callback))) {
+ args->ThrowError();
+ return;
+ }
+
+ printing::PrintPreviewMessageHandler::FromWebContents(web_contents())->
+ PrintToPDF(options, callback);
+}
+
void WebContents::Undo() {
web_contents()->Undo();
}
.SetMethod("unregisterServiceWorker",
&WebContents::UnregisterServiceWorker)
.SetMethod("inspectServiceWorker", &WebContents::InspectServiceWorker)
+ .SetMethod("printToPDF", &WebContents::PrintToPDF)
.Build());
return mate::ObjectTemplateBuilder(
void SetAudioMuted(bool muted);
bool IsAudioMuted();
+ // Print current page as PDF.
+ void PrintToPDF(mate::Arguments* args);
+
// Editing commands.
void Undo();
void Redo();
window_->Print(settings.silent, settings.print_background);
}
-void Window::PrintToPDF(mate::Arguments* args) {
- mate::Dictionary options;
- base::Callback<void(int)> callback;
- if (!(args->Length() == 1 && args->GetNext(&callback)) &&
- !(args->Length() == 2 && args->GetNext(&options)
- && args->GetNext(&callback))) {
- args->ThrowError();
- return;
- }
- window_->PrintToPDF(options, callback);
-}
-
void Window::SetProgressBar(double progress) {
window_->SetProgressBar(progress);
}
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
.SetMethod("capturePage", &Window::CapturePage)
.SetMethod("print", &Window::Print)
- .SetMethod("printToPDF", &Window::PrintToPDF)
.SetMethod("setProgressBar", &Window::SetProgressBar)
.SetMethod("setOverlayIcon", &Window::SetOverlayIcon)
.SetMethod("_setMenu", &Window::SetMenu)
PrintNow(silent, print_background);
}
-void NativeWindow::PrintToPDF(const mate::Dictionary& options,
- const PrintToPDFCallback& callback) {
- printing::PrintPreviewMessageHandler::FromWebContents(GetWebContents())->
- PrintToPDF(options, callback);
-}
-
void NativeWindow::ShowDefinitionForSelection() {
NOTIMPLEMENTED();
}
// Print current page.
virtual void Print(bool silent, bool print_background);
- // Print current page as PDF.
- virtual void PrintToPDF(const mate::Dictionary& options,
- const PrintToPDFCallback& callback);
-
// Show popup dictionary.
virtual void ShowDefinitionForSelection();
"send"
"getId"
"inspectServiceWorker"
+ "printToPDF"
]
# Forward proto.foo* method calls to WebViewImpl.foo*.