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_
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
;
20 namespace extensions
{
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
{
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
,
33 const std::string
& previous_theme_id
,
34 bool previous_using_system_theme
);
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.
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_