Remove some unused IPC messages.
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 10 Jun 2015 10:29:07 +0000 (18:29 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Tue, 16 Jun 2015 12:07:44 +0000 (20:07 +0800)
atom/browser/api/atom_api_window.h
chromium_src/chrome/browser/printing/print_preview_message_handler.cc
chromium_src/chrome/browser/printing/print_preview_message_handler.h
chromium_src/chrome/common/print_messages.h
chromium_src/chrome/renderer/printing/print_web_view_helper.cc

index 828ab2a..43a32e8 100644 (file)
@@ -132,7 +132,6 @@ class Window : public mate::EventEmitter,
   bool IsDocumentEdited();
   void CapturePage(mate::Arguments* args);
   void Print(mate::Arguments* args);
-  void PrintToPDF(mate::Arguments* args);
   void SetProgressBar(double progress);
   void SetOverlayIcon(const gfx::Image& overlay,
                       const std::string& description);
index 50739ed..5a6a170 100644 (file)
@@ -76,21 +76,6 @@ PrintPreviewMessageHandler::PrintPreviewMessageHandler(
 PrintPreviewMessageHandler::~PrintPreviewMessageHandler() {
 }
 
-void PrintPreviewMessageHandler::OnDidGetPreviewPageCount(
-    const PrintHostMsg_DidGetPreviewPageCount_Params& params) {
-  if (params.page_count <= 0) {
-    NOTREACHED();
-    return;
-  }
-}
-
-void PrintPreviewMessageHandler::OnDidPreviewPage(
-    const PrintHostMsg_DidPreviewPage_Params& params) {
-  int page_number = params.page_number;
-  if (page_number < FIRST_PAGE_INDEX || !params.data_size)
-    return;
-}
-
 void PrintPreviewMessageHandler::OnMetafileReadyForPrinting(
     const PrintHostMsg_DidPreviewDocument_Params& params) {
   // Always try to stop the worker.
@@ -116,10 +101,6 @@ bool PrintPreviewMessageHandler::OnMessageReceived(
     const IPC::Message& message) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PrintPreviewMessageHandler, message)
-    IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount,
-                        OnDidGetPreviewPageCount)
-    IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage,
-                        OnDidPreviewPage)
     IPC_MESSAGE_HANDLER(PrintHostMsg_MetafileReadyForPrinting,
                         OnMetafileReadyForPrinting)
     IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewFailed,
index bfdd436..391261d 100644 (file)
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
 
-struct PrintHostMsg_DidGetPreviewPageCount_Params;
 struct PrintHostMsg_DidPreviewDocument_Params;
-struct PrintHostMsg_DidPreviewPage_Params;
 
 namespace content {
 class WebContents;
 }
 
-namespace mate {
-class Dictionary;
-}
-
-namespace gfx {
-class Rect;
-}
-
 namespace printing {
 
 struct PageSizeMargins;
@@ -53,9 +43,6 @@ class PrintPreviewMessageHandler
   friend class content::WebContentsUserData<PrintPreviewMessageHandler>;
 
   // Message handlers.
-  void OnDidGetPreviewPageCount(
-      const PrintHostMsg_DidGetPreviewPageCount_Params& params);
-  void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params);
   void OnMetafileReadyForPrinting(
       const PrintHostMsg_DidPreviewDocument_Params& params);
   void OnPrintPreviewFailed(int document_cookie, int request_id);
index fc9c1d4..cd775d0 100644 (file)
@@ -187,40 +187,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_ScriptedPrint_Params)
   IPC_STRUCT_MEMBER(printing::MarginType, margin_type)
 IPC_STRUCT_END()
 
-// Parameters to describe a rendered preview page.
-IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewPage_Params)
-  // A shared memory handle to metafile data for a draft document of the page.
-  IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle)
-
-  // Size of metafile data.
-  IPC_STRUCT_MEMBER(uint32, data_size)
-
-  // |page_number| is zero-based and can be |printing::INVALID_PAGE_INDEX| if it
-  // is just a check.
-  IPC_STRUCT_MEMBER(int, page_number)
-
-  // The id of the preview request.
-  IPC_STRUCT_MEMBER(int, preview_request_id)
-IPC_STRUCT_END()
-
-// Parameters sent along with the page count.
-IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params)
-  // Cookie for the document to ensure correctness.
-  IPC_STRUCT_MEMBER(int, document_cookie)
-
-  // Total page count.
-  IPC_STRUCT_MEMBER(int, page_count)
-
-  // Indicates whether the previewed document is modifiable.
-  IPC_STRUCT_MEMBER(bool, is_modifiable)
-
-  // The id of the preview request.
-  IPC_STRUCT_MEMBER(int, preview_request_id)
-
-  // Indicates whether the existing preview data needs to be cleared or not.
-  IPC_STRUCT_MEMBER(bool, clear_preview_data)
-IPC_STRUCT_END()
-
 // Parameters to describe a rendered document.
 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
   // A shared memory handle to metafile data.
@@ -318,20 +284,12 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed,
                     int /* document cookie */)
 
-// Notify the browser a print preview page has been rendered.
-IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPreviewPage,
-                    PrintHostMsg_DidPreviewPage_Params /* params */)
-
 // Sends back to the browser the complete rendered document (non-draft mode,
 // used for printing) that was requested by a PrintMsg_PrintPreview message.
 // The memory handle in this message is already valid in the browser process.
 IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting,
                     PrintHostMsg_DidPreviewDocument_Params /* params */)
 
-// Notify the browser the number of pages in the print preview document.
-IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetPreviewPageCount,
-                    PrintHostMsg_DidGetPreviewPageCount_Params /* params */)
-
 IPC_MESSAGE_ROUTED2(PrintHostMsg_PrintPreviewFailed,
                     int /* document cookie */,
                     int /* request_id */);
index 643340d..cba75b6 100644 (file)
@@ -777,31 +777,6 @@ bool PrintWebViewHelper::CreatePreviewDocument() {
     return false;
   }
 
-  PageSizeMargins default_page_layout;
-  ComputePageLayoutInPointsForCss(print_preview_context_.prepared_frame(), 0,
-                                  print_params, ignore_css_margins_, NULL,
-                                  &default_page_layout);
-
-  //bool has_page_size_style =
-      //PrintingFrameHasPageSizeStyle(print_preview_context_.prepared_frame(),
-                                    //print_preview_context_.total_page_count());
-  int dpi = GetDPI(&print_params);
-
-  gfx::Rect printable_area_in_points(
-      ConvertUnit(print_params.printable_area.x(), dpi, kPointsPerInch),
-      ConvertUnit(print_params.printable_area.y(), dpi, kPointsPerInch),
-      ConvertUnit(print_params.printable_area.width(), dpi, kPointsPerInch),
-      ConvertUnit(print_params.printable_area.height(), dpi, kPointsPerInch));
-
-
-  PrintHostMsg_DidGetPreviewPageCount_Params params;
-  params.page_count = print_preview_context_.total_page_count();
-  params.is_modifiable = print_preview_context_.IsModifiable();
-  params.document_cookie = print_params.document_cookie;
-  params.preview_request_id = print_params.preview_request_id;
-  params.clear_preview_data = print_preview_context_.generate_draft_pages();
-  Send(new PrintHostMsg_DidGetPreviewPageCount(routing_id(), params));
-
   while (!print_preview_context_.IsFinalPageRendered()) {
     int page_number = print_preview_context_.GetNextPageNumber();
     DCHECK_GE(page_number, 0);
@@ -1226,22 +1201,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number,
     return false;
   }
 
-  PrintHostMsg_DidPreviewPage_Params preview_page_params;
-  // Get the size of the resulting metafile.
-  uint32 buf_size = metafile->GetDataSize();
-  DCHECK_GT(buf_size, 0u);
-  if (!CopyMetafileDataToSharedMem(
-          metafile, &(preview_page_params.metafile_data_handle))) {
-    LOG(ERROR) << "CopyMetafileDataToSharedMem failed";
-    print_preview_context_.set_error(PREVIEW_ERROR_METAFILE_COPY_FAILED);
-    return false;
-  }
-  preview_page_params.data_size = buf_size;
-  preview_page_params.page_number = page_number;
-  preview_page_params.preview_request_id =
-      print_pages_params_->params.preview_request_id;
-
-  Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params));
   return true;
 }