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

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

Issue 166283002: "Privet" Printing reads DPI for PWG raster conversion from device capabilities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include <string> 9 #include <string>
10 10
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1443
1444 scoped_refptr<base::RefCountedBytes> data; 1444 scoped_refptr<base::RefCountedBytes> data;
1445 base::string16 title; 1445 base::string16 title;
1446 1446
1447 if (!GetPreviewDataAndTitle(&data, &title)) { 1447 if (!GetPreviewDataAndTitle(&data, &title)) {
1448 base::FundamentalValue http_code_value(-1); 1448 base::FundamentalValue http_code_value(-1);
1449 web_ui()->CallJavascriptFunction("onPrivetPrintFailed", http_code_value); 1449 web_ui()->CallJavascriptFunction("onPrivetPrintFailed", http_code_value);
1450 return; 1450 return;
1451 } 1451 }
1452 1452
1453 privet_local_print_operation_->SetJobname( 1453 privet_local_print_operation_->SetJobname(base::UTF16ToUTF8(title));
1454 base::UTF16ToUTF8(title)); 1454 privet_local_print_operation_->SetPageSize(page_size);
1455
1456 const int dpi = printing::kDefaultPdfDpi;
1457 double scale = dpi;
1458 scale /= printing::kPointsPerInch;
1459 // Make vertical rectangle to optimize streaming to printer. Fix orientation
1460 // by autorotate.
1461 gfx::Rect area(std::min(page_size.width(), page_size.height()) * scale,
1462 std::max(page_size.width(), page_size.height()) * scale);
1463 privet_local_print_operation_->SetConversionSettings(
1464 printing::PdfRenderSettings(area, dpi, true));
1465
1466 privet_local_print_operation_->SetData(data); 1455 privet_local_print_operation_->SetData(data);
1467 1456
1468 Profile* profile = Profile::FromWebUI(web_ui()); 1457 Profile* profile = Profile::FromWebUI(web_ui());
1469 SigninManagerBase* signin_manager = 1458 SigninManagerBase* signin_manager =
1470 SigninManagerFactory::GetForProfileIfExists(profile); 1459 SigninManagerFactory::GetForProfileIfExists(profile);
1471 1460
1472 if (signin_manager) { 1461 if (signin_manager) {
1473 privet_local_print_operation_->SetUsername( 1462 privet_local_print_operation_->SetUsername(
1474 signin_manager->GetAuthenticatedUsername()); 1463 signin_manager->GetAuthenticatedUsername());
1475 } 1464 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 printer_value->SetString("serviceName", name); 1558 printer_value->SetString("serviceName", name);
1570 printer_value->SetString("name", description.name); 1559 printer_value->SetString("name", description.name);
1571 printer_value->SetBoolean("hasLocalPrinting", has_local_printing); 1560 printer_value->SetBoolean("hasLocalPrinting", has_local_printing);
1572 printer_value->SetBoolean( 1561 printer_value->SetBoolean(
1573 "isUnregistered", 1562 "isUnregistered",
1574 description.id.empty()); 1563 description.id.empty());
1575 printer_value->SetString("cloudID", description.id); 1564 printer_value->SetString("cloudID", description.id);
1576 } 1565 }
1577 1566
1578 #endif 1567 #endif
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698