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 "chrome/browser/infobars/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 delegate and adds it to the last active
31 static void Create(const extensions::Extension* new_theme,
33 const std::string& previous_theme_id,
34 bool previous_using_native_theme);
37 ThemeInstalledInfoBarDelegate(InfoBarService* infobar_service,
38 ExtensionService* extension_service,
39 ThemeService* theme_service,
40 const extensions::Extension* new_theme,
41 const std::string& previous_theme_id,
42 bool previous_using_native_theme);
43 virtual ~ThemeInstalledInfoBarDelegate();
45 // ConfirmInfoBarDelegate:
46 virtual int GetIconID() const OVERRIDE;
47 virtual Type GetInfoBarType() const OVERRIDE;
48 virtual ThemeInstalledInfoBarDelegate*
49 AsThemePreviewInfobarDelegate() OVERRIDE;
50 virtual string16 GetMessageText() const OVERRIDE;
51 virtual int GetButtons() const OVERRIDE;
52 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
53 virtual bool Cancel() OVERRIDE;
55 // content::NotificationObserver:
56 virtual void Observe(int type,
57 const content::NotificationSource& source,
58 const content::NotificationDetails& details) OVERRIDE;
60 ExtensionService* extension_service_;
61 ThemeService* theme_service_;
63 // Name of theme that's just been installed.
66 // ID of theme that's just been installed.
67 std::string theme_id_;
69 // Used to undo theme install.
70 std::string previous_theme_id_;
71 bool previous_using_native_theme_;
73 // Registers and unregisters us for notifications.
74 content::NotificationRegistrar registrar_;
77 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_