| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "printing/backend/print_backend_consts.h" | 79 #include "printing/backend/print_backend_consts.h" |
| 80 #include "printing/pdf_render_settings.h" | 80 #include "printing/pdf_render_settings.h" |
| 81 #include "printing/print_settings.h" | 81 #include "printing/print_settings.h" |
| 82 #include "printing/printing_context.h" | 82 #include "printing/printing_context.h" |
| 83 #include "printing/units.h" | 83 #include "printing/units.h" |
| 84 #include "third_party/icu/source/i18n/unicode/ulocdata.h" | 84 #include "third_party/icu/source/i18n/unicode/ulocdata.h" |
| 85 | 85 |
| 86 #if defined(OS_CHROMEOS) | 86 #if defined(OS_CHROMEOS) |
| 87 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 87 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 88 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 88 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 89 #include "chrome/common/url_constants.h" |
| 89 #endif | 90 #endif |
| 90 | 91 |
| 91 #if defined(ENABLE_SERVICE_DISCOVERY) | 92 #if defined(ENABLE_SERVICE_DISCOVERY) |
| 92 #include "chrome/browser/printing/cloud_print/privet_constants.h" | 93 #include "chrome/browser/printing/cloud_print/privet_constants.h" |
| 93 #endif | 94 #endif |
| 94 | 95 |
| 95 using content::BrowserThread; | 96 using content::BrowserThread; |
| 96 using content::RenderViewHost; | 97 using content::RenderViewHost; |
| 97 using content::WebContents; | 98 using content::WebContents; |
| 98 | 99 |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 weak_factory_.GetWeakPtr())); | 1162 weak_factory_.GetWeakPtr())); |
| 1162 | 1163 |
| 1163 // Cancel the pending preview request if exists. | 1164 // Cancel the pending preview request if exists. |
| 1164 print_preview_ui()->OnCancelPendingPreviewRequest(); | 1165 print_preview_ui()->OnCancelPendingPreviewRequest(); |
| 1165 } | 1166 } |
| 1166 #endif // ENABLE_BASIC_PRINTING | 1167 #endif // ENABLE_BASIC_PRINTING |
| 1167 | 1168 |
| 1168 void PrintPreviewHandler::HandleManagePrinters( | 1169 void PrintPreviewHandler::HandleManagePrinters( |
| 1169 const base::ListValue* /*args*/) { | 1170 const base::ListValue* /*args*/) { |
| 1170 ++manage_printers_dialog_request_count_; | 1171 ++manage_printers_dialog_request_count_; |
| 1172 #if defined(OS_CHROMEOS) |
| 1173 GURL local_printers_manage_url(chrome::kChromeUIMdCupsSettingsURL); |
| 1174 preview_web_contents()->OpenURL( |
| 1175 content::OpenURLParams(local_printers_manage_url, content::Referrer(), |
| 1176 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 1177 ui::PAGE_TRANSITION_LINK, false)); |
| 1178 #else |
| 1171 printing::PrinterManagerDialog::ShowPrinterManagerDialog(); | 1179 printing::PrinterManagerDialog::ShowPrinterManagerDialog(); |
| 1180 #endif |
| 1172 } | 1181 } |
| 1173 | 1182 |
| 1174 void PrintPreviewHandler::HandleClosePreviewDialog( | 1183 void PrintPreviewHandler::HandleClosePreviewDialog( |
| 1175 const base::ListValue* /*args*/) { | 1184 const base::ListValue* /*args*/) { |
| 1176 ReportStats(); | 1185 ReportStats(); |
| 1177 ReportUserActionHistogram(CANCEL); | 1186 ReportUserActionHistogram(CANCEL); |
| 1178 | 1187 |
| 1179 // Record the number of times the user requests to regenerate preview data | 1188 // Record the number of times the user requests to regenerate preview data |
| 1180 // before cancelling. | 1189 // before cancelling. |
| 1181 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforeCancel", | 1190 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforeCancel", |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 | 1765 |
| 1757 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { | 1766 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { |
| 1758 if (gaia_cookie_manager_service_) | 1767 if (gaia_cookie_manager_service_) |
| 1759 gaia_cookie_manager_service_->RemoveObserver(this); | 1768 gaia_cookie_manager_service_->RemoveObserver(this); |
| 1760 } | 1769 } |
| 1761 | 1770 |
| 1762 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1771 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
| 1763 const base::Closure& closure) { | 1772 const base::Closure& closure) { |
| 1764 pdf_file_saved_closure_ = closure; | 1773 pdf_file_saved_closure_ = closure; |
| 1765 } | 1774 } |
| OLD | NEW |