| 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 "extensions/browser/api/printer_provider_internal/printer_provider_inte
rnal_api.h" | 5 #include "extensions/browser/api/printer_provider_internal/printer_provider_inte
rnal_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 void PrinterProviderInternalAPI::NotifyPrintResult( | 81 void PrinterProviderInternalAPI::NotifyPrintResult( |
| 82 const Extension* extension, | 82 const Extension* extension, |
| 83 int request_id, | 83 int request_id, |
| 84 core_api::printer_provider_internal::PrintError error) { | 84 core_api::printer_provider_internal::PrintError error) { |
| 85 FOR_EACH_OBSERVER(PrinterProviderInternalAPIObserver, observers_, | 85 FOR_EACH_OBSERVER(PrinterProviderInternalAPIObserver, observers_, |
| 86 OnPrintResult(extension, request_id, error)); | 86 OnPrintResult(extension, request_id, error)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void PrinterProviderInternalAPI::NotifyGetUsbPrinterInfoResult( |
| 90 const Extension* extension, |
| 91 int request_id, |
| 92 const core_api::printer_provider::PrinterInfo* printer_info) { |
| 93 FOR_EACH_OBSERVER( |
| 94 PrinterProviderInternalAPIObserver, observers_, |
| 95 OnGetUsbPrinterInfoResult(extension, request_id, printer_info)); |
| 96 } |
| 97 |
| 89 PrinterProviderInternalReportPrintResultFunction:: | 98 PrinterProviderInternalReportPrintResultFunction:: |
| 90 PrinterProviderInternalReportPrintResultFunction() { | 99 PrinterProviderInternalReportPrintResultFunction() { |
| 91 } | 100 } |
| 92 | 101 |
| 93 PrinterProviderInternalReportPrintResultFunction:: | 102 PrinterProviderInternalReportPrintResultFunction:: |
| 94 ~PrinterProviderInternalReportPrintResultFunction() { | 103 ~PrinterProviderInternalReportPrintResultFunction() { |
| 95 } | 104 } |
| 96 | 105 |
| 97 ExtensionFunction::ResponseAction | 106 ExtensionFunction::ResponseAction |
| 98 PrinterProviderInternalReportPrintResultFunction::Run() { | 107 PrinterProviderInternalReportPrintResultFunction::Run() { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 extensions::BlobHolder* holder = | 240 extensions::BlobHolder* holder = |
| 232 extensions::BlobHolder::FromRenderProcessHost( | 241 extensions::BlobHolder::FromRenderProcessHost( |
| 233 contents->GetRenderProcessHost()); | 242 contents->GetRenderProcessHost()); |
| 234 holder->HoldBlobReference(blob.Pass()); | 243 holder->HoldBlobReference(blob.Pass()); |
| 235 | 244 |
| 236 results_ = internal_api::GetPrintData::Results::Create(info); | 245 results_ = internal_api::GetPrintData::Results::Create(info); |
| 237 SetTransferredBlobUUIDs(uuids); | 246 SetTransferredBlobUUIDs(uuids); |
| 238 SendResponse(true); | 247 SendResponse(true); |
| 239 } | 248 } |
| 240 | 249 |
| 250 PrinterProviderInternalReportUsbPrinterInfoFunction:: |
| 251 PrinterProviderInternalReportUsbPrinterInfoFunction() { |
| 252 } |
| 253 |
| 254 PrinterProviderInternalReportUsbPrinterInfoFunction:: |
| 255 ~PrinterProviderInternalReportUsbPrinterInfoFunction() { |
| 256 } |
| 257 |
| 258 ExtensionFunction::ResponseAction |
| 259 PrinterProviderInternalReportUsbPrinterInfoFunction::Run() { |
| 260 scoped_ptr<internal_api::ReportUsbPrinterInfo::Params> params( |
| 261 internal_api::ReportUsbPrinterInfo::Params::Create(*args_)); |
| 262 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 263 |
| 264 PrinterProviderInternalAPI::GetFactoryInstance() |
| 265 ->Get(browser_context()) |
| 266 ->NotifyGetUsbPrinterInfoResult(extension(), params->request_id, |
| 267 params->printer_info.get()); |
| 268 return RespondNow(NoArguments()); |
| 269 } |
| 270 |
| 241 } // namespace extensions | 271 } // namespace extensions |
| OLD | NEW |