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

Side by Side Diff: headless/lib/browser/headless_print_manager.cc

Issue 2762593002: Add --headless flag to Windows (Closed)
Patch Set: added TODO Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "headless/lib/browser/headless_print_manager.h" 5 #include "headless/lib/browser/headless_print_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (range.to > pages_count) 110 if (range.to > pages_count)
111 return LIMIT_ERROR; 111 return LIMIT_ERROR;
112 112
113 // Page numbers are 1-based in the dictionary. 113 // Page numbers are 1-based in the dictionary.
114 // Page numbers are 0-based for the print settings. 114 // Page numbers are 0-based for the print settings.
115 range.from--; 115 range.from--;
116 range.to--; 116 range.to--;
117 page_ranges.push_back(range); 117 page_ranges.push_back(range);
118 } 118 }
119 *pages = PageRange::GetPages(page_ranges); 119 *pages = PageRange::GetPages(page_ranges);
120 return NO_ERROR; 120 return PRINT_NO_ERROR;
121 } 121 }
122 122
123 void HeadlessPrintManager::GetPDFContents(content::RenderFrameHost* rfh, 123 void HeadlessPrintManager::GetPDFContents(content::RenderFrameHost* rfh,
124 const HeadlessPrintSettings& settings, 124 const HeadlessPrintSettings& settings,
125 const GetPDFCallback& callback) { 125 const GetPDFCallback& callback) {
126 DCHECK(callback); 126 DCHECK(callback);
127 127
128 if (callback_) { 128 if (callback_) {
129 callback.Run(SIMULTANEOUS_PRINT_ACTIVE, std::string()); 129 callback.Run(SIMULTANEOUS_PRINT_ACTIVE, std::string());
130 return; 130 return;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 page_ranges_text_, params.expected_pages_count, &print_params_->pages); 199 page_ranges_text_, params.expected_pages_count, &print_params_->pages);
200 switch (status) { 200 switch (status) {
201 case SYNTAX_ERROR: 201 case SYNTAX_ERROR:
202 printing_rfh_->Send(reply_msg); 202 printing_rfh_->Send(reply_msg);
203 ReleaseJob(PAGE_RANGE_SYNTAX_ERROR); 203 ReleaseJob(PAGE_RANGE_SYNTAX_ERROR);
204 return; 204 return;
205 case LIMIT_ERROR: 205 case LIMIT_ERROR:
206 printing_rfh_->Send(reply_msg); 206 printing_rfh_->Send(reply_msg);
207 ReleaseJob(PAGE_COUNT_EXCEEDED); 207 ReleaseJob(PAGE_COUNT_EXCEEDED);
208 return; 208 return;
209 case NO_ERROR: 209 case PRINT_NO_ERROR:
210 PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, *print_params_); 210 PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, *print_params_);
211 printing_rfh_->Send(reply_msg); 211 printing_rfh_->Send(reply_msg);
212 return; 212 return;
213 default: 213 default:
214 NOTREACHED(); 214 NOTREACHED();
215 return; 215 return;
216 } 216 }
217 } 217 }
218 218
219 void HeadlessPrintManager::OnShowInvalidPrinterSettingsError() { 219 void HeadlessPrintManager::OnShowInvalidPrinterSettingsError() {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (result == PRINT_SUCCESS) 296 if (result == PRINT_SUCCESS)
297 callback_.Run(result, std::move(data_)); 297 callback_.Run(result, std::move(data_));
298 else 298 else
299 callback_.Run(result, std::string()); 299 callback_.Run(result, std::string());
300 printing_rfh_->Send(new PrintMsg_PrintingDone(printing_rfh_->GetRoutingID(), 300 printing_rfh_->Send(new PrintMsg_PrintingDone(printing_rfh_->GetRoutingID(),
301 result == PRINT_SUCCESS)); 301 result == PRINT_SUCCESS));
302 Reset(); 302 Reset();
303 } 303 }
304 304
305 } // namespace printing 305 } // namespace printing
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_print_manager.h ('k') | headless/lib/browser/headless_printing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698