OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSION_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
10 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class ExtensionRegistry; | 24 class ExtensionRegistry; |
25 class ExtensionViewHost; | 25 class ExtensionViewHost; |
26 } | 26 } |
27 | 27 |
28 // The InfobarDelegate for creating and managing state for the ExtensionInfobar | 28 // The InfobarDelegate for creating and managing state for the ExtensionInfobar |
29 // plus monitor when the extension goes away. | 29 // plus monitor when the extension goes away. |
30 class ExtensionInfoBarDelegate : public infobars::InfoBarDelegate, | 30 class ExtensionInfoBarDelegate : public infobars::InfoBarDelegate, |
31 public content::NotificationObserver, | 31 public content::NotificationObserver, |
32 public extensions::ExtensionRegistryObserver { | 32 public extensions::ExtensionRegistryObserver { |
33 public: | 33 public: |
34 virtual ~ExtensionInfoBarDelegate(); | 34 ~ExtensionInfoBarDelegate() override; |
35 | 35 |
36 // Creates an extension infobar and delegate and adds the infobar to the | 36 // Creates an extension infobar and delegate and adds the infobar to the |
37 // infobar service for |web_contents|. | 37 // infobar service for |web_contents|. |
38 static void Create(content::WebContents* web_contents, | 38 static void Create(content::WebContents* web_contents, |
39 Browser* browser, | 39 Browser* browser, |
40 const extensions::Extension* extension, | 40 const extensions::Extension* extension, |
41 const GURL& url, | 41 const GURL& url, |
42 int height); | 42 int height); |
43 | 43 |
44 const extensions::Extension* extension() { return extension_; } | 44 const extensions::Extension* extension() { return extension_; } |
(...skipping 16 matching lines...) Expand all Loading... |
61 const extensions::Extension* extension, | 61 const extensions::Extension* extension, |
62 const GURL& url, | 62 const GURL& url, |
63 content::WebContents* web_contents, | 63 content::WebContents* web_contents, |
64 int height); | 64 int height); |
65 | 65 |
66 // Returns an extension infobar that owns |delegate|. | 66 // Returns an extension infobar that owns |delegate|. |
67 static scoped_ptr<infobars::InfoBar> CreateInfoBar( | 67 static scoped_ptr<infobars::InfoBar> CreateInfoBar( |
68 scoped_ptr<ExtensionInfoBarDelegate> delegate); | 68 scoped_ptr<ExtensionInfoBarDelegate> delegate); |
69 | 69 |
70 // InfoBarDelegate. | 70 // InfoBarDelegate. |
71 virtual bool EqualsDelegate( | 71 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
72 infobars::InfoBarDelegate* delegate) const override; | 72 void InfoBarDismissed() override; |
73 virtual void InfoBarDismissed() override; | 73 Type GetInfoBarType() const override; |
74 virtual Type GetInfoBarType() const override; | 74 ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() override; |
75 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() override; | |
76 | 75 |
77 // content::NotificationObserver. | 76 // content::NotificationObserver. |
78 virtual void Observe(int type, | 77 void Observe(int type, |
79 const content::NotificationSource& source, | 78 const content::NotificationSource& source, |
80 const content::NotificationDetails& details) override; | 79 const content::NotificationDetails& details) override; |
81 | 80 |
82 // extensions::ExtensionRegistryObserver. | 81 // extensions::ExtensionRegistryObserver. |
83 virtual void OnExtensionUnloaded( | 82 void OnExtensionUnloaded( |
84 content::BrowserContext* browser_context, | 83 content::BrowserContext* browser_context, |
85 const extensions::Extension* extension, | 84 const extensions::Extension* extension, |
86 extensions::UnloadedExtensionInfo::Reason reason) override; | 85 extensions::UnloadedExtensionInfo::Reason reason) override; |
87 | 86 |
88 #if defined(TOOLKIT_VIEWS) | 87 #if defined(TOOLKIT_VIEWS) |
89 Browser* browser_; // We pass this to the ExtensionInfoBar. | 88 Browser* browser_; // We pass this to the ExtensionInfoBar. |
90 #endif | 89 #endif |
91 | 90 |
92 // The extension host we are showing the InfoBar for. | 91 // The extension host we are showing the InfoBar for. |
93 // TODO(pkasting): Should this live on the InfoBar instead? | 92 // TODO(pkasting): Should this live on the InfoBar instead? |
(...skipping 10 matching lines...) Expand all Loading... |
104 int height_; | 103 int height_; |
105 | 104 |
106 // Whether we are currently animating to close. This is used to ignore | 105 // Whether we are currently animating to close. This is used to ignore |
107 // ExtensionView::PreferredSizeChanged notifications. | 106 // ExtensionView::PreferredSizeChanged notifications. |
108 bool closing_; | 107 bool closing_; |
109 | 108 |
110 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); | 109 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); |
111 }; | 110 }; |
112 | 111 |
113 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |