• Daniel Hosseinian's avatar
    Change the PDF Viewer's PluginController to a singleton · 6c4067c6
    Daniel Hosseinian authored
    Currently, there is only one instance of a PluginController at a time,
    but references to it only live inside PDFViewerBaseElement and derived
    classes. Therefore, descendants of the <pdf-viewer> element fire an
    event handled by the PDFViewerElement. Making the controller a
    singleton allows other elements to directly access the controller using
    PluginController.getInstance().
    
    In making PluginController a singleton, the body of the constructor is
    moved to an init() method, because getInstance() creates a new object
    using the default constructor. Consumers of the PluginController would
    need to make sure the singleton has been initialized before using it.
    
    Eventually, InkController will also be altered to be a singleton,
    similarly to PluginController.
    
    Bug: 1134208
    Change-Id: I5f8a6b565e6fd565e67c41d841ab92fec43e46c4
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495504Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
    Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#820941}
    6c4067c6
pdf_viewer_base.js 19.9 KB