blob: 78b85c0411d310d3d7de43004910ec606394b60b [file] [log] [blame]
[email protected]7868ecab2011-03-05 00:12:531// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]51e8d9352010-10-06 22:21:172// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PRINTING_PRINTING_CONTEXT_MAC_H_
6#define PRINTING_PRINTING_CONTEXT_MAC_H_
7
[email protected]ee5f36e42010-12-03 22:40:378#include <string>
9
[email protected]a7d7b632011-03-15 21:55:0210#include "base/scoped_nsobject.h"
[email protected]51e8d9352010-10-06 22:21:1711#include "printing/printing_context.h"
12
13#ifdef __OBJC__
14@class NSPrintInfo;
15#else
16class NSPrintInfo;
17#endif // __OBJC__
18
19namespace printing {
20
21class PrintingContextMac : public PrintingContext {
22 public:
[email protected]ee5f36e42010-12-03 22:40:3723 explicit PrintingContextMac(const std::string& app_locale);
[email protected]51e8d9352010-10-06 22:21:1724 ~PrintingContextMac();
25
26 // PrintingContext implementation.
27 virtual void AskUserForSettings(gfx::NativeView parent_view,
28 int max_pages,
29 bool has_selection,
30 PrintSettingsCallback* callback);
31 virtual Result UseDefaultSettings();
[email protected]c82d3f212011-03-22 01:18:3032 virtual Result UpdatePrintSettings(const DictionaryValue& job_settings,
[email protected]89f5aa8c2011-03-21 20:58:4433 const PageRanges& ranges);
[email protected]51e8d9352010-10-06 22:21:1734 virtual Result InitWithSettings(const PrintSettings& settings);
35 virtual Result NewDocument(const string16& document_name);
36 virtual Result NewPage();
37 virtual Result PageDone();
38 virtual Result DocumentDone();
39 virtual void Cancel();
[email protected]51e8d9352010-10-06 22:21:1740 virtual void ReleaseContext();
41 virtual gfx::NativeDrawingContext context() const;
42
43 private:
44 // Read the settings from the given NSPrintInfo (and cache it for later use).
45 void ParsePrintInfo(NSPrintInfo* print_info);
46
[email protected]89f5aa8c2011-03-21 20:58:4447 // Initializes PrintSettings from native print info object.
48 void InitPrintSettingsFromPrintInfo(const PageRanges& ranges);
49
[email protected]51e8d9352010-10-06 22:21:1750 // The native print info object.
[email protected]a7d7b632011-03-15 21:55:0251 scoped_nsobject<NSPrintInfo> print_info_;
[email protected]51e8d9352010-10-06 22:21:1752
53 // The current page's context; only valid between NewPage and PageDone call
54 // pairs.
55 CGContext* context_;
56
57 DISALLOW_COPY_AND_ASSIGN(PrintingContextMac);
58};
59
60} // namespace printing
61
62#endif // PRINTING_PRINTING_CONTEXT_MAC_H_