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

Side by Side Diff: chrome/browser/printing/print_job_worker.cc

Issue 1656933004: Printing: Remove backslashes from print job names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | 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/printing/print_job_worker.h" 5 #include "chrome/browser/printing/print_job_worker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h"
14 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
15 #include "base/values.h" 17 #include "base/values.h"
16 #include "build/build_config.h" 18 #include "build/build_config.h"
17 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chrome_notification_types.h" 20 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/printing/print_job.h" 21 #include "chrome/browser/printing/print_job.h"
20 #include "chrome/common/features.h" 22 #include "chrome/common/features.h"
21 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
22 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 DCHECK_EQ(page_number_, PageNumber::npos()); 252 DCHECK_EQ(page_number_, PageNumber::npos());
251 DCHECK_EQ(document_.get(), new_document); 253 DCHECK_EQ(document_.get(), new_document);
252 DCHECK(document_.get()); 254 DCHECK(document_.get());
253 255
254 if (!document_.get() || page_number_ != PageNumber::npos() || 256 if (!document_.get() || page_number_ != PageNumber::npos() ||
255 document_.get() != new_document) { 257 document_.get() != new_document) {
256 return; 258 return;
257 } 259 }
258 260
259 base::string16 document_name = 261 base::string16 document_name =
260 printing::SimplifyDocumentTitle(document_->name()); 262 printing::SimplifyDocumentTitle(document_->name());
Vitaly Buka (NO REVIEWS) 2016/02/02 04:50:37 Maybe in SimplifyDocumentTitle? That was added for
261 if (document_name.empty()) { 263 if (document_name.empty()) {
262 document_name = printing::SimplifyDocumentTitle( 264 document_name = printing::SimplifyDocumentTitle(
263 l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE)); 265 l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE));
264 } 266 }
267 base::ReplaceChars(document_name, base::ASCIIToUTF16("\\"),
268 base::ASCIIToUTF16("_"), &document_name);
265 PrintingContext::Result result = 269 PrintingContext::Result result =
266 printing_context_->NewDocument(document_name); 270 printing_context_->NewDocument(document_name);
267 if (result != PrintingContext::OK) { 271 if (result != PrintingContext::OK) {
268 OnFailure(); 272 OnFailure();
269 return; 273 return;
270 } 274 }
271 275
272 // Try to print already cached data. It may already have been generated for 276 // Try to print already cached data. It may already have been generated for
273 // the print preview. 277 // the print preview.
274 OnNewPage(); 278 OnNewPage();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 document_, 441 document_,
438 scoped_refptr<PrintedPage>())); 442 scoped_refptr<PrintedPage>()));
439 Cancel(); 443 Cancel();
440 444
441 // Makes sure the variables are reinitialized. 445 // Makes sure the variables are reinitialized.
442 document_ = NULL; 446 document_ = NULL;
443 page_number_ = PageNumber::npos(); 447 page_number_ = PageNumber::npos();
444 } 448 }
445 449
446 } // namespace printing 450 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698