OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/print_preview/print_preview_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "content/public/browser/navigation_controller.h" | 65 #include "content/public/browser/navigation_controller.h" |
66 #include "content/public/browser/navigation_entry.h" | 66 #include "content/public/browser/navigation_entry.h" |
67 #include "content/public/browser/render_process_host.h" | 67 #include "content/public/browser/render_process_host.h" |
68 #include "content/public/browser/render_view_host.h" | 68 #include "content/public/browser/render_view_host.h" |
69 #include "content/public/browser/web_contents.h" | 69 #include "content/public/browser/web_contents.h" |
70 #include "content/public/browser/web_ui.h" | 70 #include "content/public/browser/web_ui.h" |
71 #include "google_apis/gaia/oauth2_token_service.h" | 71 #include "google_apis/gaia/oauth2_token_service.h" |
72 #include "printing/backend/print_backend.h" | 72 #include "printing/backend/print_backend.h" |
73 #include "printing/backend/print_backend_consts.h" | 73 #include "printing/backend/print_backend_consts.h" |
74 #include "printing/metafile.h" | 74 #include "printing/metafile.h" |
75 #include "printing/metafile_impl.h" | 75 #include "printing/pdf_metafile_skia.h" |
76 #include "printing/pdf_render_settings.h" | 76 #include "printing/pdf_render_settings.h" |
77 #include "printing/print_settings.h" | 77 #include "printing/print_settings.h" |
78 #include "printing/printing_context.h" | 78 #include "printing/printing_context.h" |
79 #include "printing/units.h" | 79 #include "printing/units.h" |
80 #include "third_party/icu/source/i18n/unicode/ulocdata.h" | 80 #include "third_party/icu/source/i18n/unicode/ulocdata.h" |
81 | 81 |
82 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
83 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 83 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
84 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 84 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
85 #endif | 85 #endif |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 PostPrintToPdfTask(); | 1302 PostPrintToPdfTask(); |
1303 } | 1303 } |
1304 | 1304 |
1305 void PrintPreviewHandler::PostPrintToPdfTask() { | 1305 void PrintPreviewHandler::PostPrintToPdfTask() { |
1306 scoped_refptr<base::RefCountedBytes> data; | 1306 scoped_refptr<base::RefCountedBytes> data; |
1307 base::string16 title; | 1307 base::string16 title; |
1308 if (!GetPreviewDataAndTitle(&data, &title)) { | 1308 if (!GetPreviewDataAndTitle(&data, &title)) { |
1309 NOTREACHED() << "Preview data was checked before file dialog."; | 1309 NOTREACHED() << "Preview data was checked before file dialog."; |
1310 return; | 1310 return; |
1311 } | 1311 } |
1312 scoped_ptr<printing::PreviewMetafile> metafile(new printing::PreviewMetafile); | 1312 scoped_ptr<printing::PdfMetafileSkia> metafile(new printing::PdfMetafileSkia); |
1313 metafile->InitFromData(static_cast<const void*>(data->front()), data->size()); | 1313 metafile->InitFromData(static_cast<const void*>(data->front()), data->size()); |
1314 BrowserThread::PostTask( | 1314 BrowserThread::PostTask( |
1315 BrowserThread::FILE, FROM_HERE, | 1315 BrowserThread::FILE, FROM_HERE, |
1316 base::Bind(&PrintToPdfCallback, | 1316 base::Bind(&PrintToPdfCallback, |
1317 metafile.release(), | 1317 metafile.release(), |
1318 print_to_pdf_path_, | 1318 print_to_pdf_path_, |
1319 pdf_file_saved_closure_)); | 1319 pdf_file_saved_closure_)); |
1320 print_to_pdf_path_ = base::FilePath(); | 1320 print_to_pdf_path_ = base::FilePath(); |
1321 ClosePreviewDialog(); | 1321 ClosePreviewDialog(); |
1322 } | 1322 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 | 1588 |
1589 void PrintPreviewHandler::UnregisterForMergeSession() { | 1589 void PrintPreviewHandler::UnregisterForMergeSession() { |
1590 if (reconcilor_) | 1590 if (reconcilor_) |
1591 reconcilor_->RemoveMergeSessionObserver(this); | 1591 reconcilor_->RemoveMergeSessionObserver(this); |
1592 } | 1592 } |
1593 | 1593 |
1594 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1594 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
1595 const base::Closure& closure) { | 1595 const base::Closure& closure) { |
1596 pdf_file_saved_closure_ = closure; | 1596 pdf_file_saved_closure_ = closure; |
1597 } | 1597 } |
OLD | NEW |