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/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 479 } |
480 | 480 |
481 void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { | 481 void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { |
482 if (!initial_preview_start_time_.is_null()) { | 482 if (!initial_preview_start_time_.is_null()) { |
483 UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", | 483 UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", |
484 base::TimeTicks::Now() - initial_preview_start_time_); | 484 base::TimeTicks::Now() - initial_preview_start_time_); |
485 } | 485 } |
486 g_print_preview_request_id_map.Get().Set(id_, request_id); | 486 g_print_preview_request_id_map.Get().Set(id_, request_id); |
487 } | 487 } |
488 | 488 |
489 #if !defined(DISABLE_BASIC_PRINTING) | 489 #if defined(ENABLE_BASIC_PRINTING) |
490 void PrintPreviewUI::OnShowSystemDialog() { | 490 void PrintPreviewUI::OnShowSystemDialog() { |
491 web_ui()->CallJavascriptFunction("onSystemDialogLinkClicked"); | 491 web_ui()->CallJavascriptFunction("onSystemDialogLinkClicked"); |
492 } | 492 } |
493 #endif // !DISABLE_BASIC_PRINTING | 493 #endif // ENABLE_BASIC_PRINTING |
494 | 494 |
495 void PrintPreviewUI::OnDidGetPreviewPageCount( | 495 void PrintPreviewUI::OnDidGetPreviewPageCount( |
496 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 496 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
497 DCHECK_GT(params.page_count, 0); | 497 DCHECK_GT(params.page_count, 0); |
498 if (g_testing_delegate) | 498 if (g_testing_delegate) |
499 g_testing_delegate->DidGetPreviewPageCount(params.page_count); | 499 g_testing_delegate->DidGetPreviewPageCount(params.page_count); |
500 base::FundamentalValue count(params.page_count); | 500 base::FundamentalValue count(params.page_count); |
501 base::FundamentalValue request_id(params.preview_request_id); | 501 base::FundamentalValue request_id(params.preview_request_id); |
502 web_ui()->CallJavascriptFunction("onDidGetPreviewPageCount", | 502 web_ui()->CallJavascriptFunction("onDidGetPreviewPageCount", |
503 count, | 503 count, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 637 } |
638 | 638 |
639 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 639 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
640 handler_->FileSelected(path, 0, NULL); | 640 handler_->FileSelected(path, 0, NULL); |
641 } | 641 } |
642 | 642 |
643 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 643 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
644 const base::Closure& closure) { | 644 const base::Closure& closure) { |
645 handler_->SetPdfSavedClosureForTesting(closure); | 645 handler_->SetPdfSavedClosureForTesting(closure); |
646 } | 646 } |
OLD | NEW |