OLD | NEW |
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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 std::unique_ptr<extensions::PrinterProviderPrintJob> job, | 73 std::unique_ptr<extensions::PrinterProviderPrintJob> job, |
74 const ExtensionPrinterHandler::PrintJobCallback& callback, | 74 const ExtensionPrinterHandler::PrintJobCallback& callback, |
75 bool success, | 75 bool success, |
76 const base::FilePath& pwg_file_path) { | 76 const base::FilePath& pwg_file_path) { |
77 if (!success) { | 77 if (!success) { |
78 callback.Run(std::move(job)); | 78 callback.Run(std::move(job)); |
79 return; | 79 return; |
80 } | 80 } |
81 | 81 |
82 base::PostTaskWithTraitsAndReplyWithResult( | 82 base::PostTaskWithTraitsAndReplyWithResult( |
83 FROM_HERE, base::TaskTraits() | 83 FROM_HERE, |
84 .WithShutdownBehavior( | 84 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
85 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
86 .MayBlock(), | |
87 base::Bind(&UpdateJobFileInfoOnWorkerThread, pwg_file_path, | 85 base::Bind(&UpdateJobFileInfoOnWorkerThread, pwg_file_path, |
88 base::Passed(&job)), | 86 base::Passed(&job)), |
89 callback); | 87 callback); |
90 } | 88 } |
91 | 89 |
92 bool HasUsbPrinterProviderPermissions(const Extension* extension) { | 90 bool HasUsbPrinterProviderPermissions(const Extension* extension) { |
93 return extension->permissions_data() && | 91 return extension->permissions_data() && |
94 extension->permissions_data()->HasAPIPermission( | 92 extension->permissions_data()->HasAPIPermission( |
95 extensions::APIPermission::kPrinterProvider) && | 93 extensions::APIPermission::kPrinterProvider) && |
96 extension->permissions_data()->HasAPIPermission( | 94 extension->permissions_data()->HasAPIPermission( |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 .Set("provisional", true) | 361 .Set("provisional", true) |
364 .Build()); | 362 .Build()); |
365 } | 363 } |
366 } | 364 } |
367 } | 365 } |
368 | 366 |
369 DCHECK_GT(pending_enumeration_count_, 0); | 367 DCHECK_GT(pending_enumeration_count_, 0); |
370 pending_enumeration_count_--; | 368 pending_enumeration_count_--; |
371 callback.Run(*printer_list.Build().get(), pending_enumeration_count_ == 0); | 369 callback.Run(*printer_list.Build().get(), pending_enumeration_count_ == 0); |
372 } | 370 } |
OLD | NEW |