blob: 108234e7ae0a8e5f4144be502cc11d00d5f940d1 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// 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_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
#pragma once
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "content/browser/webui/web_ui.h"
class EnumeratePrintersTaskProxy;
namespace printing {
class PrintBackend;
}
// The handler for Javascript messages related to the "print preview" dialog.
class PrintPreviewHandler : public WebUIMessageHandler,
public base::SupportsWeakPtr<PrintPreviewHandler> {
public:
PrintPreviewHandler();
virtual ~PrintPreviewHandler();
// WebUIMessageHandler implementation.
virtual void RegisterMessages();
private:
friend class EnumeratePrintersTaskProxy;
// Get the list of printers. |args| is unused.
void HandleGetPrinters(const ListValue* args);
// Ask the initiator renderer to generate a preview.
// First element of |args| is a job settings JSON string.
void HandleGetPreview(const ListValue* args);
// Get the job settings from Web UI and initiate printing.
// First element of |args| is a job settings JSON string.
void HandlePrint(const ListValue* args);
// Send the list of printers to the Web UI.
void SendPrinterList(const ListValue& printers);
// Helper function to process the color setting in the dictionary.
void ProcessColorSetting(const DictionaryValue& settings);
// Helper function to process the landscape setting in the dictionary.
void ProcessLandscapeSetting(const DictionaryValue& settings);
// Pointer to current print system.
scoped_refptr<printing::PrintBackend> print_backend_;
// Set to true if we need to generate a new print preview.
bool need_to_generate_preview_;
// Set to true if the preview should be in color.
bool color_;
// Set to true if the preview should be landscape.
bool landscape_;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
};
#endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
|