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_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 web_contents->GetDelegate()->ActivateContents(web_contents); | 756 web_contents->GetDelegate()->ActivateContents(web_contents); |
757 } | 757 } |
758 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 758 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
759 web_ui()->GetController()); | 759 web_ui()->GetController()); |
760 print_preview_ui->OnClosePrintPreviewTab(); | 760 print_preview_ui->OnClosePrintPreviewTab(); |
761 } | 761 } |
762 | 762 |
763 void PrintPreviewHandler::SendPrinterCapabilities( | 763 void PrintPreviewHandler::SendPrinterCapabilities( |
764 const DictionaryValue& settings_info) { | 764 const DictionaryValue& settings_info) { |
765 VLOG(1) << "Get printer capabilities finished"; | 765 VLOG(1) << "Get printer capabilities finished"; |
766 // Copy so we can override with sticky values. | |
767 scoped_ptr<DictionaryValue> settings(settings_info.DeepCopy()); | |
Lei Zhang
2012/09/05 00:32:32
Does removing this change our behavior w.r.t. the
gene
2012/09/05 21:04:10
Yes it does :(. Not removing it, will default to a
| |
768 if (GetStickySettings()->color_model() != printing::UNKNOWN_COLOR_MODEL) { | |
769 settings->SetBoolean( | |
770 printing::kSettingSetColorAsDefault, | |
771 printing::isColorModelSelected( | |
772 GetStickySettings()->color_model())); | |
773 } | |
774 web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities", | 766 web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities", |
775 *settings); | 767 settings_info); |
776 } | 768 } |
777 | 769 |
778 void PrintPreviewHandler::SendFailedToGetPrinterCapabilities( | 770 void PrintPreviewHandler::SendFailedToGetPrinterCapabilities( |
779 const std::string& printer_name) { | 771 const std::string& printer_name) { |
780 VLOG(1) << "Get printer capabilities failed"; | 772 VLOG(1) << "Get printer capabilities failed"; |
781 base::StringValue printer_name_value(printer_name); | 773 base::StringValue printer_name_value(printer_name); |
782 web_ui()->CallJavascriptFunction("failedToGetPrinterCapabilities", | 774 web_ui()->CallJavascriptFunction("failedToGetPrinterCapabilities", |
783 printer_name_value); | 775 printer_name_value); |
784 } | 776 } |
785 | 777 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 return; | 961 return; |
970 | 962 |
971 // We no longer require the initiator tab details. Remove those details | 963 // We no longer require the initiator tab details. Remove those details |
972 // associated with the preview tab to allow the initiator tab to create | 964 // associated with the preview tab to allow the initiator tab to create |
973 // another preview tab. | 965 // another preview tab. |
974 printing::PrintPreviewTabController* tab_controller = | 966 printing::PrintPreviewTabController* tab_controller = |
975 printing::PrintPreviewTabController::GetInstance(); | 967 printing::PrintPreviewTabController::GetInstance(); |
976 if (tab_controller) | 968 if (tab_controller) |
977 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); | 969 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); |
978 } | 970 } |
OLD | NEW |