blob: 1421de9d0eff23e5296a9b34f39779e94c50017b (
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
39
40
41
42
43
44
45
46
|
// 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 PrintHostMsg_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();
// TabContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message);
virtual void DidStartLoading();
private:
// Gets the print preview tab associated with |owner_|.
TabContents* GetPrintPreviewTab();
// Message handlers.
void OnRequestPrintPreview();
void OnDidGetPreviewPageCount(int page_count);
// |page_number| is 0-based.
void OnDidPreviewPage(int page_number, bool* cancel);
void OnPagesReadyForPreview(
const PrintHostMsg_DidPreviewDocument_Params& params);
void OnPrintPreviewFailed(int document_cookie);
void OnPrintPreviewCancelled(int document_cookie);
DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler);
};
} // namespace printing
#endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
|