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/printing/print_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/histogram.h" | |
12 #include "base/timer.h" | 13 #include "base/timer.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/printing/print_error_dialog.h" | 16 #include "chrome/browser/printing/print_error_dialog.h" |
16 #include "chrome/browser/printing/print_job.h" | 17 #include "chrome/browser/printing/print_job.h" |
17 #include "chrome/browser/printing/print_job_manager.h" | 18 #include "chrome/browser/printing/print_job_manager.h" |
18 #include "chrome/browser/printing/print_preview_tab_controller.h" | 19 #include "chrome/browser/printing/print_preview_tab_controller.h" |
19 #include "chrome/browser/printing/print_view_manager_observer.h" | 20 #include "chrome/browser/printing/print_view_manager_observer.h" |
20 #include "chrome/browser/printing/printer_query.h" | 21 #include "chrome/browser/printing/printer_query.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 103 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
103 print_preview_tab->web_contents()->GetWebUI()->GetController()); | 104 print_preview_tab->web_contents()->GetWebUI()->GetController()); |
104 print_preview_ui->OnShowSystemDialog(); | 105 print_preview_ui->OnShowSystemDialog(); |
105 return true; | 106 return true; |
106 } else { | 107 } else { |
107 return PrintNow(); | 108 return PrintNow(); |
108 } | 109 } |
109 } | 110 } |
110 | 111 |
111 bool PrintViewManager::PrintToDestination() { | 112 bool PrintViewManager::PrintToDestination() { |
113 // TODO(mad): Remove this once we can send user metrics from the metro driver. | |
114 // crbug.com/142330 | |
115 UMA_HISTOGRAM_ENUMERATION("Metro.Print", 0, 2); | |
Ilya Sherman
2012/08/13 22:34:00
nit: Please use named constants from an enum rathe
| |
112 // TODO(mad): Use a passed in destination interface instead. | 116 // TODO(mad): Use a passed in destination interface instead. |
113 g_browser_process->print_job_manager()->SetPrintDestination( | 117 g_browser_process->print_job_manager()->SetPrintDestination( |
114 printing::CreatePrintDestination()); | 118 printing::CreatePrintDestination()); |
115 return PrintNowInternal(new PrintMsg_PrintPages(routing_id())); | 119 return PrintNowInternal(new PrintMsg_PrintPages(routing_id())); |
116 } | 120 } |
117 | 121 |
118 bool PrintViewManager::PrintPreviewNow() { | 122 bool PrintViewManager::PrintPreviewNow() { |
119 if (print_preview_state_ != NOT_PREVIEWING) { | 123 if (print_preview_state_ != NOT_PREVIEWING) { |
120 NOTREACHED(); | 124 NOTREACHED(); |
121 return false; | 125 return false; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 scoped_refptr<printing::PrinterQuery> printer_query; | 655 scoped_refptr<printing::PrinterQuery> printer_query; |
652 print_job_manager->PopPrinterQuery(cookie, &printer_query); | 656 print_job_manager->PopPrinterQuery(cookie, &printer_query); |
653 if (!printer_query.get()) | 657 if (!printer_query.get()) |
654 return; | 658 return; |
655 BrowserThread::PostTask( | 659 BrowserThread::PostTask( |
656 BrowserThread::IO, FROM_HERE, | 660 BrowserThread::IO, FROM_HERE, |
657 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 661 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
658 } | 662 } |
659 | 663 |
660 } // namespace printing | 664 } // namespace printing |
OLD | NEW |