Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / printing / print_view_manager_basic.cc
blobd978999a07105e7ca3335be71192570f25826782
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"
11 #endif
13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManagerBasic);
15 namespace printing {
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) {
38 bool handled = true;
39 IPC_BEGIN_MESSAGE_MAP(PrintViewManagerBasic, message)
40 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed)
41 IPC_MESSAGE_UNHANDLED(handled = false)
42 IPC_END_MESSAGE_MAP()
44 return handled ? true : PrintViewManagerBase::OnMessageReceived(message);
46 #endif
48 } // namespace printing