Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / theme_installed_infobar_delegate.h
blobbcc42b4590f254c57dc89df34777805900be2802
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_
8 #include <string>
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;
16 class InfoBarService;
17 class Profile;
18 class ThemeService;
20 namespace extensions {
21 class Extension;
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 {
28 public:
29 // Creates a theme installed infobar and delegate and adds the infobar to the
30 // last active tab on |profile|.
31 static void Create(const extensions::Extension* new_theme,
32 Profile* profile,
33 const std::string& previous_theme_id,
34 bool previous_using_native_theme);
36 private:
37 ThemeInstalledInfoBarDelegate(ExtensionService* extension_service,
38 ThemeService* theme_service,
39 const extensions::Extension* new_theme,
40 const std::string& previous_theme_id,
41 bool previous_using_native_theme);
42 virtual ~ThemeInstalledInfoBarDelegate();
44 // ConfirmInfoBarDelegate:
45 virtual int GetIconID() const OVERRIDE;
46 virtual Type GetInfoBarType() const OVERRIDE;
47 virtual ThemeInstalledInfoBarDelegate*
48 AsThemePreviewInfobarDelegate() OVERRIDE;
49 virtual base::string16 GetMessageText() const OVERRIDE;
50 virtual int GetButtons() const OVERRIDE;
51 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
52 virtual bool Cancel() OVERRIDE;
54 // content::NotificationObserver:
55 virtual void Observe(int type,
56 const content::NotificationSource& source,
57 const content::NotificationDetails& details) OVERRIDE;
59 ExtensionService* extension_service_;
60 ThemeService* theme_service_;
62 // Name of theme that's just been installed.
63 std::string name_;
65 // ID of theme that's just been installed.
66 std::string theme_id_;
68 // Used to undo theme install.
69 std::string previous_theme_id_;
70 bool previous_using_native_theme_;
72 // Registers and unregisters us for notifications.
73 content::NotificationRegistrar registrar_;
76 #endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_