]> khamidou — GitHub mirrors - electron.git/commitdiff
Add printToPDF API skeleton.
authorHaojian Wu <hokein.wu@gmail.com>
Sun, 31 May 2015 02:24:45 +0000 (10:24 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Tue, 16 Jun 2015 12:02:23 +0000 (20:02 +0800)
atom/browser/api/atom_api_window.cc
atom/browser/api/atom_api_window.h
atom/browser/native_window.cc
atom/browser/native_window.h

index 7461bc736855c2edbe7d938e0dab33bf5e0a0514..00a0bb464089b08fedeba34fdee2fd8e138e09d8 100644 (file)
@@ -430,6 +430,10 @@ void Window::Print(mate::Arguments* args) {
   window_->Print(settings.silent, settings.print_background);
 }
 
+void Window::PrintToPDF() {
+  window_->PrintToPDF();
+}
+
 void Window::SetProgressBar(double progress) {
   window_->SetProgressBar(progress);
 }
@@ -542,6 +546,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
       .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)
index 43a32e86f45a5958022f8faea01410fcde942f1d..606fda9f7dc3c56bf7fd6af163eafc9d00e866f3 100644 (file)
@@ -132,6 +132,7 @@ class Window : public mate::EventEmitter,
   bool IsDocumentEdited();
   void CapturePage(mate::Arguments* args);
   void Print(mate::Arguments* args);
+  void PrintToPDF();
   void SetProgressBar(double progress);
   void SetOverlayIcon(const gfx::Image& overlay,
                       const std::string& description);
index 8eb05cb9b0f22f413d6077ddf6403412d796a412..f0198996668d2f9f1a30096eab5792ba4e6f31f0 100644 (file)
@@ -262,6 +262,9 @@ void NativeWindow::Print(bool silent, bool print_background) {
       PrintNow(silent, print_background);
 }
 
+void NativeWindow::PrintToPDF() {
+}
+
 void NativeWindow::ShowDefinitionForSelection() {
   NOTIMPLEMENTED();
 }
index 2038775f8d9a53a2fd41c7f9e06f6b28f9d9d060..5c99a2c117b523f6ec21c3896243140b6f68ad92 100644 (file)
@@ -157,6 +157,9 @@ class NativeWindow : public CommonWebContentsDelegate,
   // Print current page.
   virtual void Print(bool silent, bool print_background);
 
+  // Print current page as PDF.
+  virtual void PrintToPDF();
+
   // Show popup dictionary.
   virtual void ShowDefinitionForSelection();