OLD | NEW |
1 // Copyright (c) 2011 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 class ExtensionService; | 15 class ExtensionService; |
16 class InfoBarService; | 16 class InfoBarService; |
17 class Profile; | 17 class Profile; |
18 class ThemeService; | 18 class ThemeService; |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 class Extension; | 21 class Extension; |
22 } | 22 } |
23 | 23 |
24 // When a user installs a theme, we display it immediately, but provide an | 24 // When a user installs a theme, we display it immediately, but provide an |
25 // infobar allowing them to cancel. | 25 // infobar allowing them to cancel. |
26 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, | 26 class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, |
27 public content::NotificationObserver { | 27 public content::NotificationObserver { |
28 public: | 28 public: |
29 // Creates a theme installed infobar delegate and adds it to the last active | 29 // Creates a theme installed infobar and delegate and adds the infobar to the |
30 // tab on |profile|. | 30 // last active tab on |profile|. |
31 static void Create(const extensions::Extension* new_theme, | 31 static void Create(const extensions::Extension* new_theme, |
32 Profile* profile, | 32 Profile* profile, |
33 const std::string& previous_theme_id, | 33 const std::string& previous_theme_id, |
34 bool previous_using_native_theme); | 34 bool previous_using_native_theme); |
35 | 35 |
36 private: | 36 private: |
37 ThemeInstalledInfoBarDelegate(InfoBarService* infobar_service, | 37 ThemeInstalledInfoBarDelegate(ExtensionService* extension_service, |
38 ExtensionService* extension_service, | |
39 ThemeService* theme_service, | 38 ThemeService* theme_service, |
40 const extensions::Extension* new_theme, | 39 const extensions::Extension* new_theme, |
41 const std::string& previous_theme_id, | 40 const std::string& previous_theme_id, |
42 bool previous_using_native_theme); | 41 bool previous_using_native_theme); |
43 virtual ~ThemeInstalledInfoBarDelegate(); | 42 virtual ~ThemeInstalledInfoBarDelegate(); |
44 | 43 |
45 // ConfirmInfoBarDelegate: | 44 // ConfirmInfoBarDelegate: |
46 virtual int GetIconID() const OVERRIDE; | 45 virtual int GetIconID() const OVERRIDE; |
47 virtual Type GetInfoBarType() const OVERRIDE; | 46 virtual Type GetInfoBarType() const OVERRIDE; |
48 virtual ThemeInstalledInfoBarDelegate* | 47 virtual ThemeInstalledInfoBarDelegate* |
(...skipping 19 matching lines...) Expand all Loading... |
68 | 67 |
69 // Used to undo theme install. | 68 // Used to undo theme install. |
70 std::string previous_theme_id_; | 69 std::string previous_theme_id_; |
71 bool previous_using_native_theme_; | 70 bool previous_using_native_theme_; |
72 | 71 |
73 // Registers and unregisters us for notifications. | 72 // Registers and unregisters us for notifications. |
74 content::NotificationRegistrar registrar_; | 73 content::NotificationRegistrar registrar_; |
75 }; | 74 }; |
76 | 75 |
77 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ | 76 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ |
OLD | NEW |