| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 if (GetStickySettings()->color_model() != printing::UNKNOWN_COLOR_MODEL) { | 768 if (GetStickySettings()->color_model() != printing::UNKNOWN_COLOR_MODEL) { |
| 769 settings->SetBoolean( | 769 settings->SetBoolean( |
| 770 printing::kSettingSetColorAsDefault, | 770 printing::kSettingSetColorAsDefault, |
| 771 printing::isColorModelSelected( | 771 printing::isColorModelSelected( |
| 772 GetStickySettings()->color_model())); | 772 GetStickySettings()->color_model())); |
| 773 } | 773 } |
| 774 web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities", | 774 web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities", |
| 775 *settings); | 775 *settings); |
| 776 } | 776 } |
| 777 | 777 |
| 778 void PrintPreviewHandler::SendFailedToGetPrinterCapabilities( |
| 779 const std::string& printer_name) { |
| 780 VLOG(1) << "Get printer capabilities failed"; |
| 781 web_ui()->CallJavascriptFunction("failedToGetPrinterCapabilities", |
| 782 base::StringValue(printer_name)); |
| 783 } |
| 784 |
| 778 void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) { | 785 void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) { |
| 779 web_ui()->CallJavascriptFunction("setPrinters", printers); | 786 web_ui()->CallJavascriptFunction("setPrinters", printers); |
| 780 } | 787 } |
| 781 | 788 |
| 782 void PrintPreviewHandler::SendCloudPrintEnabled() { | 789 void PrintPreviewHandler::SendCloudPrintEnabled() { |
| 783 Profile* profile = Profile::FromBrowserContext( | 790 Profile* profile = Profile::FromBrowserContext( |
| 784 preview_web_contents()->GetBrowserContext()); | 791 preview_web_contents()->GetBrowserContext()); |
| 785 PrefService* prefs = profile->GetPrefs(); | 792 PrefService* prefs = profile->GetPrefs(); |
| 786 if (prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) { | 793 if (prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) { |
| 787 GURL gcp_url(CloudPrintURL(profile).GetCloudPrintServiceURL()); | 794 GURL gcp_url(CloudPrintURL(profile).GetCloudPrintServiceURL()); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 return; | 968 return; |
| 962 | 969 |
| 963 // We no longer require the initiator tab details. Remove those details | 970 // We no longer require the initiator tab details. Remove those details |
| 964 // associated with the preview tab to allow the initiator tab to create | 971 // associated with the preview tab to allow the initiator tab to create |
| 965 // another preview tab. | 972 // another preview tab. |
| 966 printing::PrintPreviewTabController* tab_controller = | 973 printing::PrintPreviewTabController* tab_controller = |
| 967 printing::PrintPreviewTabController::GetInstance(); | 974 printing::PrintPreviewTabController::GetInstance(); |
| 968 if (tab_controller) | 975 if (tab_controller) |
| 969 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); | 976 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); |
| 970 } | 977 } |
| OLD | NEW |