1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ 6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ 7 #pragma once 8 9 #include "content/browser/tab_contents/tab_contents_observer.h" 10 11 struct PrintHostMsg_DidPreviewDocument_Params; 12 13 namespace printing { 14 15 // TabContents offloads print preview message handling to 16 // PrintPreviewMessageHandler. This object has the same life time as the 17 // TabContents that owns it. 18 class PrintPreviewMessageHandler : public TabContentsObserver { 19 public: 20 explicit PrintPreviewMessageHandler(TabContents* tab_contents); 21 virtual ~PrintPreviewMessageHandler(); 22 23 // TabContentsObserver implementation. 24 virtual bool OnMessageReceived(const IPC::Message& message); 25 virtual void DidStartLoading(); 26 27 private: 28 // Gets the print preview tab associated with |owner_|. 29 TabContents* GetPrintPreviewTab(); 30 31 void OnPagesReadyForPreview( 32 const PrintHostMsg_DidPreviewDocument_Params& params); 33 void OnPrintPreviewNodeUnderContextMenu(); 34 void OnScriptInitiatedPrintPreview(); 35 36 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); 37 }; 38 39 } // namespace printing 40 41 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ 42