summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 03:15:58 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 03:15:58 +0000
commit39b7b06790a776ee2247f391b1b2e3af1a335503 (patch)
tree8813c8831c92e6f00e8e72bbeaa95693e695c683 /chrome/browser/printing
parentd718a62d075bdd6f45a128bd5d82358d73799300 (diff)
downloadchromium_src-39b7b06790a776ee2247f391b1b2e3af1a335503.zip
chromium_src-39b7b06790a776ee2247f391b1b2e3af1a335503.tar.gz
chromium_src-39b7b06790a776ee2247f391b1b2e3af1a335503.tar.bz2
Make it easier/less work/less error-prone to create new IPC channel types (i.e. renderer/plugin).Instead of having each message file include the internal one several times with different ifdefs, move that logic to ipc_message_macros.h. Also make the message class starting IDs come from an enum to ensure we don't use a value twice. I simplified the logging code a bit so we don't need X_messages.cc files.Clean up places that we were doing manual packing/unpacking. Most of this was in the automation code. I added a few new template functions to make it convenient to read the parameters from a message, and updated the code to use them.I also removed unnecessary includes of render/plugin_messages.h from headers to speed up compiling.I moved the traits of IPC structs beside the struct definition to make it more apparent what's going on, so we avoid people modifying the struct and forgetting to update the traits.Amit: please look at chrome/test/automation/tab_proxy.ccMarc-Antoine: chrome/browser/printing/*Matt: the rest
Review URL: http://codereview.chromium.org/20015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r--chrome/browser/printing/print_view_manager.cc21
-rw-r--r--chrome/browser/printing/print_view_manager.h6
2 files changed, 2 insertions, 25 deletions
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index bdc9da3..4e017e8 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -27,7 +27,6 @@ PrintViewManager::PrintViewManager(WebContents& owner)
waiting_to_print_(false),
inside_inner_message_loop_(false),
waiting_to_show_print_dialog_(false) {
- memset(&print_params_, 0, sizeof(print_params_));
}
PrintViewManager::~PrintViewManager() {
@@ -240,25 +239,6 @@ void PrintViewManager::OnNotifyPrintJobEvent(
void PrintViewManager::OnNotifyPrintJobInitEvent(
const JobEventDetails& event_details) {
- ViewMsg_Print_Params old_print_params(print_params_);
-
- // Backup the print settings relevant to the renderer.
- DCHECK_EQ(print_job_->document(), event_details.document());
- event_details.document()->settings().RenderParams(&print_params_);
- print_params_.document_cookie = event_details.document()->cookie();
- DCHECK_GT(print_params_.document_cookie, 0);
-
- // If settings changed
- DCHECK(owner_.render_view_host());
- // Equals() doesn't compare the cookie value.
- if (owner_.render_view_host() &&
- owner_.render_view_host()->IsRenderViewLive() &&
- (!old_print_params.Equals(print_params_) ||
- !event_details.document()->page_count())) {
- // TODO(maruel): Will never happen, this code is about to be deleted.
- NOTREACHED();
- }
-
// Continue even if owner_.render_view_host() is dead because we may already
// have buffered all the necessary pages.
switch (event_details.type()) {
@@ -460,7 +440,6 @@ void PrintViewManager::ReleasePrintJob() {
print_job_->DisconnectSource();
// Don't close the worker thread.
print_job_ = NULL;
- memset(&print_params_, 0, sizeof(print_params_));
}
void PrintViewManager::PrintNowInternal() {
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index 405b180..3cd0272 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -5,12 +5,13 @@
#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
+#include "base/ref_counted.h"
#include "chrome/browser/printing/printed_pages_source.h"
#include "chrome/common/notification_observer.h"
-#include "chrome/common/render_messages.h"
class RenderViewHost;
class WebContents;
+struct ViewHostMsg_DidPrintPage_Params;
namespace printing {
@@ -118,9 +119,6 @@ class PrintViewManager : public NotificationObserver,
// print_job_ is initialized.
bool OpportunisticallyCreatePrintJob(int cookie);
- // Cache the last print settings requested to the renderer.
- ViewMsg_Print_Params print_params_;
-
// Manages the low-level talk to the printer.
scoped_refptr<PrintJob> print_job_;