| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview_handler.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "printing/page_size_margins.h" | 51 #include "printing/page_size_margins.h" |
| 52 #include "printing/print_settings.h" | 52 #include "printing/print_settings.h" |
| 53 #include "unicode/ulocdata.h" | 53 #include "unicode/ulocdata.h" |
| 54 | 54 |
| 55 #if !defined(OS_MACOSX) | 55 #if !defined(OS_MACOSX) |
| 56 #include "base/command_line.h" | 56 #include "base/command_line.h" |
| 57 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 using content::BrowserThread; | 60 using content::BrowserThread; |
| 61 using content::NavigationEntry; |
| 61 using content::OpenURLParams; | 62 using content::OpenURLParams; |
| 62 using content::Referrer; | 63 using content::Referrer; |
| 63 using printing::Metafile; | 64 using printing::Metafile; |
| 64 | 65 |
| 65 namespace { | 66 namespace { |
| 66 | 67 |
| 67 enum UserActionBuckets { | 68 enum UserActionBuckets { |
| 68 PRINT_TO_PRINTER, | 69 PRINT_TO_PRINTER, |
| 69 PRINT_TO_PDF, | 70 PRINT_TO_PDF, |
| 70 CANCEL, | 71 CANCEL, |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // headers and footers are to be displayed. | 308 // headers and footers are to be displayed. |
| 308 bool display_header_footer = false; | 309 bool display_header_footer = false; |
| 309 if (!settings->GetBoolean(printing::kSettingHeaderFooterEnabled, | 310 if (!settings->GetBoolean(printing::kSettingHeaderFooterEnabled, |
| 310 &display_header_footer)) { | 311 &display_header_footer)) { |
| 311 NOTREACHED(); | 312 NOTREACHED(); |
| 312 } | 313 } |
| 313 if (display_header_footer) { | 314 if (display_header_footer) { |
| 314 settings->SetString(printing::kSettingHeaderFooterTitle, | 315 settings->SetString(printing::kSettingHeaderFooterTitle, |
| 315 initiator_tab->tab_contents()->GetTitle()); | 316 initiator_tab->tab_contents()->GetTitle()); |
| 316 std::string url; | 317 std::string url; |
| 317 content::NavigationEntry* entry = | 318 NavigationEntry* entry = |
| 318 initiator_tab->tab_contents()->GetController().GetActiveEntry(); | 319 initiator_tab->tab_contents()->GetController().GetActiveEntry(); |
| 319 if (entry) | 320 if (entry) |
| 320 url = entry->GetVirtualURL().spec(); | 321 url = entry->GetVirtualURL().spec(); |
| 321 settings->SetString(printing::kSettingHeaderFooterURL, url); | 322 settings->SetString(printing::kSettingHeaderFooterURL, url); |
| 322 } | 323 } |
| 323 | 324 |
| 324 bool generate_draft_data = false; | 325 bool generate_draft_data = false; |
| 325 bool success = settings->GetBoolean(printing::kSettingGenerateDraftData, | 326 bool success = settings->GetBoolean(printing::kSettingGenerateDraftData, |
| 326 &generate_draft_data); | 327 &generate_draft_data); |
| 327 DCHECK(success); | 328 DCHECK(success); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 return; | 856 return; |
| 856 | 857 |
| 857 // We no longer require the initiator tab details. Remove those details | 858 // We no longer require the initiator tab details. Remove those details |
| 858 // associated with the preview tab to allow the initiator tab to create | 859 // associated with the preview tab to allow the initiator tab to create |
| 859 // another preview tab. | 860 // another preview tab. |
| 860 printing::PrintPreviewTabController* tab_controller = | 861 printing::PrintPreviewTabController* tab_controller = |
| 861 printing::PrintPreviewTabController::GetInstance(); | 862 printing::PrintPreviewTabController::GetInstance(); |
| 862 if (tab_controller) | 863 if (tab_controller) |
| 863 tab_controller->EraseInitiatorTabInfo(preview_tab_wrapper()); | 864 tab_controller->EraseInitiatorTabInfo(preview_tab_wrapper()); |
| 864 } | 865 } |
| OLD | NEW |