Skip to content

feat(desktop): Chrome Web Store拡張機能インストール + ツールバーUI#20

Merged
MocA-Love merged 7 commits intomainfrom
feat/chrome-extension-install
Mar 29, 2026
Merged

feat(desktop): Chrome Web Store拡張機能インストール + ツールバーUI#20
MocA-Love merged 7 commits intomainfrom
feat/chrome-extension-install

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

Summary

  • Chrome Web Store のURLまたは拡張IDを入力して、ブラウザ拡張機能をElectronデスクトップアプリにインストールできる機能を追加
  • BrowserPaneのツールバーに拡張機能アイコンを表示し、クリックでポップアップウィンドウを表示
  • GPLライブラリに依存せず、Electron標準APIのみで自前実装

Changes

Chrome Web Store インストール基盤

  • crx-downloader.ts - CRXダウンロード、CRX2/CRX3ヘッダー除去、JSZipで展開
  • compatibility-checker.ts - manifest解析 + JSコードスキャンによるElectron互換性判定
  • extension-manager.ts - インストール/アンインストール/有効無効切替/永続化 + Electron割当ID管理
  • settings/extensions/ - Extensions設定ページ(インストールフォーム + 拡張一覧)

ツールバーUI(アイコン + ポップアップ)

  • extension-popup-manager.ts - フレームレスBrowserWindowでpopup.htmlを表示
    • chrome-extension:// URLでロード(同一session partitionでchrome.runtime.sendMessage自動対応)
    • enablePreferredSizeMode による自動サイズ調整
    • blurイベントで自動クローズ、同時1つのみ排他制御
    • アイコン直下に配置、画面端クランプ対応
    • ダークモード対応(nativeTheme連動背景色)
  • extension-icon-protocol.ts - superset-ext-icon:// プロトコルでアイコン画像配信
  • ExtensionToolbar / ExtensionIcon - BrowserPaneツールバーにアイコン表示
  • tRPC: listToolbarExtensions / openPopup / closePopup エンドポイント

既存ファイルへの変更(最小限)

  • routers/index.ts - extensionsルーターにgetWindow渡し(1行変更)
  • main/index.ts - プロトコル登録 + loadInstalledExtensions(+17行)
  • BrowserPane.tsx - ExtensionToolbar配置(+2行)
  • サイドバー/ルーティング/検索にExtensionsセクション追加

Design decisions

  • コンフリクトリスク最小化: 主要ロジックは全て新規ファイル。既存ファイルへの変更は最小限
  • GPLフリー: electron-chrome-extensions を使わず、Electron標準APIのみで実装
  • Electron割当ID管理: CRX展開時にmanifestのkeyフィールドが失われるため、loadExtension() の戻り値からElectron IDを取得・永続化して chrome-extension:// URLに使用
  • 互換性チェック: インストール前にmanifest + JSコードをスキャンし、互換性レベル(full/partial/low)を表示

Known limitations

  • Electronが対応していないchrome.* API(cookies, tabs.create, webNavigation等)を使う拡張は動作しない
  • content scripts系、DevTools拡張、シンプルなpopup拡張が対象

Test plan

  • 設定画面でExtensionsページが表示される
  • Chrome Web Store URLでインストールが動作する
  • 互換性レポートが正しく表示される
  • BrowserPaneツールバーにアイコンが表示される
  • アイコンクリックでポップアップが開く
  • アプリ再起動後にインストール済み拡張が自動ロードされる
  • 拡張の有効/無効切替
  • アンインストール
  • content scripts系の拡張が正常に動作する

- ExtensionPopupManager: フレームレスBrowserWindowでpopup.htmlを表示
  - chrome-extension:// URLでロード、同一session partitionで通信自動対応
  - enablePreferredSizeModeによる自動サイズ調整
  - blurイベントで自動クローズ、同時1つのみ排他制御
  - アイコン直下に配置、画面端クランプ対応
- extension-icon-protocol: superset-ext-icon:// プロトコルでアイコン画像配信
- ExtensionToolbar/ExtensionIcon: BrowserPaneツールバーに拡張アイコン表示
- tRPC: listToolbarExtensions/openPopup/closePopup エンドポイント追加
- 互換性チェッカーからpopup "unsupported" 警告を削除
- sandbox: true が chrome-extension:// プロトコルをブロックしていた問題を修正
- chrome-extension:// ロード失敗時に file:// からの直接ロードにフォールバック
- 未使用変数を削除
ダークモード時に白文字が白背景で見えなくなる問題を修正。
nativeTheme.shouldUseDarkColors に合わせて背景色を設定。
CRX展開時にmanifestのkeyフィールドが失われるため、Electronが
Chrome Web Store IDとは異なるIDを割り当てる。loadExtension()の
戻り値からelectronIdを取得・永続化し、popup URLに使用するよう修正。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 18 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 18 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7348f625-d5ce-4647-8fc3-d099b1c87802

📥 Commits

Reviewing files that changed from the base of the PR and between a05a180 and b949fa4.

📒 Files selected for processing (15)
  • README.md
  • apps/desktop/src/lib/trpc/routers/extensions/index.ts
  • apps/desktop/src/lib/trpc/routers/index.ts
  • apps/desktop/src/main/index.ts
  • apps/desktop/src/main/lib/extensions/compatibility-checker.ts
  • apps/desktop/src/main/lib/extensions/extension-icon-protocol.ts
  • apps/desktop/src/main/lib/extensions/extension-manager.ts
  • apps/desktop/src/main/lib/extensions/extension-popup-manager.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/extensions/components/ExtensionsSettings/ExtensionsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/BrowserPane.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/components/ExtensionToolbar/ExtensionToolbar.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/components/ExtensionToolbar/components/ExtensionIcon/ExtensionIcon.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/components/ExtensionToolbar/components/ExtensionIcon/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/components/ExtensionToolbar/components/ExtensionIcon/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/components/ExtensionToolbar/index.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/chrome-extension-install

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MocA-Love MocA-Love merged commit 4f0227f into main Mar 29, 2026
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant