| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | /* global chrome */ |
| 10 | |
| 11 | 'use strict'; |
| 12 | import type {ReactBuildType} from 'react-devtools-shared/src/backend/types'; |
| 13 | |
| 14 | function setExtensionIconAndPopup( |
| 15 | reactBuildType: ReactBuildType, |
| 16 | tabId: number, |
| 17 | ) { |
| 18 | chrome.action.setIcon({ |
| 19 | tabId, |
| 20 | path: { |
| 21 | '16': chrome.runtime.getURL(`icons/16-${reactBuildType}.png`), |
| 22 | '32': chrome.runtime.getURL(`icons/32-${reactBuildType}.png`), |
| 23 | '48': chrome.runtime.getURL(`icons/48-${reactBuildType}.png`), |
| 24 | '128': chrome.runtime.getURL(`icons/128-${reactBuildType}.png`), |
| 25 | }, |
| 26 | }); |
| 27 | |
| 28 | chrome.action.setPopup({ |
| 29 | tabId, |
| 30 | popup: chrome.runtime.getURL(`popups/${reactBuildType}.html`), |
| 31 | }); |
| 32 | } |
| 33 | |
| 34 | export default setExtensionIconAndPopup; |