| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 void PrintPreviewUI::OnDidPreviewPage(int page_number, | 597 void PrintPreviewUI::OnDidPreviewPage(int page_number, |
| 598 int preview_request_id) { | 598 int preview_request_id) { |
| 599 DCHECK_GE(page_number, 0); | 599 DCHECK_GE(page_number, 0); |
| 600 base::FundamentalValue number(page_number); | 600 base::FundamentalValue number(page_number); |
| 601 base::FundamentalValue ui_identifier(id_); | 601 base::FundamentalValue ui_identifier(id_); |
| 602 base::FundamentalValue request_id(preview_request_id); | 602 base::FundamentalValue request_id(preview_request_id); |
| 603 if (g_testing_delegate) | 603 if (g_testing_delegate) |
| 604 g_testing_delegate->DidRenderPreviewPage(web_ui()->GetWebContents()); | 604 g_testing_delegate->DidRenderPreviewPage(web_ui()->GetWebContents()); |
| 605 web_ui()->CallJavascriptFunctionUnsafe("onDidPreviewPage", number, | 605 web_ui()->CallJavascriptFunctionUnsafe("onDidPreviewPage", number, |
| 606 ui_identifier, request_id); | 606 ui_identifier, request_id); |
| 607 if (g_testing_delegate && g_testing_delegate->IsAutoCancelEnabled()) | |
| 608 web_ui()->CallJavascriptFunctionUnsafe("autoCancelForTesting"); | |
| 609 } | 607 } |
| 610 | 608 |
| 611 void PrintPreviewUI::OnPreviewDataIsAvailable(int expected_pages_count, | 609 void PrintPreviewUI::OnPreviewDataIsAvailable(int expected_pages_count, |
| 612 int preview_request_id) { | 610 int preview_request_id) { |
| 613 VLOG(1) << "Print preview request finished with " | 611 VLOG(1) << "Print preview request finished with " |
| 614 << expected_pages_count << " pages"; | 612 << expected_pages_count << " pages"; |
| 615 | 613 |
| 616 if (!initial_preview_start_time_.is_null()) { | 614 if (!initial_preview_start_time_.is_null()) { |
| 617 UMA_HISTOGRAM_TIMES("PrintPreview.InitialDisplayTime", | 615 UMA_HISTOGRAM_TIMES("PrintPreview.InitialDisplayTime", |
| 618 base::TimeTicks::Now() - initial_preview_start_time_); | 616 base::TimeTicks::Now() - initial_preview_start_time_); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 } | 695 } |
| 698 | 696 |
| 699 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 697 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
| 700 handler_->FileSelected(path, 0, NULL); | 698 handler_->FileSelected(path, 0, NULL); |
| 701 } | 699 } |
| 702 | 700 |
| 703 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 701 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
| 704 const base::Closure& closure) { | 702 const base::Closure& closure) { |
| 705 handler_->SetPdfSavedClosureForTesting(closure); | 703 handler_->SetPdfSavedClosureForTesting(closure); |
| 706 } | 704 } |
| OLD | NEW |