pdf: Introduce content controller abstraction

Primary motivation is to enable the plugin to be swapped out for the
Ink-based PDF renderer in annotation mode.

* An abstract `ContentController` class is added. This abstracts the
  logic that pdf_viewer used to communicate with the plugin so that
  the Ink component can replace it. Most plugin logic has been moved
  to `PluginController`, this also required adding many new APIs to
  `PDFViewer` to allow messages from the plugin to behave as before
  without exposing too much of `PDFViewer` private details. There are
  still some uses of `plugin.postMessage` that can be converted to
  `ContentController` APIs in future.
* The PDF saving logic has been slightly rewritten using promises.
  Instead of storing only tokens, at save-request time a promise
  is created and associated with the token. When the save data
  becomes available (or is consumed) the promise is resolved.

Bug: 902646
Change-Id: Ic33b7c250eb54515564a3646283e3897419984af
Reviewed-on: https://chromium-review.googlesource.com/c/1368845
Commit-Queue: dstockwell <dstockwell@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615028}
1 file changed