Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: chrome/browser/printing/print_view_manager_basic.cc

Issue 23116003: Adds PrintingContext implementation stub for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses code review issues. Solves infinite recursion bug. Improves the interface between Java an… Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/printing/print_view_manager_basic.h" 5 #include "chrome/browser/printing/print_view_manager_basic.h"
6 6
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
12
7 DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManagerBasic); 13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManagerBasic);
8 14
9 namespace printing { 15 namespace printing {
10 16
11 PrintViewManagerBasic::PrintViewManagerBasic(content::WebContents* web_contents) 17 PrintViewManagerBasic::PrintViewManagerBasic(content::WebContents* web_contents)
12 : PrintViewManagerBase(web_contents) { 18 : PrintViewManagerBase(web_contents) {
13 } 19 }
14 20
15 PrintViewManagerBasic::~PrintViewManagerBasic() { 21 PrintViewManagerBasic::~PrintViewManagerBasic() {
16 } 22 }
17 23
24 #if defined(OS_ANDROID)
25 void PrintViewManagerBasic::RenderProcessGone(base::TerminationStatus status) {
Lei Zhang 2013/08/18 09:56:26 I think any RenderViewHost that prints will have a
Lei Zhang 2013/08/19 21:02:15 I didn't get a response to this, but I tested this
26 PrintingContextAndroid::PdfWritingDone(file_descriptor_.fd, false);
27 file_descriptor_ = base::FileDescriptor(-1, false);
28 PrintViewManagerBase::RenderProcessGone(status);
29 }
30
31 void PrintViewManagerBasic::OnPrintingFailed(int cookie) {
32 PrintingContextAndroid::PdfWritingDone(file_descriptor_.fd, false);
33 file_descriptor_ = base::FileDescriptor(-1, false);
34 PrintViewManagerBase::OnPrintingFailed(cookie);
35 }
36
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()
43
44 return handled ? true : PrintViewManagerBase::OnMessageReceived(message);
whywhat 2013/08/16 23:31:36 nit: I find something like if (handled) return
Lei Zhang 2013/08/18 09:56:26 I think I suggested the ternary operator in the fi
45 }
46 #endif
47
18 } // namespace printing 48 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698