OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/tab_contents/infobar_delegate.h" | 9 #include "chrome/browser/tab_contents/infobar_delegate.h" |
10 #include "chrome/common/notification_registrar.h" | 10 #include "chrome/common/notification_registrar.h" |
11 | 11 |
12 class Extension; | 12 class Extension; |
13 class SkBitmap; | 13 class SkBitmap; |
14 class TabContents; | 14 class TabContents; |
15 | 15 |
16 // When a user installs a theme, we display it immediately, but provide an | 16 // When a user installs a theme, we display it immediately, but provide an |
17 // infobar allowing them to cancel. | 17 // infobar allowing them to cancel. |
18 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, | 18 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, |
19 public NotificationObserver { | 19 public NotificationObserver { |
20 public: | 20 public: |
21 ThemeInstalledInfoBarDelegate(TabContents* tab_contents, | 21 ThemeInstalledInfoBarDelegate(TabContents* tab_contents, |
22 const Extension* new_theme, | 22 const Extension* new_theme, |
23 const std::string& previous_theme_id); | 23 const std::string& previous_theme_id); |
24 virtual ~ThemeInstalledInfoBarDelegate(); | |
25 virtual void InfoBarClosed(); | |
26 virtual string16 GetMessageText() const; | |
27 virtual SkBitmap* GetIcon() const; | |
28 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); | |
29 virtual int GetButtons() const; | |
30 virtual string16 GetButtonLabel( | |
31 ConfirmInfoBarDelegate::InfoBarButton button) const; | |
32 virtual bool Cancel(); | |
33 | 24 |
34 // Returns true if the given theme is the same as the one associated with this | 25 // Returns true if the given theme is the same as the one associated with this |
35 // info bar. | 26 // info bar. |
36 bool MatchesTheme(const Extension* theme); | 27 bool MatchesTheme(const Extension* theme); |
37 | 28 |
38 // NotificationObserver implementation. | 29 protected: |
| 30 virtual ~ThemeInstalledInfoBarDelegate(); |
| 31 |
| 32 Profile* profile() { return profile_; } |
| 33 |
| 34 // ConfirmInfoBarDelegate: |
| 35 virtual bool Cancel(); |
| 36 |
| 37 private: |
| 38 // ConfirmInfoBarDelegate: |
| 39 virtual void InfoBarClosed(); |
| 40 virtual SkBitmap* GetIcon() const; |
| 41 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); |
| 42 virtual string16 GetMessageText() const; |
| 43 virtual int GetButtons() const; |
| 44 virtual string16 GetButtonLabel(InfoBarButton button) const; |
| 45 |
| 46 // NotificationObserver: |
39 virtual void Observe(NotificationType type, | 47 virtual void Observe(NotificationType type, |
40 const NotificationSource& source, | 48 const NotificationSource& source, |
41 const NotificationDetails& details); | 49 const NotificationDetails& details); |
42 protected: | |
43 Profile* profile() { return profile_; } | |
44 | 50 |
45 private: | |
46 Profile* profile_; | 51 Profile* profile_; |
47 | 52 |
48 // Name of theme that's just been installed. | 53 // Name of theme that's just been installed. |
49 std::string name_; | 54 std::string name_; |
50 | 55 |
51 // ID of theme that's just been installed. | 56 // ID of theme that's just been installed. |
52 std::string theme_id_; | 57 std::string theme_id_; |
53 | 58 |
54 // Used to undo theme install. | 59 // Used to undo theme install. |
55 std::string previous_theme_id_; | 60 std::string previous_theme_id_; |
56 | 61 |
57 // Tab to which this info bar is associated. | 62 // Tab to which this info bar is associated. |
58 TabContents* tab_contents_; | 63 TabContents* tab_contents_; |
59 | 64 |
60 // Registers and unregisters us for notifications. | 65 // Registers and unregisters us for notifications. |
61 NotificationRegistrar registrar_; | 66 NotificationRegistrar registrar_; |
62 }; | 67 }; |
63 | 68 |
64 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ | 69 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ |
OLD | NEW |