blob: 1cba8c020b660bb8f7684749671715dfa4ca7f93 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2012 The Chromium Authors
[email protected]c82da8c42012-06-08 19:49:112// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
EmiliaPazbee48672024-08-26 22:00:275#ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_H_
6#define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_H_
[email protected]c82da8c42012-06-08 19:49:117
EmiliaPaz723b8ad82024-08-26 19:08:578#include "base/auto_reset.h"
Keishi Hattori0e45c022021-11-27 09:25:529#include "base/memory/raw_ptr.h"
EmiliaPaz723b8ad82024-08-26 19:08:5710#include "base/memory/scoped_refptr.h"
pkotwicza57a1f322014-10-21 00:24:3011
12namespace content {
13class BrowserContext;
14}
[email protected]c82da8c42012-06-08 19:49:1115
EmiliaPaz723b8ad82024-08-26 19:08:5716namespace extensions {
17class CrxInstallError;
18class Extension;
19} // namespace extensions
20
Elly Fong-Jones7c3ab032020-03-12 23:02:1921class Browser;
[email protected]32fc4ff72012-06-15 21:50:0122class Profile;
EmiliaPaz723b8ad82024-08-26 19:08:5723class SkBitmap;
[email protected]591a59f2012-10-11 01:16:2324
EmiliaPazbee48672024-08-26 22:00:2725class ExtensionInstallUI {
[email protected]c82da8c42012-06-08 19:49:1126 public:
EmiliaPazbee48672024-08-26 22:00:2727 explicit ExtensionInstallUI(content::BrowserContext* context);
Peter Boström53c6c5952021-09-17 09:41:2628
EmiliaPazbee48672024-08-26 22:00:2729 ExtensionInstallUI(const ExtensionInstallUI&) = delete;
30 ExtensionInstallUI& operator=(const ExtensionInstallUI&) = delete;
Peter Boström53c6c5952021-09-17 09:41:2631
EmiliaPazbee48672024-08-26 22:00:2732 ~ExtensionInstallUI();
[email protected]c82da8c42012-06-08 19:49:1133
EmiliaPaz723b8ad82024-08-26 19:08:5734 // Called when an extension was installed.
Dana Friedc3c30222018-12-11 23:34:5635 void OnInstallSuccess(scoped_refptr<const extensions::Extension> extension,
EmiliaPaz723b8ad82024-08-26 19:08:5736 const SkBitmap* icon);
37
38 // Called when an extension failed to install.
39 void OnInstallFailure(const extensions::CrxInstallError& error);
40
41 // TODO(asargent) Normally we navigate to the new tab page when an app is
42 // installed, but we're experimenting with instead showing a bubble when
43 // an app is installed which points to the new tab button. This may become
44 // the default behavior in the future.
45 void SetUseAppInstalledBubble(bool use_bubble);
46
47 // Sets whether to show the default UI after completing the installation.
48 void SetSkipPostInstallUI(bool skip_ui);
[email protected]c82da8c42012-06-08 19:49:1149
EmiliaPazd28b77cfd2024-08-26 23:26:4450 // Show the install bubble UI.
51 static void ShowBubble(scoped_refptr<const extensions::Extension> extension,
52 Browser* browser,
53 const SkBitmap& icon);
Elly Fong-Jones7c3ab032020-03-12 23:02:1954
EmiliaPaz723b8ad82024-08-26 19:08:5755 // For testing:
56 static base::AutoReset<bool> disable_ui_for_tests(bool disable);
57
[email protected]c82da8c42012-06-08 19:49:1158 private:
Arthur Sonzognie98d2142023-06-01 15:02:2559 raw_ptr<Profile, DanglingUntriaged> profile_;
pkotwicza57a1f322014-10-21 00:24:3060
61 // Whether or not to show the default UI after completing the installation.
62 bool skip_post_install_ui_;
63
[email protected]c82da8c42012-06-08 19:49:1164 // Whether to show an installed bubble on app install, or use the default
65 // action of opening a new tab page.
66 bool use_app_installed_bubble_;
[email protected]c82da8c42012-06-08 19:49:1167};
68
EmiliaPazbee48672024-08-26 22:00:2769#endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_H_