Hook up chrome.printerProvider.onGetPrintersRequested
commitf5901de7849d8787c42ee9f1da559dfaab8e838a
authortbarzic <tbarzic@chromium.org>
Fri, 23 Jan 2015 00:16:06 +0000 (22 16:16 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 23 Jan 2015 00:17:35 +0000 (23 00:17 +0000)
treea0bd372fae77f9cea79843efbbc5f2d42b9c52b4
parent210ff34516a975b9f4addd5be54d34290d7a6475
Hook up chrome.printerProvider.onGetPrintersRequested

Introduces PrinterProviderAPI::DispatchGetPritersRequested.
The method dispatches printerProvider.onGetPrintersRequested and
creates new request context for the event.
The context contains the event callback and list of extensions that are
yet expected to reply to the event. It's identified by requestId. The
request id is passed to the event and to
printerProviderInternal.reportPrinters which gets called when the
extension responds to the event.
PrinterProviderAPI observes PrinterProviderInternalAPI for function
calls, and runs DispatchGetPrintersRequested callback whenever
reportPrinters is called (i.e. the callback is run once for each
extension that responds to the event).
Once all the extensions that listen to the event respond, the request
context gets removed.

BUG=408772

Review URL: https://codereview.chromium.org/868553002

Cr-Commit-Position: refs/heads/master@{#312705}
extensions/browser/api/printer_provider/printer_provider_api.cc
extensions/browser/api/printer_provider/printer_provider_api.h
extensions/browser/api/printer_provider/printer_provider_apitest.cc
extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc
extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h
extensions/browser/api/printer_provider_internal/printer_provider_internal_api_observer.h
extensions/test/data/api_test/printer_provider/OWNERS [new file with mode: 0644]
extensions/test/data/api_test/printer_provider/request_printers/manifest.json [new file with mode: 0644]
extensions/test/data/api_test/printer_provider/request_printers/test.js [new file with mode: 0644]
extensions/test/data/api_test/printer_provider/request_printers_second/manifest.json [new file with mode: 0644]
extensions/test/data/api_test/printer_provider/request_printers_second/test.js [new file with mode: 0644]