* @param {!./ampdoc-impl.AmpDoc} ampdoc
(ampdoc)
| 78 | * @param {!./ampdoc-impl.AmpDoc} ampdoc |
| 79 | */ |
| 80 | constructor(ampdoc) { |
| 81 | /** @const {!./ampdoc-impl.AmpDoc} */ |
| 82 | this.ampdoc = ampdoc; |
| 83 | |
| 84 | /** @private @const {!Document|!ShadowRoot} */ |
| 85 | this.rootNode_ = ampdoc.getRootNode(); |
| 86 | |
| 87 | /** @private @const {!./viewport/viewport-interface.ViewportInterface} */ |
| 88 | this.viewport_ = Services.viewportForDoc(this.ampdoc); |
| 89 | |
| 90 | /** @private @const {!./viewer-interface.ViewerInterface} */ |
| 91 | this.viewer_ = Services.viewerForDoc(this.ampdoc); |
| 92 | |
| 93 | /** @private @const {!./history-impl.History} */ |
| 94 | this.history_ = Services.historyForDoc(this.ampdoc); |
| 95 | |
| 96 | /** @private @const {!./platform-impl.Platform} */ |
| 97 | this.platform_ = Services.platformFor(this.ampdoc.win); |
| 98 | |
| 99 | /** @private @const {boolean} */ |
| 100 | this.isIosSafari_ = this.platform_.isIos() && this.platform_.isSafari(); |
| 101 | |
| 102 | /** @private @const {boolean} */ |
| 103 | this.isIframed_ = |
| 104 | isIframed(this.ampdoc.win) && this.viewer_.isOvertakeHistory(); |
| 105 | |
| 106 | /** @private @const {boolean} */ |
| 107 | this.isEmbed_ = |
| 108 | this.rootNode_ != this.ampdoc.getRootNode() || !!this.ampdoc.getParent(); |
| 109 | |
| 110 | /** @private @const {boolean} */ |
| 111 | this.isInABox_ = getMode(this.ampdoc.win).runtime == 'inabox'; |
| 112 | |
| 113 | /** |
| 114 | * Must use URL parsing scoped to `rootNode_` for correct FIE behavior. |
| 115 | * @private @const {!Element|!ShadowRoot} |
| 116 | */ |
| 117 | this.serviceContext_ = /** @type {!Element|!ShadowRoot} */ ( |
| 118 | this.rootNode_.nodeType == Node.DOCUMENT_NODE |
| 119 | ? this.rootNode_.documentElement |
| 120 | : this.rootNode_ |
| 121 | ); |
| 122 | |
| 123 | /** @private @const {!function(!Event)|undefined} */ |
| 124 | this.boundHandle_ = this.handle_.bind(this); |
| 125 | this.rootNode_.addEventListener(EVENT_TYPE_CLICK, this.boundHandle_); |
| 126 | this.rootNode_.addEventListener(EVENT_TYPE_CONTEXT_MENU, this.boundHandle_); |
| 127 | /** @private {boolean} */ |
| 128 | this.appendExtraParams_ = false; |
| 129 | shouldAppendExtraParams(this.ampdoc).then((res) => { |
| 130 | this.appendExtraParams_ = res; |
| 131 | }); |
| 132 | |
| 133 | /** @private {boolean} */ |
| 134 | this.isTrustedViewer_ = false; |
| 135 | /** @private {boolean} */ |
| 136 | this.isLocalViewer_ = false; |
| 137 | Promise.all([ |
nothing calls this directly
no test coverage detected