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 #include "chrome/browser/printing/print_view_manager_basic.h"
7 #if defined(OS_ANDROID)
8 #include "base/file_descriptor_posix.h"
9 #include "chrome/common/print_messages.h"
10 #include "printing/printing_context_android.h"
13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManagerBasic
);
17 PrintViewManagerBasic::PrintViewManagerBasic(content::WebContents
* web_contents
)
18 : PrintViewManagerBase(web_contents
) {
21 PrintViewManagerBasic::~PrintViewManagerBasic() {
24 #if defined(OS_ANDROID)
25 void PrintViewManagerBasic::RenderProcessGone(base::TerminationStatus status
) {
26 PrintingContextAndroid::PdfWritingDone(file_descriptor_
.fd
, false);
27 file_descriptor_
= base::FileDescriptor(-1, false);
28 PrintViewManagerBase::RenderProcessGone(status
);
31 void PrintViewManagerBasic::OnPrintingFailed(int cookie
) {
32 PrintingContextAndroid::PdfWritingDone(file_descriptor_
.fd
, false);
33 file_descriptor_
= base::FileDescriptor(-1, false);
34 PrintViewManagerBase::OnPrintingFailed(cookie
);
37 bool PrintViewManagerBasic::OnMessageReceived(const IPC::Message
& message
) {
39 IPC_BEGIN_MESSAGE_MAP(PrintViewManagerBasic
, message
)
40 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed
, OnPrintingFailed
)
41 IPC_MESSAGE_UNHANDLED(handled
= false)
44 return handled
? true : PrintViewManagerBase::OnMessageReceived(message
);
48 } // namespace printing