summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/tab_strip/tab_strip_embedder_proxy.js
blob: 6852de8b29f0f0499b888933f1aa7e828d7764ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {addSingletonGetter, addWebUIListener, sendWithPromise} from 'chrome://resources/js/cr.m.js';

export class TabStripEmbedderProxy {
  /** @return {boolean} */
  isVisible() {
    return document.visibilityState === 'visible';
  }

  /**
   * @return {!Promise<!Object<string, string>>} Object with CSS variables
   *     as keys and rgba strings as values
   */
  getColors() {
    return sendWithPromise('getThemeColors');
  }

  observeThemeChanges() {
    chrome.send('observeThemeChanges');
  }

  /**
   * @param {number} tabId
   * @param {number} locationX
   * @param {number} locationY
   */
  showTabContextMenu(tabId, locationX, locationY) {
    chrome.send('showTabContextMenu', [tabId, locationX, locationY]);
  }

  closeContainer() {
    chrome.send('closeContainer');
  }
}

addSingletonGetter(TabStripEmbedderProxy);