1 // Copyright 2015 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.
5 #ifndef ANDROID_WEBVIEW_BROWSER_PRINT_MANAGER_H_
6 #define ANDROID_WEBVIEW_BROWSER_PRINT_MANAGER_H_
8 #include "components/printing/browser/print_manager.h"
9 #include "content/public/browser/web_contents_user_data.h"
10 #include "printing/print_settings.h"
12 namespace android_webview
{
14 class AwPrintManager
: public printing::PrintManager
,
15 public content::WebContentsUserData
<AwPrintManager
> {
17 // Creates a AwPrintManager for the provided webcontents. If the
18 // AwPrintManager already exists, it is destroyed and a new one is created.
19 static AwPrintManager
* CreateForWebContents(
20 content::WebContents
* contents
,
21 const printing::PrintSettings
& settings
,
22 const base::FileDescriptor
& file_descriptor
,
23 const PdfWritingDoneCallback
& callback
);
25 ~AwPrintManager() override
;
30 friend class content::WebContentsUserData
<AwPrintManager
>;
31 AwPrintManager(content::WebContents
* contents
,
32 const printing::PrintSettings
& settings
,
33 const base::FileDescriptor
& file_descriptor
,
34 const PdfWritingDoneCallback
& callback
);
36 bool OnMessageReceived(const IPC::Message
& message
) override
;
37 void OnGetDefaultPrintSettings(IPC::Message
* reply_msg
);
39 printing::PrintSettings settings_
;
41 DISALLOW_COPY_AND_ASSIGN(AwPrintManager
);
44 } // namespace android_webview
46 #endif // ANDROID_WEBVIEW_BROWSER_PRINT_MANAGER_H_