| 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/printing/print_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
| 11 #include "chrome/browser/printing/print_job_manager.h" | 11 #include "chrome/browser/printing/print_job_manager.h" |
| 12 #include "chrome/browser/printing/print_preview_tab_controller.h" | 12 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 13 #include "chrome/browser/printing/printer_query.h" | 13 #include "chrome/browser/printing/printer_query.h" |
| 14 #include "chrome/browser/printing/print_view_manager_observer.h" | 14 #include "chrome/browser/printing/print_view_manager_observer.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/browser/ui/webui/print_preview_ui.h" | 16 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/print_messages.h" | 18 #include "chrome/common/print_messages.h" |
| 19 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
| 20 #include "content/browser/tab_contents/navigation_entry.h" | |
| 21 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 22 #include "content/common/notification_details.h" | 21 #include "content/common/notification_details.h" |
| 23 #include "content/common/notification_service.h" | 22 #include "content/common/notification_service.h" |
| 24 #include "content/common/notification_source.h" | 23 #include "content/common/notification_source.h" |
| 25 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 26 #include "printing/metafile.h" | 25 #include "printing/metafile.h" |
| 27 #include "printing/metafile_impl.h" | 26 #include "printing/metafile_impl.h" |
| 28 #include "printing/printed_document.h" | 27 #include "printing/printed_document.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 30 | 29 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 is_title_overridden_ = true; | 151 is_title_overridden_ = true; |
| 153 overridden_title_ = GenerateRenderSourceName(tab_contents); | 152 overridden_title_ = GenerateRenderSourceName(tab_contents); |
| 154 } | 153 } |
| 155 | 154 |
| 156 string16 PrintViewManager::RenderSourceName() { | 155 string16 PrintViewManager::RenderSourceName() { |
| 157 if (is_title_overridden_) | 156 if (is_title_overridden_) |
| 158 return overridden_title_; | 157 return overridden_title_; |
| 159 return GenerateRenderSourceName(tab_contents()); | 158 return GenerateRenderSourceName(tab_contents()); |
| 160 } | 159 } |
| 161 | 160 |
| 162 GURL PrintViewManager::RenderSourceUrl() { | |
| 163 NavigationEntry* entry = tab_contents()->controller().GetActiveEntry(); | |
| 164 if (entry) | |
| 165 return entry->virtual_url(); | |
| 166 return GURL(); | |
| 167 } | |
| 168 | |
| 169 void PrintViewManager::OnDidGetPrintedPagesCount(int cookie, int number_pages) { | 161 void PrintViewManager::OnDidGetPrintedPagesCount(int cookie, int number_pages) { |
| 170 DCHECK_GT(cookie, 0); | 162 DCHECK_GT(cookie, 0); |
| 171 DCHECK_GT(number_pages, 0); | 163 DCHECK_GT(number_pages, 0); |
| 172 number_pages_ = number_pages; | 164 number_pages_ = number_pages; |
| 173 OpportunisticallyCreatePrintJob(cookie); | 165 OpportunisticallyCreatePrintJob(cookie); |
| 174 } | 166 } |
| 175 | 167 |
| 176 void PrintViewManager::OnDidGetDocumentCookie(int cookie) { | 168 void PrintViewManager::OnDidGetDocumentCookie(int cookie) { |
| 177 cookie_ = cookie; | 169 cookie_ = cookie; |
| 178 } | 170 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 } | 526 } |
| 535 | 527 |
| 536 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { | 528 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { |
| 537 // Don't print / print preview interstitials. | 529 // Don't print / print preview interstitials. |
| 538 if (tab_contents()->showing_interstitial_page()) | 530 if (tab_contents()->showing_interstitial_page()) |
| 539 return false; | 531 return false; |
| 540 return Send(message); | 532 return Send(message); |
| 541 } | 533 } |
| 542 | 534 |
| 543 } // namespace printing | 535 } // namespace printing |
| OLD | NEW |