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 gfx::VectorIconId
GetVectorIconId() const override
;
48 ThemeInstalledInfoBarDelegate
* AsThemePreviewInfobarDelegate() override
;
49 base::string16
GetMessageText() const override
;
50 int GetButtons() const override
;
51 base::string16
GetButtonLabel(InfoBarButton button
) const override
;
52 bool Cancel() override
;
54 // content::NotificationObserver:
55 void Observe(int type
,
56 const content::NotificationSource
& source
,
57 const content::NotificationDetails
& details
) override
;
59 ExtensionService
* extension_service_
;
60 ThemeService
* theme_service_
;
62 // Name of theme that's just been installed.
65 // ID of theme that's just been installed.
66 std::string theme_id_
;
68 // Used to undo theme install.
69 std::string previous_theme_id_
;
70 bool previous_using_system_theme_
;
72 // Registers and unregisters us for notifications.
73 content::NotificationRegistrar registrar_
;
76 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_