OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/tab_contents/infobar_delegate.h" | 8 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 9 #include "chrome/common/notification_registrar.h" |
9 | 10 |
10 class Extension; | 11 class Extension; |
11 class SkBitmap; | 12 class SkBitmap; |
12 class TabContents; | 13 class TabContents; |
13 | 14 |
14 // When a user installs a theme, we display it immediately, but provide an | 15 // When a user installs a theme, we display it immediately, but provide an |
15 // infobar allowing them to cancel. | 16 // infobar allowing them to cancel. |
16 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate { | 17 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, |
| 18 public NotificationObserver { |
17 public: | 19 public: |
18 ThemeInstalledInfoBarDelegate(TabContents* tab_contents, | 20 ThemeInstalledInfoBarDelegate(TabContents* tab_contents, |
19 const Extension* new_theme, | 21 const Extension* new_theme, |
20 const std::string& previous_theme_id); | 22 const std::string& previous_theme_id); |
21 virtual ~ThemeInstalledInfoBarDelegate(); | 23 virtual ~ThemeInstalledInfoBarDelegate(); |
22 virtual void InfoBarClosed(); | 24 virtual void InfoBarClosed(); |
23 virtual std::wstring GetMessageText() const; | 25 virtual std::wstring GetMessageText() const; |
24 virtual SkBitmap* GetIcon() const; | 26 virtual SkBitmap* GetIcon() const; |
25 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); | 27 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); |
26 virtual int GetButtons() const; | 28 virtual int GetButtons() const; |
27 virtual std::wstring GetButtonLabel( | 29 virtual std::wstring GetButtonLabel( |
28 ConfirmInfoBarDelegate::InfoBarButton button) const; | 30 ConfirmInfoBarDelegate::InfoBarButton button) const; |
29 virtual bool Cancel(); | 31 virtual bool Cancel(); |
30 | 32 |
| 33 // NotificationObserver implementation. |
| 34 virtual void Observe(NotificationType type, |
| 35 const NotificationSource& source, |
| 36 const NotificationDetails& details); |
31 protected: | 37 protected: |
32 Profile* profile() { return profile_; } | 38 Profile* profile() { return profile_; } |
33 | 39 |
34 private: | 40 private: |
35 Profile* profile_; | 41 Profile* profile_; |
| 42 |
36 // Name of theme that's just been installed. | 43 // Name of theme that's just been installed. |
37 std::string name_; | 44 std::string name_; |
| 45 |
| 46 // ID of theme that's just been installed. |
| 47 std::string theme_id_; |
| 48 |
38 // Used to undo theme install. | 49 // Used to undo theme install. |
39 std::string previous_theme_id_; | 50 std::string previous_theme_id_; |
| 51 |
| 52 // Tab to which this info bar is associated. |
| 53 TabContents* tab_contents_; |
| 54 |
| 55 // Registers and unregisters us for notifications. |
| 56 NotificationRegistrar registrar_; |
40 }; | 57 }; |
41 | 58 |
42 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ | 59 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ |
OLD | NEW |