Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_ui.cc

Issue 2948723002: Print Preview: Change print to cr.sendWithPromise (Closed)
Patch Set: Address comments and add close_ param Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
8 #include <utility> 9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/feature_list.h" 12 #include "base/feature_list.h"
12 #include "base/id_map.h" 13 #include "base/id_map.h"
13 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
16 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/ref_counted_memory.h"
17 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 "PrintPreview.RegeneratePreviewRequest.BeforeFirstData", 615 "PrintPreview.RegeneratePreviewRequest.BeforeFirstData",
615 handler_->regenerate_preview_request_count()); 616 handler_->regenerate_preview_request_count());
616 initial_preview_start_time_ = base::TimeTicks(); 617 initial_preview_start_time_ = base::TimeTicks();
617 } 618 }
618 base::Value ui_identifier(id_); 619 base::Value ui_identifier(id_);
619 base::Value ui_preview_request_id(preview_request_id); 620 base::Value ui_preview_request_id(preview_request_id);
620 web_ui()->CallJavascriptFunctionUnsafe("updatePrintPreview", ui_identifier, 621 web_ui()->CallJavascriptFunctionUnsafe("updatePrintPreview", ui_identifier,
621 ui_preview_request_id); 622 ui_preview_request_id);
622 } 623 }
623 624
624 void PrintPreviewUI::OnFileSelectionCancelled() {
625 web_ui()->CallJavascriptFunctionUnsafe("fileSelectionCancelled");
626 }
627
628 void PrintPreviewUI::OnCancelPendingPreviewRequest() { 625 void PrintPreviewUI::OnCancelPendingPreviewRequest() {
629 g_print_preview_request_id_map.Get().Set(id_, -1); 626 g_print_preview_request_id_map.Get().Set(id_, -1);
630 } 627 }
631 628
632 void PrintPreviewUI::OnPrintPreviewFailed() { 629 void PrintPreviewUI::OnPrintPreviewFailed() {
633 handler_->OnPrintPreviewFailed(); 630 handler_->OnPrintPreviewFailed();
634 web_ui()->CallJavascriptFunctionUnsafe("printPreviewFailed"); 631 web_ui()->CallJavascriptFunctionUnsafe("printPreviewFailed");
635 } 632 }
636 633
637 void PrintPreviewUI::OnInvalidPrinterSettings() { 634 void PrintPreviewUI::OnInvalidPrinterSettings() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 685 }
689 686
690 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { 687 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) {
691 handler_->FileSelected(path, 0, NULL); 688 handler_->FileSelected(path, 0, NULL);
692 } 689 }
693 690
694 void PrintPreviewUI::SetPdfSavedClosureForTesting( 691 void PrintPreviewUI::SetPdfSavedClosureForTesting(
695 const base::Closure& closure) { 692 const base::Closure& closure) {
696 handler_->SetPdfSavedClosureForTesting(closure); 693 handler_->SetPdfSavedClosureForTesting(closure);
697 } 694 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698