Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / theme_installed_infobar_delegate.h
blob917a82412763dbf44513e8e18f920830d240fa98
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "components/infobars/core/confirm_infobar_delegate.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
15 class ExtensionService;
16 class InfoBarService;
17 class Profile;
18 class ThemeService;
20 namespace extensions {
21 class Extension;
24 // When a user installs a theme, we display it immediately, but provide an
25 // infobar allowing them to cancel.
26 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate,
27 public content::NotificationObserver {
28 public:
29 // Creates a theme installed infobar and delegate and adds the infobar to the
30 // last active tab on |profile|.
31 static void Create(const extensions::Extension* new_theme,
32 Profile* profile,
33 const std::string& previous_theme_id,
34 bool previous_using_system_theme);
36 private:
37 ThemeInstalledInfoBarDelegate(ExtensionService* extension_service,
38 ThemeService* theme_service,
39 const extensions::Extension* new_theme,
40 const std::string& previous_theme_id,
41 bool previous_using_system_theme);
42 ~ThemeInstalledInfoBarDelegate() override;
44 // ConfirmInfoBarDelegate:
45 Type GetInfoBarType() const override;
46 int GetIconID() const override;
47 ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate() override;
48 base::string16 GetMessageText() const override;
49 int GetButtons() const override;
50 base::string16 GetButtonLabel(InfoBarButton button) const override;
51 bool Cancel() override;
53 // content::NotificationObserver:
54 void Observe(int type,
55 const content::NotificationSource& source,
56 const content::NotificationDetails& details) override;
58 ExtensionService* extension_service_;
59 ThemeService* theme_service_;
61 // Name of theme that's just been installed.
62 std::string name_;
64 // ID of theme that's just been installed.
65 std::string theme_id_;
67 // Used to undo theme install.
68 std::string previous_theme_id_;
69 bool previous_using_system_theme_;
71 // Registers and unregisters us for notifications.
72 content::NotificationRegistrar registrar_;
75 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_