summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing/print_preview_message_handler.h
blob: eddc48959e2488e0e864f6f68308be7d1fc50aea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2011 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_PREVIEW_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
#pragma once

#include "content/browser/tab_contents/tab_contents_observer.h"

struct ViewHostMsg_DidPreviewDocument_Params;

namespace printing {

// TabContents offloads print preview message handling to
// PrintPreviewMessageHandler. This object has the same life time as the
// TabContents that owns it.
class PrintPreviewMessageHandler : public TabContentsObserver {
 public:
  explicit PrintPreviewMessageHandler(TabContents* tab_contents);
  virtual ~PrintPreviewMessageHandler();

  void OnPagesReadyForPreview(
      const ViewHostMsg_DidPreviewDocument_Params& params);

  // TabContentsObserver implementation.
  virtual bool OnMessageReceived(const IPC::Message& message);

 private:
  // Gets the print preview tab associated with |owner_|.
  TabContents* GetPrintPreviewTab();

  DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler);
};

}  // namespace printing

#endif  // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_