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

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

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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_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 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 880
881 int width = 0; 881 int width = 0;
882 int height = 0; 882 int height = 0;
883 if (!settings->GetString(printing::kSettingDeviceName, &printer_name) || 883 if (!settings->GetString(printing::kSettingDeviceName, &printer_name) ||
884 !settings->GetString(printing::kSettingTicket, &print_ticket) || 884 !settings->GetString(printing::kSettingTicket, &print_ticket) ||
885 !settings->GetString(printing::kSettingCapabilities, &capabilities) || 885 !settings->GetString(printing::kSettingCapabilities, &capabilities) ||
886 !settings->GetInteger(printing::kSettingPageWidth, &width) || 886 !settings->GetInteger(printing::kSettingPageWidth, &width) ||
887 !settings->GetInteger(printing::kSettingPageHeight, &height) || 887 !settings->GetInteger(printing::kSettingPageHeight, &height) ||
888 width <= 0 || height <= 0) { 888 width <= 0 || height <= 0) {
889 NOTREACHED(); 889 NOTREACHED();
890 base::FundamentalValue http_code_value(-1); 890 base::Value http_code_value(-1);
891 web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrintFailed", 891 web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrintFailed",
892 http_code_value); 892 http_code_value);
893 return; 893 return;
894 } 894 }
895 895
896 PrintToPrivetPrinter( 896 PrintToPrivetPrinter(
897 printer_name, print_ticket, capabilities, gfx::Size(width, height)); 897 printer_name, print_ticket, capabilities, gfx::Size(width, height));
898 return; 898 return;
899 } 899 }
900 #endif 900 #endif
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 privet_local_print_operation_ = 1599 privet_local_print_operation_ =
1600 privet_http_client_->CreateLocalPrintOperation(this); 1600 privet_http_client_->CreateLocalPrintOperation(this);
1601 1601
1602 privet_local_print_operation_->SetTicket(print_ticket); 1602 privet_local_print_operation_->SetTicket(print_ticket);
1603 privet_local_print_operation_->SetCapabilities(capabilities); 1603 privet_local_print_operation_->SetCapabilities(capabilities);
1604 1604
1605 scoped_refptr<base::RefCountedBytes> data; 1605 scoped_refptr<base::RefCountedBytes> data;
1606 base::string16 title; 1606 base::string16 title;
1607 1607
1608 if (!GetPreviewDataAndTitle(&data, &title)) { 1608 if (!GetPreviewDataAndTitle(&data, &title)) {
1609 base::FundamentalValue http_code_value(-1); 1609 base::Value http_code_value(-1);
1610 web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrintFailed", 1610 web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrintFailed",
1611 http_code_value); 1611 http_code_value);
1612 return; 1612 return;
1613 } 1613 }
1614 1614
1615 privet_local_print_operation_->SetJobname(base::UTF16ToUTF8(title)); 1615 privet_local_print_operation_->SetJobname(base::UTF16ToUTF8(title));
1616 privet_local_print_operation_->SetPageSize(page_size); 1616 privet_local_print_operation_->SetPageSize(page_size);
1617 privet_local_print_operation_->SetData(data.get()); 1617 privet_local_print_operation_->SetData(data.get());
1618 1618
1619 Profile* profile = Profile::FromWebUI(web_ui()); 1619 Profile* profile = Profile::FromWebUI(web_ui());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 } 1698 }
1699 1699
1700 void PrintPreviewHandler::OnPrivetPrintingDone( 1700 void PrintPreviewHandler::OnPrivetPrintingDone(
1701 const cloud_print::PrivetLocalPrintOperation* print_operation) { 1701 const cloud_print::PrivetLocalPrintOperation* print_operation) {
1702 ClosePreviewDialog(); 1702 ClosePreviewDialog();
1703 } 1703 }
1704 1704
1705 void PrintPreviewHandler::OnPrivetPrintingError( 1705 void PrintPreviewHandler::OnPrivetPrintingError(
1706 const cloud_print::PrivetLocalPrintOperation* print_operation, 1706 const cloud_print::PrivetLocalPrintOperation* print_operation,
1707 int http_code) { 1707 int http_code) {
1708 base::FundamentalValue http_code_value(http_code); 1708 base::Value http_code_value(http_code);
1709 web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrintFailed", 1709 web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrintFailed",
1710 http_code_value); 1710 http_code_value);
1711 } 1711 }
1712 1712
1713 void PrintPreviewHandler::FillPrinterDescription( 1713 void PrintPreviewHandler::FillPrinterDescription(
1714 const std::string& name, 1714 const std::string& name,
1715 const cloud_print::DeviceDescription& description, 1715 const cloud_print::DeviceDescription& description,
1716 bool has_local_printing, 1716 bool has_local_printing,
1717 base::DictionaryValue* printer_value) { 1717 base::DictionaryValue* printer_value) {
1718 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 1718 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
(...skipping 14 matching lines...) Expand all
1733 return; 1733 return;
1734 1734
1735 extension_printer_handler_ = 1735 extension_printer_handler_ =
1736 PrinterHandler::CreateForExtensionPrinters(Profile::FromWebUI(web_ui())); 1736 PrinterHandler::CreateForExtensionPrinters(Profile::FromWebUI(web_ui()));
1737 } 1737 }
1738 1738
1739 void PrintPreviewHandler::OnGotPrintersForExtension( 1739 void PrintPreviewHandler::OnGotPrintersForExtension(
1740 const base::ListValue& printers, 1740 const base::ListValue& printers,
1741 bool done) { 1741 bool done) {
1742 web_ui()->CallJavascriptFunctionUnsafe("onExtensionPrintersAdded", printers, 1742 web_ui()->CallJavascriptFunctionUnsafe("onExtensionPrintersAdded", printers,
1743 base::FundamentalValue(done)); 1743 base::Value(done));
1744 } 1744 }
1745 1745
1746 void PrintPreviewHandler::OnGotExtensionPrinterInfo( 1746 void PrintPreviewHandler::OnGotExtensionPrinterInfo(
1747 const std::string& printer_id, 1747 const std::string& printer_id,
1748 const base::DictionaryValue& printer_info) { 1748 const base::DictionaryValue& printer_info) {
1749 if (printer_info.empty()) { 1749 if (printer_info.empty()) {
1750 web_ui()->CallJavascriptFunctionUnsafe("failedToResolveProvisionalPrinter", 1750 web_ui()->CallJavascriptFunctionUnsafe("failedToResolveProvisionalPrinter",
1751 base::StringValue(printer_id)); 1751 base::StringValue(printer_id));
1752 return; 1752 return;
1753 } 1753 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 1798
1799 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1799 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1800 if (gaia_cookie_manager_service_) 1800 if (gaia_cookie_manager_service_)
1801 gaia_cookie_manager_service_->RemoveObserver(this); 1801 gaia_cookie_manager_service_->RemoveObserver(this);
1802 } 1802 }
1803 1803
1804 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1804 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1805 const base::Closure& closure) { 1805 const base::Closure& closure) {
1806 pdf_file_saved_closure_ = closure; 1806 pdf_file_saved_closure_ = closure;
1807 } 1807 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/policy_ui_browsertest.cc ('k') | chrome/browser/ui/webui/print_preview/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698