blob: 2dc3939a2a2ec32893762025300312abbd1a4976 [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
[email protected]dc63aab2013-02-12 06:15:105#ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_DEFAULT_H_
6#define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_DEFAULT_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
EmiliaPaz723b8ad82024-08-26 19:08:5725class ExtensionInstallUIDefault {
[email protected]c82da8c42012-06-08 19:49:1126 public:
pkotwicza57a1f322014-10-21 00:24:3027 explicit ExtensionInstallUIDefault(content::BrowserContext* context);
Peter Boström53c6c5952021-09-17 09:41:2628
29 ExtensionInstallUIDefault(const ExtensionInstallUIDefault&) = delete;
30 ExtensionInstallUIDefault& operator=(const ExtensionInstallUIDefault&) =
31 delete;
32
EmiliaPaz723b8ad82024-08-26 19:08:5733 ~ExtensionInstallUIDefault();
[email protected]c82da8c42012-06-08 19:49:1134
EmiliaPaz723b8ad82024-08-26 19:08:5735 // Called when an extension was installed.
Dana Friedc3c30222018-12-11 23:34:5636 void OnInstallSuccess(scoped_refptr<const extensions::Extension> extension,
EmiliaPaz723b8ad82024-08-26 19:08:5737 const SkBitmap* icon);
38
39 // Called when an extension failed to install.
40 void OnInstallFailure(const extensions::CrxInstallError& error);
41
42 // TODO(asargent) Normally we navigate to the new tab page when an app is
43 // installed, but we're experimenting with instead showing a bubble when
44 // an app is installed which points to the new tab button. This may become
45 // the default behavior in the future.
46 void SetUseAppInstalledBubble(bool use_bubble);
47
48 // Sets whether to show the default UI after completing the installation.
49 void SetSkipPostInstallUI(bool skip_ui);
[email protected]c82da8c42012-06-08 19:49:1150
Elly Fong-Jones7c3ab032020-03-12 23:02:1951 // Show the platform-specific bubble UI. This method has different
52 // implementations on different platforms, controlled by build flags.
EmiliaPaz723b8ad82024-08-26 19:08:5753 // TODO(crbug.com/330588494): There are no longer platform-specific bubbles.
54 // Rename this to ShowBubble and move the implementation here (it doesn't need
55 // to be on extension_installed_bubble_view.cc).
Elly Fong-Jones7c3ab032020-03-12 23:02:1956 static void ShowPlatformBubble(
57 scoped_refptr<const extensions::Extension> extension,
58 Browser* browser,
59 const SkBitmap& icon);
60
EmiliaPaz723b8ad82024-08-26 19:08:5761 // For testing:
62 static base::AutoReset<bool> disable_ui_for_tests(bool disable);
63
[email protected]c82da8c42012-06-08 19:49:1164 private:
Arthur Sonzognie98d2142023-06-01 15:02:2565 raw_ptr<Profile, DanglingUntriaged> profile_;
pkotwicza57a1f322014-10-21 00:24:3066
67 // Whether or not to show the default UI after completing the installation.
68 bool skip_post_install_ui_;
69
[email protected]c82da8c42012-06-08 19:49:1170 // Whether to show an installed bubble on app install, or use the default
71 // action of opening a new tab page.
72 bool use_app_installed_bubble_;
[email protected]c82da8c42012-06-08 19:49:1173};
74
[email protected]dc63aab2013-02-12 06:15:1075#endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_DEFAULT_H_