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

Side by Side Diff: printing/printing_context_linux.cc

Issue 504763002: Revert of Added PrintingContext::Delegate to get parent view handle and application locale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « printing/printing_context_linux.h ('k') | printing/printing_context_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "printing/printing_context_linux.h" 5 #include "printing/printing_context_linux.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "printing/metafile.h" 9 #include "printing/metafile.h"
10 #include "printing/print_dialog_gtk_interface.h" 10 #include "printing/print_dialog_gtk_interface.h"
11 #include "printing/print_job_constants.h" 11 #include "printing/print_job_constants.h"
12 #include "printing/units.h" 12 #include "printing/units.h"
13 13
14 namespace { 14 namespace {
15 15
16 // Function pointer for creating print dialogs. |callback| is only used when 16 // Function pointer for creating print dialogs. |callback| is only used when
17 // |show_dialog| is true. 17 // |show_dialog| is true.
18 printing::PrintDialogGtkInterface* (*create_dialog_func_)( 18 printing::PrintDialogGtkInterface* (*create_dialog_func_)(
19 printing::PrintingContextLinux* context) = NULL; 19 printing::PrintingContextLinux* context) = NULL;
20 20
21 // Function pointer for determining paper size. 21 // Function pointer for determining paper size.
22 gfx::Size (*get_pdf_paper_size_)( 22 gfx::Size (*get_pdf_paper_size_)(
23 printing::PrintingContextLinux* context) = NULL; 23 printing::PrintingContextLinux* context) = NULL;
24 24
25 } // namespace 25 } // namespace
26 26
27 namespace printing { 27 namespace printing {
28 28
29 // static 29 // static
30 scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { 30 PrintingContext* PrintingContext::Create(const std::string& app_locale) {
31 return make_scoped_ptr<PrintingContext>(new PrintingContextLinux(delegate)); 31 return static_cast<PrintingContext*>(new PrintingContextLinux(app_locale));
32 } 32 }
33 33
34 PrintingContextLinux::PrintingContextLinux(Delegate* delegate) 34 PrintingContextLinux::PrintingContextLinux(const std::string& app_locale)
35 : PrintingContext(delegate), print_dialog_(NULL) { 35 : PrintingContext(app_locale),
36 print_dialog_(NULL) {
36 } 37 }
37 38
38 PrintingContextLinux::~PrintingContextLinux() { 39 PrintingContextLinux::~PrintingContextLinux() {
39 ReleaseContext(); 40 ReleaseContext();
40 41
41 if (print_dialog_) 42 if (print_dialog_)
42 print_dialog_->ReleaseDialog(); 43 print_dialog_->ReleaseDialog();
43 } 44 }
44 45
45 // static 46 // static
(...skipping 13 matching lines...) Expand all
59 get_pdf_paper_size_ = get_pdf_paper_size; 60 get_pdf_paper_size_ = get_pdf_paper_size;
60 } 61 }
61 62
62 void PrintingContextLinux::PrintDocument(const Metafile* metafile) { 63 void PrintingContextLinux::PrintDocument(const Metafile* metafile) {
63 DCHECK(print_dialog_); 64 DCHECK(print_dialog_);
64 DCHECK(metafile); 65 DCHECK(metafile);
65 print_dialog_->PrintDocument(metafile, document_name_); 66 print_dialog_->PrintDocument(metafile, document_name_);
66 } 67 }
67 68
68 void PrintingContextLinux::AskUserForSettings( 69 void PrintingContextLinux::AskUserForSettings(
70 gfx::NativeView parent_view,
69 int max_pages, 71 int max_pages,
70 bool has_selection, 72 bool has_selection,
71 const PrintSettingsCallback& callback) { 73 const PrintSettingsCallback& callback) {
72 if (!print_dialog_) { 74 if (!print_dialog_) {
73 // Can only get here if the renderer is sending bad messages. 75 // Can only get here if the renderer is sending bad messages.
74 // http://crbug.com/341777 76 // http://crbug.com/341777
75 NOTREACHED(); 77 NOTREACHED();
76 callback.Run(FAILED); 78 callback.Run(FAILED);
77 return; 79 return;
78 } 80 }
79 81
80 print_dialog_->ShowDialog( 82 print_dialog_->ShowDialog(parent_view, has_selection, callback);
81 delegate_->GetParentView(), has_selection, callback);
82 } 83 }
83 84
84 PrintingContext::Result PrintingContextLinux::UseDefaultSettings() { 85 PrintingContext::Result PrintingContextLinux::UseDefaultSettings() {
85 DCHECK(!in_print_job_); 86 DCHECK(!in_print_job_);
86 87
87 ResetSettings(); 88 ResetSettings();
88 89
89 if (!create_dialog_func_) 90 if (!create_dialog_func_)
90 return OK; 91 return OK;
91 92
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void PrintingContextLinux::ReleaseContext() { 181 void PrintingContextLinux::ReleaseContext() {
181 // Intentional No-op. 182 // Intentional No-op.
182 } 183 }
183 184
184 gfx::NativeDrawingContext PrintingContextLinux::context() const { 185 gfx::NativeDrawingContext PrintingContextLinux::context() const {
185 // Intentional No-op. 186 // Intentional No-op.
186 return NULL; 187 return NULL;
187 } 188 }
188 189
189 } // namespace printing 190 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_linux.h ('k') | printing/printing_context_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698