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

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

Issue 1006583003: Add title property to chrome.printerProvider pritn job (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extension_printer_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/extension_printer_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ->GetForBrowserContext(browser_context_) 101 ->GetForBrowserContext(browser_context_)
102 ->DispatchGetCapabilityRequested( 102 ->DispatchGetCapabilityRequested(
103 destination_id, 103 destination_id,
104 base::Bind(&ExtensionPrinterHandler::WrapGetCapabilityCallback, 104 base::Bind(&ExtensionPrinterHandler::WrapGetCapabilityCallback,
105 weak_ptr_factory_.GetWeakPtr(), callback, destination_id)); 105 weak_ptr_factory_.GetWeakPtr(), callback, destination_id));
106 } 106 }
107 107
108 void ExtensionPrinterHandler::StartPrint( 108 void ExtensionPrinterHandler::StartPrint(
109 const std::string& destination_id, 109 const std::string& destination_id,
110 const std::string& capability, 110 const std::string& capability,
111 const base::string16& job_title,
111 const std::string& ticket_json, 112 const std::string& ticket_json,
112 const gfx::Size& page_size, 113 const gfx::Size& page_size,
113 const scoped_refptr<base::RefCountedMemory>& print_data, 114 const scoped_refptr<base::RefCountedMemory>& print_data,
114 const PrinterHandler::PrintCallback& callback) { 115 const PrinterHandler::PrintCallback& callback) {
115 scoped_ptr<extensions::PrinterProviderPrintJob> print_job( 116 scoped_ptr<extensions::PrinterProviderPrintJob> print_job(
116 new extensions::PrinterProviderPrintJob()); 117 new extensions::PrinterProviderPrintJob());
117 print_job->printer_id = destination_id; 118 print_job->printer_id = destination_id;
119 print_job->job_title = job_title;
118 print_job->ticket_json = ticket_json; 120 print_job->ticket_json = ticket_json;
119 121
120 cloud_devices::CloudDeviceDescription printer_description; 122 cloud_devices::CloudDeviceDescription printer_description;
121 printer_description.InitFromString(capability); 123 printer_description.InitFromString(capability);
122 124
123 cloud_devices::printer::ContentTypesCapability content_types; 125 cloud_devices::printer::ContentTypesCapability content_types;
124 content_types.LoadFrom(printer_description); 126 content_types.LoadFrom(printer_description);
125 127
126 const bool kUsePdf = content_types.Contains(kContentTypePdf) || 128 const bool kUsePdf = content_types.Contains(kContentTypePdf) ||
127 content_types.Contains(kContentTypeAll); 129 content_types.Contains(kContentTypeAll);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const base::DictionaryValue& capability) { 201 const base::DictionaryValue& capability) {
200 callback.Run(destination_id, capability); 202 callback.Run(destination_id, capability);
201 } 203 }
202 204
203 void ExtensionPrinterHandler::WrapPrintCallback( 205 void ExtensionPrinterHandler::WrapPrintCallback(
204 const PrinterHandler::PrintCallback& callback, 206 const PrinterHandler::PrintCallback& callback,
205 bool success, 207 bool success,
206 const std::string& status) { 208 const std::string& status) {
207 callback.Run(success, status); 209 callback.Run(success, status);
208 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698