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" | |
10 | 9 |
11 class Extension; | 10 class Extension; |
12 class SkBitmap; | 11 class SkBitmap; |
13 class TabContents; | 12 class TabContents; |
14 | 13 |
15 // When a user installs a theme, we display it immediately, but provide an | 14 // When a user installs a theme, we display it immediately, but provide an |
16 // infobar allowing them to cancel. | 15 // infobar allowing them to cancel. |
17 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, | 16 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate { |
18 public NotificationObserver { | |
19 public: | 17 public: |
20 ThemeInstalledInfoBarDelegate(TabContents* tab_contents, | 18 ThemeInstalledInfoBarDelegate(TabContents* tab_contents, |
21 const Extension* new_theme, | 19 const Extension* new_theme, |
22 const std::string& previous_theme_id); | 20 const std::string& previous_theme_id); |
23 virtual ~ThemeInstalledInfoBarDelegate(); | 21 virtual ~ThemeInstalledInfoBarDelegate(); |
24 virtual void InfoBarClosed(); | 22 virtual void InfoBarClosed(); |
25 virtual std::wstring GetMessageText() const; | 23 virtual std::wstring GetMessageText() const; |
26 virtual SkBitmap* GetIcon() const; | 24 virtual SkBitmap* GetIcon() const; |
27 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); | 25 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); |
28 virtual int GetButtons() const; | 26 virtual int GetButtons() const; |
29 virtual std::wstring GetButtonLabel( | 27 virtual std::wstring GetButtonLabel( |
30 ConfirmInfoBarDelegate::InfoBarButton button) const; | 28 ConfirmInfoBarDelegate::InfoBarButton button) const; |
31 virtual bool Cancel(); | 29 virtual bool Cancel(); |
32 | 30 |
33 // NotificationObserver implementation. | |
34 virtual void Observe(NotificationType type, | |
35 const NotificationSource& source, | |
36 const NotificationDetails& details); | |
37 protected: | 31 protected: |
38 Profile* profile() { return profile_; } | 32 Profile* profile() { return profile_; } |
39 | 33 |
40 private: | 34 private: |
41 Profile* profile_; | 35 Profile* profile_; |
42 | |
43 // Name of theme that's just been installed. | 36 // Name of theme that's just been installed. |
44 std::string name_; | 37 std::string name_; |
45 | |
46 // ID of theme that's just been installed. | |
47 std::string theme_id_; | |
48 | |
49 // Used to undo theme install. | 38 // Used to undo theme install. |
50 std::string previous_theme_id_; | 39 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_; | |
57 }; | 40 }; |
58 | 41 |
59 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ | 42 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ |
OLD | NEW |