| 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_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/common/chrome_features.h" | 30 #include "chrome/common/chrome_features.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 32 #include "chrome/grit/browser_resources.h" | 32 #include "chrome/grit/browser_resources.h" |
| 33 #include "chrome/grit/chromium_strings.h" | 33 #include "chrome/grit/chromium_strings.h" |
| 34 #include "chrome/grit/generated_resources.h" | 34 #include "chrome/grit/generated_resources.h" |
| 35 #include "components/printing/common/print_messages.h" | 35 #include "components/printing/common/print_messages.h" |
| 36 #include "components/strings/grit/components_strings.h" | 36 #include "components/strings/grit/components_strings.h" |
| 37 #include "content/public/browser/url_data_source.h" | 37 #include "content/public/browser/url_data_source.h" |
| 38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/browser/web_ui_data_source.h" | 39 #include "content/public/browser/web_ui_data_source.h" |
| 40 #include "printing/features/features.h" |
| 40 #include "printing/page_size_margins.h" | 41 #include "printing/page_size_margins.h" |
| 41 #include "printing/print_job_constants.h" | 42 #include "printing/print_job_constants.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/gfx/geometry/rect.h" | 44 #include "ui/gfx/geometry/rect.h" |
| 44 #include "ui/web_dialogs/web_dialog_delegate.h" | 45 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 45 #include "ui/web_dialogs/web_dialog_ui.h" | 46 #include "ui/web_dialogs/web_dialog_ui.h" |
| 46 | 47 |
| 47 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 48 #include "base/command_line.h" | 49 #include "base/command_line.h" |
| 49 #include "base/feature_list.h" | 50 #include "base/feature_list.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 526 } |
| 526 | 527 |
| 527 void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { | 528 void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { |
| 528 if (!initial_preview_start_time_.is_null()) { | 529 if (!initial_preview_start_time_.is_null()) { |
| 529 UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", | 530 UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", |
| 530 base::TimeTicks::Now() - initial_preview_start_time_); | 531 base::TimeTicks::Now() - initial_preview_start_time_); |
| 531 } | 532 } |
| 532 g_print_preview_request_id_map.Get().Set(id_, request_id); | 533 g_print_preview_request_id_map.Get().Set(id_, request_id); |
| 533 } | 534 } |
| 534 | 535 |
| 535 #if defined(ENABLE_BASIC_PRINTING) | 536 #if BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 536 void PrintPreviewUI::OnShowSystemDialog() { | 537 void PrintPreviewUI::OnShowSystemDialog() { |
| 537 web_ui()->CallJavascriptFunctionUnsafe("onSystemDialogLinkClicked"); | 538 web_ui()->CallJavascriptFunctionUnsafe("onSystemDialogLinkClicked"); |
| 538 } | 539 } |
| 539 #endif // ENABLE_BASIC_PRINTING | 540 #endif // ENABLE_BASIC_PRINTING |
| 540 | 541 |
| 541 void PrintPreviewUI::OnDidGetPreviewPageCount( | 542 void PrintPreviewUI::OnDidGetPreviewPageCount( |
| 542 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 543 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
| 543 DCHECK_GT(params.page_count, 0); | 544 DCHECK_GT(params.page_count, 0); |
| 544 if (g_testing_delegate) | 545 if (g_testing_delegate) |
| 545 g_testing_delegate->DidGetPreviewPageCount(params.page_count); | 546 g_testing_delegate->DidGetPreviewPageCount(params.page_count); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 684 } |
| 684 | 685 |
| 685 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 686 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
| 686 handler_->FileSelected(path, 0, NULL); | 687 handler_->FileSelected(path, 0, NULL); |
| 687 } | 688 } |
| 688 | 689 |
| 689 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 690 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
| 690 const base::Closure& closure) { | 691 const base::Closure& closure) { |
| 691 handler_->SetPdfSavedClosureForTesting(closure); | 692 handler_->SetPdfSavedClosureForTesting(closure); |
| 692 } | 693 } |
| OLD | NEW |