| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 void PrintPreviewHandler::PrintToPdf() { | 1014 void PrintPreviewHandler::PrintToPdf() { |
| 1015 if (!print_to_pdf_path_.empty()) { | 1015 if (!print_to_pdf_path_.empty()) { |
| 1016 // User has already selected a path, no need to show the dialog again. | 1016 // User has already selected a path, no need to show the dialog again. |
| 1017 PostPrintToPdfTask(); | 1017 PostPrintToPdfTask(); |
| 1018 } else if (!select_file_dialog_.get() || | 1018 } else if (!select_file_dialog_.get() || |
| 1019 !select_file_dialog_->IsRunning(platform_util::GetTopLevel( | 1019 !select_file_dialog_->IsRunning(platform_util::GetTopLevel( |
| 1020 preview_web_contents()->GetNativeView()))) { | 1020 preview_web_contents()->GetNativeView()))) { |
| 1021 // Pre-populating select file dialog with print job title. | 1021 // Pre-populating select file dialog with print job title. |
| 1022 base::string16 print_job_title_utf16 = | 1022 const base::string16& print_job_title_utf16 = |
| 1023 print_preview_ui()->initiator_title(); | 1023 print_preview_ui()->initiator_title(); |
| 1024 | 1024 |
| 1025 #if defined(OS_WIN) | 1025 #if defined(OS_WIN) |
| 1026 base::FilePath::StringType print_job_title(print_job_title_utf16); | 1026 base::FilePath::StringType print_job_title(print_job_title_utf16); |
| 1027 #elif defined(OS_POSIX) | 1027 #elif defined(OS_POSIX) |
| 1028 base::FilePath::StringType print_job_title = | 1028 base::FilePath::StringType print_job_title = |
| 1029 base::UTF16ToUTF8(print_job_title_utf16); | 1029 base::UTF16ToUTF8(print_job_title_utf16); |
| 1030 #endif | 1030 #endif |
| 1031 | 1031 |
| 1032 base::i18n::ReplaceIllegalCharactersInPath(&print_job_title, '_'); | 1032 base::i18n::ReplaceIllegalCharactersInPath(&print_job_title, '_'); |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 | 1794 |
| 1795 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { | 1795 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { |
| 1796 if (gaia_cookie_manager_service_) | 1796 if (gaia_cookie_manager_service_) |
| 1797 gaia_cookie_manager_service_->RemoveObserver(this); | 1797 gaia_cookie_manager_service_->RemoveObserver(this); |
| 1798 } | 1798 } |
| 1799 | 1799 |
| 1800 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1800 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
| 1801 const base::Closure& closure) { | 1801 const base::Closure& closure) { |
| 1802 pdf_file_saved_closure_ = closure; | 1802 pdf_file_saved_closure_ = closure; |
| 1803 } | 1803 } |
| OLD | NEW |