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

Unified Diff: extensions/browser/api/printer_provider/printer_provider_api.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/printer_provider/printer_provider_api.cc
diff --git a/extensions/browser/api/printer_provider/printer_provider_api.cc b/extensions/browser/api/printer_provider/printer_provider_api.cc
index 82e3f31e8483ddff46ca693694489dd306fe5ed3..ae916c5a08404ca3b75ecfbf9021916e93dd04b8 100644
--- a/extensions/browser/api/printer_provider/printer_provider_api.cc
+++ b/extensions/browser/api/printer_provider/printer_provider_api.cc
@@ -266,14 +266,13 @@ class PrinterProviderAPIImpl : public PrinterProviderAPI,
void OnGetCapabilityResult(const Extension* extension,
int request_id,
const base::DictionaryValue& result) override;
- void OnPrintResult(
- const Extension* extension,
- int request_id,
- core_api::printer_provider_internal::PrintError error) override;
+ void OnPrintResult(const Extension* extension,
+ int request_id,
+ api::printer_provider_internal::PrintError error) override;
void OnGetUsbPrinterInfoResult(
const Extension* extension,
int request_id,
- const core_api::printer_provider::PrinterInfo* printer_info) override;
+ const api::printer_provider::PrinterInfo* printer_info) override;
// ExtensionRegistryObserver implementation:
void OnExtensionUnloaded(content::BrowserContext* browser_context,
@@ -511,7 +510,7 @@ void PrinterProviderAPIImpl::DispatchGetPrintersRequested(
const GetPrintersCallback& callback) {
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router->HasEventListener(
- core_api::printer_provider::OnGetPrintersRequested::kEventName)) {
+ api::printer_provider::OnGetPrintersRequested::kEventName)) {
callback.Run(base::ListValue(), true /* done */);
return;
}
@@ -528,7 +527,7 @@ void PrinterProviderAPIImpl::DispatchGetPrintersRequested(
scoped_ptr<Event> event(
new Event(events::PRINTER_PROVIDER_ON_GET_PRINTERS_REQUESTED,
- core_api::printer_provider::OnGetPrintersRequested::kEventName,
+ api::printer_provider::OnGetPrintersRequested::kEventName,
internal_args.Pass()));
// This callback is called synchronously during |BroadcastEvent|, so
// Unretained is safe.
@@ -552,7 +551,7 @@ void PrinterProviderAPIImpl::DispatchGetCapabilityRequested(
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router->ExtensionHasEventListener(
extension_id,
- core_api::printer_provider::OnGetCapabilityRequested::kEventName)) {
+ api::printer_provider::OnGetCapabilityRequested::kEventName)) {
callback.Run(base::DictionaryValue());
return;
}
@@ -565,10 +564,10 @@ void PrinterProviderAPIImpl::DispatchGetCapabilityRequested(
internal_args->AppendInteger(request_id);
internal_args->AppendString(internal_printer_id);
- scoped_ptr<Event> event(new Event(
- events::PRINTER_PROVIDER_ON_GET_CAPABILITY_REQUESTED,
- core_api::printer_provider::OnGetCapabilityRequested::kEventName,
- internal_args.Pass()));
+ scoped_ptr<Event> event(
+ new Event(events::PRINTER_PROVIDER_ON_GET_CAPABILITY_REQUESTED,
+ api::printer_provider::OnGetCapabilityRequested::kEventName,
+ internal_args.Pass()));
event_router->DispatchEventToExtension(extension_id, event.Pass());
}
@@ -585,23 +584,21 @@ void PrinterProviderAPIImpl::DispatchPrintRequested(
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router->ExtensionHasEventListener(
- extension_id,
- core_api::printer_provider::OnPrintRequested::kEventName)) {
+ extension_id, api::printer_provider::OnPrintRequested::kEventName)) {
callback.Run(false, PrinterProviderAPI::GetDefaultPrintError());
return;
}
- core_api::printer_provider::PrintJob print_job;
+ api::printer_provider::PrintJob print_job;
print_job.printer_id = internal_printer_id;
JSONStringValueDeserializer deserializer(job.ticket_json);
scoped_ptr<base::Value> ticket_value(deserializer.Deserialize(NULL, NULL));
if (!ticket_value ||
- !core_api::printer_provider::PrintJob::Ticket::Populate(
- *ticket_value, &print_job.ticket)) {
- callback.Run(false,
- core_api::printer_provider::ToString(
- core_api::printer_provider::PRINT_ERROR_INVALID_TICKET));
+ !api::printer_provider::PrintJob::Ticket::Populate(*ticket_value,
+ &print_job.ticket)) {
+ callback.Run(false, api::printer_provider::ToString(
+ api::printer_provider::PRINT_ERROR_INVALID_TICKET));
return;
}
@@ -616,7 +613,7 @@ void PrinterProviderAPIImpl::DispatchPrintRequested(
internal_args->Append(print_job.ToValue().release());
scoped_ptr<Event> event(
new Event(events::PRINTER_PROVIDER_ON_PRINT_REQUESTED,
- core_api::printer_provider::OnPrintRequested::kEventName,
+ api::printer_provider::OnPrintRequested::kEventName,
internal_args.Pass()));
event_router->DispatchEventToExtension(extension_id, event.Pass());
}
@@ -636,15 +633,15 @@ void PrinterProviderAPIImpl::DispatchGetUsbPrinterInfoRequested(
const PrinterProviderAPI::GetPrinterInfoCallback& callback) {
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router->ExtensionHasEventListener(
- extension_id, core_api::printer_provider::
- OnGetUsbPrinterInfoRequested::kEventName)) {
+ extension_id,
+ api::printer_provider::OnGetUsbPrinterInfoRequested::kEventName)) {
callback.Run(base::DictionaryValue());
return;
}
int request_id =
pending_usb_printer_info_requests_[extension_id].Add(callback);
- core_api::usb::Device usb_device;
+ api::usb::Device usb_device;
usb_device.device =
UsbGuidMap::Get(browser_context_)->GetIdFromGuid(device->guid());
usb_device.vendor_id = device->vendor_id();
@@ -655,10 +652,10 @@ void PrinterProviderAPIImpl::DispatchGetUsbPrinterInfoRequested(
// custom bindings.
internal_args->AppendInteger(request_id);
internal_args->Append(usb_device.ToValue().release());
- scoped_ptr<Event> event(new Event(
- events::PRINTER_PROVIDER_ON_GET_USB_PRINTER_INFO_REQUESTED,
- core_api::printer_provider::OnGetUsbPrinterInfoRequested::kEventName,
- internal_args.Pass()));
+ scoped_ptr<Event> event(
+ new Event(events::PRINTER_PROVIDER_ON_GET_USB_PRINTER_INFO_REQUESTED,
+ api::printer_provider::OnGetUsbPrinterInfoRequested::kEventName,
+ internal_args.Pass()));
event_router->DispatchEventToExtension(extension_id, event.Pass());
}
@@ -690,20 +687,20 @@ void PrinterProviderAPIImpl::OnGetCapabilityResult(
void PrinterProviderAPIImpl::OnPrintResult(
const Extension* extension,
int request_id,
- core_api::printer_provider_internal::PrintError error) {
+ api::printer_provider_internal::PrintError error) {
const std::string error_str =
- error == core_api::printer_provider_internal::PRINT_ERROR_NONE
+ error == api::printer_provider_internal::PRINT_ERROR_NONE
? PrinterProviderAPI::GetDefaultPrintError()
- : core_api::printer_provider_internal::ToString(error);
+ : api::printer_provider_internal::ToString(error);
pending_print_requests_[extension->id()].Complete(
- request_id, error == core_api::printer_provider_internal::PRINT_ERROR_OK,
+ request_id, error == api::printer_provider_internal::PRINT_ERROR_OK,
error_str);
}
void PrinterProviderAPIImpl::OnGetUsbPrinterInfoResult(
const Extension* extension,
int request_id,
- const core_api::printer_provider::PrinterInfo* result) {
+ const api::printer_provider::PrinterInfo* result) {
if (result) {
scoped_ptr<base::DictionaryValue> printer(result->ToValue());
UpdatePrinterWithExtensionInfo(printer.get(), extension);
@@ -750,7 +747,7 @@ bool PrinterProviderAPIImpl::WillRequestPrinters(
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router->ExtensionHasEventListener(
extension->id(),
- core_api::printer_provider::OnGetPrintersRequested::kEventName)) {
+ api::printer_provider::OnGetPrintersRequested::kEventName)) {
return false;
}
@@ -767,8 +764,8 @@ PrinterProviderAPI* PrinterProviderAPI::Create(
// static
std::string PrinterProviderAPI::GetDefaultPrintError() {
- return core_api::printer_provider_internal::ToString(
- core_api::printer_provider_internal::PRINT_ERROR_FAILED);
+ return api::printer_provider_internal::ToString(
+ api::printer_provider_internal::PRINT_ERROR_FAILED);
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698