1 // Copyright 2013 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 CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASIC_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASIC_H_
8 #include "chrome/browser/printing/print_view_manager_base.h"
9 #include "content/public/browser/web_contents_user_data.h"
11 #if defined(OS_ANDROID)
12 #include "base/file_descriptor_posix.h"
17 // Manages the print commands for a WebContents - basic version.
18 class PrintViewManagerBasic
19 : public PrintViewManagerBase
,
20 public content::WebContentsUserData
<PrintViewManagerBasic
> {
22 ~PrintViewManagerBasic() override
;
24 #if defined(OS_ANDROID)
25 // Sets the file descriptor into which the PDF will be written.
26 void set_file_descriptor(const base::FileDescriptor
& file_descriptor
) {
27 file_descriptor_
= file_descriptor
;
30 // Gets the file descriptor into which the PDF will be written.
31 base::FileDescriptor
file_descriptor() const { return file_descriptor_
; }
33 // content::WebContentsObserver implementation.
34 // Terminates or cancels the print job if one was pending.
35 void RenderProcessGone(base::TerminationStatus status
) override
;
37 // content::WebContentsObserver implementation.
38 bool OnMessageReceived(const IPC::Message
& message
) override
;
42 explicit PrintViewManagerBasic(content::WebContents
* web_contents
);
43 friend class content::WebContentsUserData
<PrintViewManagerBasic
>;
45 #if defined(OS_ANDROID)
46 void OnPrintingFailed(int cookie
) override
;
48 // The file descriptor into which the PDF of the page will be written.
49 base::FileDescriptor file_descriptor_
;
52 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBasic
);
55 } // namespace printing
57 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASIC_H_