Chromium Code Reviews| 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 | 8 |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 | 513 |
| 514 if (!initial_preview_start_time_.is_null()) { | 514 if (!initial_preview_start_time_.is_null()) { |
| 515 UMA_HISTOGRAM_TIMES("PrintPreview.InitialDisplayTime", | 515 UMA_HISTOGRAM_TIMES("PrintPreview.InitialDisplayTime", |
| 516 base::TimeTicks::Now() - initial_preview_start_time_); | 516 base::TimeTicks::Now() - initial_preview_start_time_); |
| 517 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.Initial", | 517 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.Initial", |
| 518 expected_pages_count); | 518 expected_pages_count); |
| 519 initial_preview_start_time_ = base::TimeTicks(); | 519 initial_preview_start_time_ = base::TimeTicks(); |
| 520 } | 520 } |
| 521 base::FundamentalValue ui_identifier(id_); | 521 base::FundamentalValue ui_identifier(id_); |
| 522 base::FundamentalValue ui_preview_request_id(preview_request_id); | 522 base::FundamentalValue ui_preview_request_id(preview_request_id); |
| 523 web_ui()->CallJavascriptFunction("updatePrintPreview", ui_identifier, | 523 if (AutoCancelForTesting()) { |
|
Vitaly Buka (NO REVIEWS)
2013/08/29 00:10:25
Is possible to avoid js chages and just call OnHid
dharcourt
2013/08/29 04:02:02
Calling OnHidePreviewDialog() doesn't work (the te
| |
| 524 ui_preview_request_id); | 524 web_ui()->CallJavascriptFunction("autoCancelPrintPreviewForTesting"); |
| 525 } else { | |
| 526 web_ui()->CallJavascriptFunction("updatePrintPreview", ui_identifier, | |
| 527 ui_preview_request_id); | |
| 528 } | |
| 525 } | 529 } |
| 526 | 530 |
| 527 void PrintPreviewUI::OnPrintPreviewDialogDestroyed() { | 531 void PrintPreviewUI::OnPrintPreviewDialogDestroyed() { |
| 528 handler_->OnPrintPreviewDialogDestroyed(); | 532 handler_->OnPrintPreviewDialogDestroyed(); |
| 529 } | 533 } |
| 530 | 534 |
| 531 void PrintPreviewUI::OnFileSelectionCancelled() { | 535 void PrintPreviewUI::OnFileSelectionCancelled() { |
| 532 web_ui()->CallJavascriptFunction("fileSelectionCancelled"); | 536 web_ui()->CallJavascriptFunction("fileSelectionCancelled"); |
| 533 } | 537 } |
| 534 | 538 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 delegate->OnDialogCloseFromWebUI(); | 579 delegate->OnDialogCloseFromWebUI(); |
| 576 } | 580 } |
| 577 | 581 |
| 578 void PrintPreviewUI::OnReloadPrintersList() { | 582 void PrintPreviewUI::OnReloadPrintersList() { |
| 579 web_ui()->CallJavascriptFunction("reloadPrintersList"); | 583 web_ui()->CallJavascriptFunction("reloadPrintersList"); |
| 580 } | 584 } |
| 581 | 585 |
| 582 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { | 586 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { |
| 583 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); | 587 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); |
| 584 } | 588 } |
| 589 | |
| 590 static bool auto_cancel_for_testing_ = false; | |
|
Vitaly Buka (NO REVIEWS)
2013/08/28 01:20:26
auto_cancel_for_testing_ -> g_auto_cancel_for_test
dharcourt
2013/08/28 23:23:57
Done, thanks.
| |
| 591 | |
| 592 void PrintPreviewUI::SetAutoCancelForTesting(bool auto_cancel) { | |
| 593 auto_cancel_for_testing_ = auto_cancel; | |
| 594 } | |
| 595 | |
| 596 bool PrintPreviewUI::AutoCancelForTesting() { | |
| 597 return auto_cancel_for_testing_; | |
| 598 } | |
| 599 | |
| OLD | NEW |