Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | dc63aab | 2013-02-12 06:15:10 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_DEFAULT_H_ |
6 | #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_DEFAULT_H_ | ||||
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 7 | |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 8 | #include "base/auto_reset.h" |
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 9 | #include "base/memory/raw_ptr.h" |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 10 | #include "base/memory/scoped_refptr.h" |
pkotwicz | a57a1f32 | 2014-10-21 00:24:30 | [diff] [blame] | 11 | |
12 | namespace content { | ||||
13 | class BrowserContext; | ||||
14 | } | ||||
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 15 | |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 16 | namespace extensions { |
17 | class CrxInstallError; | ||||
18 | class Extension; | ||||
19 | } // namespace extensions | ||||
20 | |||||
Elly Fong-Jones | 7c3ab03 | 2020-03-12 23:02:19 | [diff] [blame] | 21 | class Browser; |
[email protected] | 32fc4ff7 | 2012-06-15 21:50:01 | [diff] [blame] | 22 | class Profile; |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 23 | class SkBitmap; |
[email protected] | 591a59f | 2012-10-11 01:16:23 | [diff] [blame] | 24 | |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 25 | class ExtensionInstallUIDefault { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 26 | public: |
pkotwicz | a57a1f32 | 2014-10-21 00:24:30 | [diff] [blame] | 27 | explicit ExtensionInstallUIDefault(content::BrowserContext* context); |
Peter Boström | 53c6c595 | 2021-09-17 09:41:26 | [diff] [blame] | 28 | |
29 | ExtensionInstallUIDefault(const ExtensionInstallUIDefault&) = delete; | ||||
30 | ExtensionInstallUIDefault& operator=(const ExtensionInstallUIDefault&) = | ||||
31 | delete; | ||||
32 | |||||
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 33 | ~ExtensionInstallUIDefault(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 34 | |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 35 | // Called when an extension was installed. |
Dana Fried | c3c3022 | 2018-12-11 23:34:56 | [diff] [blame] | 36 | void OnInstallSuccess(scoped_refptr<const extensions::Extension> extension, |
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 37 | 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] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 50 | |
Elly Fong-Jones | 7c3ab03 | 2020-03-12 23:02:19 | [diff] [blame] | 51 | // Show the platform-specific bubble UI. This method has different |
52 | // implementations on different platforms, controlled by build flags. | ||||
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 53 | // 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-Jones | 7c3ab03 | 2020-03-12 23:02:19 | [diff] [blame] | 56 | static void ShowPlatformBubble( |
57 | scoped_refptr<const extensions::Extension> extension, | ||||
58 | Browser* browser, | ||||
59 | const SkBitmap& icon); | ||||
60 | |||||
EmiliaPaz | 723b8ad8 | 2024-08-26 19:08:57 | [diff] [blame^] | 61 | // For testing: |
62 | static base::AutoReset<bool> disable_ui_for_tests(bool disable); | ||||
63 | |||||
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 64 | private: |
Arthur Sonzogni | e98d214 | 2023-06-01 15:02:25 | [diff] [blame] | 65 | raw_ptr<Profile, DanglingUntriaged> profile_; |
pkotwicz | a57a1f32 | 2014-10-21 00:24:30 | [diff] [blame] | 66 | |
67 | // Whether or not to show the default UI after completing the installation. | ||||
68 | bool skip_post_install_ui_; | ||||
69 | |||||
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 70 | // 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] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 73 | }; |
74 | |||||
[email protected] | dc63aab | 2013-02-12 06:15:10 | [diff] [blame] | 75 | #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALL_UI_DEFAULT_H_ |