| Index: chrome/browser/printing/print_view_manager_base.h
|
| diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager_base.h
|
| similarity index 64%
|
| copy from chrome/browser/printing/print_view_manager.h
|
| copy to chrome/browser/printing/print_view_manager_base.h
|
| index 616ff00d9d18698125be5963efaa74988f1a4aa1..03a90c61269fa3b78762330bbab9aa36acfeddfb 100644
|
| --- a/chrome/browser/printing/print_view_manager.h
|
| +++ b/chrome/browser/printing/print_view_manager_base.h
|
| @@ -1,9 +1,9 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
|
| -#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
|
| +#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
| +#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
|
|
| #include "base/memory/ref_counted.h"
|
| #include "base/prefs/pref_member.h"
|
| @@ -17,7 +17,6 @@
|
| struct PrintHostMsg_DidPrintPage_Params;
|
|
|
| namespace content {
|
| -class RenderProcessHost;
|
| class RenderViewHost;
|
| }
|
|
|
| @@ -26,60 +25,38 @@ namespace printing {
|
| class JobEventDetails;
|
| class PrintJob;
|
| class PrintJobWorkerOwner;
|
| -class PrintViewManagerObserver;
|
|
|
| -// Manages the print commands for a WebContents.
|
| -class PrintViewManager : public content::NotificationObserver,
|
| - public PrintedPagesSource,
|
| - public content::WebContentsObserver,
|
| - public content::WebContentsUserData<PrintViewManager> {
|
| +// Base class for managing the print commands for a WebContents.
|
| +class PrintViewManagerBase : public content::NotificationObserver,
|
| + public PrintedPagesSource,
|
| + public content::WebContentsObserver {
|
| public:
|
| - virtual ~PrintViewManager();
|
| + virtual ~PrintViewManagerBase();
|
|
|
| // Prints the current document immediately. Since the rendering is
|
| // asynchronous, the actual printing will not be completed on the return of
|
| // this function. Returns false if printing is impossible at the moment.
|
| - bool PrintNow();
|
| -
|
| - // Same as PrintNow(), but for the case where a user prints with the system
|
| - // dialog from print preview.
|
| - bool PrintForSystemDialogNow();
|
| -
|
| - // Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to
|
| - // show the native system dialog. This can happen from both initiator and
|
| - // preview dialog.
|
| - bool AdvancedPrintNow();
|
| -
|
| - // Same as PrintNow(), but for the case where we want to send the result to
|
| - // another destination.
|
| - // TODO(mad) Add an argument so we can pass the destination interface.
|
| - bool PrintToDestination();
|
| -
|
| - // Initiate print preview of the current document by first notifying the
|
| - // renderer. Since this happens asynchronous, the print preview dialog
|
| - // creation will not be completed on the return of this function. Returns
|
| - // false if print preview is impossible at the moment.
|
| - bool PrintPreviewNow(bool selection_only);
|
| -
|
| - // Notify PrintViewManager that print preview is starting in the renderer for
|
| - // a particular WebNode.
|
| - void PrintPreviewForWebNode();
|
| -
|
| - // Notify PrintViewManager that print preview has finished. Unfreeze the
|
| - // renderer in the case of scripted print preview.
|
| - void PrintPreviewDone();
|
| + virtual bool PrintNow();
|
|
|
| // Whether to block scripted printing for our tab or not.
|
| void UpdateScriptedPrintingBlocked();
|
|
|
| - // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to
|
| - // remove the current observer. |observer| may always be NULL, but |observer_|
|
| - // must be NULL if |observer| is non-NULL.
|
| - void set_observer(PrintViewManagerObserver* observer);
|
| -
|
| // PrintedPagesSource implementation.
|
| virtual string16 RenderSourceName() OVERRIDE;
|
|
|
| + protected:
|
| + explicit PrintViewManagerBase(content::WebContents* web_contents);
|
| +
|
| + // Helper method for Print*Now().
|
| + bool PrintNowInternal(IPC::Message* message);
|
| +
|
| + // Terminates or cancels the print job if one was pending.
|
| + virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
|
| +
|
| + // content::WebContentsObserver implementation.
|
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| +
|
| + private:
|
| // content::NotificationObserver implementation.
|
| virtual void Observe(int type,
|
| const content::NotificationSource& source,
|
| @@ -89,36 +66,15 @@ class PrintViewManager : public content::NotificationObserver,
|
| virtual void DidStartLoading(
|
| content::RenderViewHost* render_view_host) OVERRIDE;
|
|
|
| - // content::WebContentsObserver implementation.
|
| - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| -
|
| - // Terminates or cancels the print job if one was pending.
|
| - virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
|
| -
|
| // Cancels the print job.
|
| virtual void StopNavigation() OVERRIDE;
|
|
|
| - private:
|
| - explicit PrintViewManager(content::WebContents* web_contents);
|
| - friend class content::WebContentsUserData<PrintViewManager>;
|
| -
|
| - enum PrintPreviewState {
|
| - NOT_PREVIEWING,
|
| - USER_INITIATED_PREVIEW,
|
| - SCRIPTED_PREVIEW,
|
| - };
|
| -
|
| // IPC Message handlers.
|
| void OnDidGetPrintedPagesCount(int cookie, int number_pages);
|
| void OnDidGetDocumentCookie(int cookie);
|
| - void OnDidShowPrintDialog();
|
| void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params);
|
| void OnPrintingFailed(int cookie);
|
|
|
| - void OnScriptedPrintPreview(bool source_is_modifiable,
|
| - IPC::Message* reply_msg);
|
| - void OnScriptedPrintPreviewReply(IPC::Message* reply_msg);
|
| -
|
| // Processes a NOTIFY_PRINT_JOB_EVENT notification.
|
| void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
|
|
|
| @@ -167,9 +123,6 @@ class PrintViewManager : public content::NotificationObserver,
|
| // print_job_ is initialized.
|
| bool OpportunisticallyCreatePrintJob(int cookie);
|
|
|
| - // Helper method for Print*Now().
|
| - bool PrintNowInternal(IPC::Message* message);
|
| -
|
| // Release the PrinterQuery associated with our |cookie_|.
|
| void ReleasePrinterQuery();
|
|
|
| @@ -194,28 +147,18 @@ class PrintViewManager : public content::NotificationObserver,
|
| bool expecting_first_page_;
|
| #endif
|
|
|
| - // Weak pointer to an observer that is notified when the print dialog is
|
| - // shown.
|
| - PrintViewManagerObserver* observer_;
|
| -
|
| // The document cookie of the current PrinterQuery.
|
| int cookie_;
|
|
|
| - // Current state of print preview for this view.
|
| - PrintPreviewState print_preview_state_;
|
| -
|
| - // Keeps track of the pending callback during scripted print preview.
|
| - content::RenderProcessHost* scripted_print_preview_rph_;
|
| -
|
| // Whether printing is enabled.
|
| BooleanPrefMember printing_enabled_;
|
|
|
| // Whether our content is in blocked state.
|
| bool tab_content_blocked_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
|
| + DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase);
|
| };
|
|
|
| } // namespace printing
|
|
|
| -#endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
|
| +#endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
|
|