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 "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class WebContents; | 17 class WebContents; |
18 } | 18 } |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 class Extension; | 21 class Extension; |
22 class ExtensionViewHost; | 22 class ExtensionViewHost; |
23 } | 23 } |
24 | 24 |
25 // The InfobarDelegate for creating and managing state for the ExtensionInfobar | 25 // The InfobarDelegate for creating and managing state for the ExtensionInfobar |
26 // plus monitor when the extension goes away. | 26 // plus monitor when the extension goes away. |
27 class ExtensionInfoBarDelegate : public InfoBarDelegate, | 27 class ExtensionInfoBarDelegate : public infobars::InfoBarDelegate, |
28 public content::NotificationObserver { | 28 public content::NotificationObserver { |
29 public: | 29 public: |
30 virtual ~ExtensionInfoBarDelegate(); | 30 virtual ~ExtensionInfoBarDelegate(); |
31 | 31 |
32 // Creates an extension infobar and delegate and adds the infobar to the | 32 // Creates an extension infobar and delegate and adds the infobar to the |
33 // infobar service for |web_contents|. | 33 // infobar service for |web_contents|. |
34 static void Create(content::WebContents* web_contents, | 34 static void Create(content::WebContents* web_contents, |
35 Browser* browser, | 35 Browser* browser, |
36 const extensions::Extension* extension, | 36 const extensions::Extension* extension, |
37 const GURL& url, | 37 const GURL& url, |
(...skipping 11 matching lines...) Expand all Loading... |
49 content::WebContents* GetWebContents(); | 49 content::WebContents* GetWebContents(); |
50 | 50 |
51 private: | 51 private: |
52 ExtensionInfoBarDelegate(Browser* browser, | 52 ExtensionInfoBarDelegate(Browser* browser, |
53 const extensions::Extension* extension, | 53 const extensions::Extension* extension, |
54 const GURL& url, | 54 const GURL& url, |
55 content::WebContents* web_contents, | 55 content::WebContents* web_contents, |
56 int height); | 56 int height); |
57 | 57 |
58 // Returns an extension infobar that owns |delegate|. | 58 // Returns an extension infobar that owns |delegate|. |
59 static scoped_ptr<InfoBar> CreateInfoBar( | 59 static scoped_ptr<infobars::InfoBar> CreateInfoBar( |
60 scoped_ptr<ExtensionInfoBarDelegate> delegate); | 60 scoped_ptr<ExtensionInfoBarDelegate> delegate); |
61 | 61 |
62 // InfoBarDelegate: | 62 // InfoBarDelegate: |
63 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; | 63 virtual bool EqualsDelegate( |
| 64 infobars::InfoBarDelegate* delegate) const OVERRIDE; |
64 virtual void InfoBarDismissed() OVERRIDE; | 65 virtual void InfoBarDismissed() OVERRIDE; |
65 virtual Type GetInfoBarType() const OVERRIDE; | 66 virtual Type GetInfoBarType() const OVERRIDE; |
66 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; | 67 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; |
67 | 68 |
68 // content::NotificationObserver: | 69 // content::NotificationObserver: |
69 virtual void Observe(int type, | 70 virtual void Observe(int type, |
70 const content::NotificationSource& source, | 71 const content::NotificationSource& source, |
71 const content::NotificationDetails& details) OVERRIDE; | 72 const content::NotificationDetails& details) OVERRIDE; |
72 | 73 |
73 #if defined(TOOLKIT_VIEWS) | 74 #if defined(TOOLKIT_VIEWS) |
(...skipping 11 matching lines...) Expand all Loading... |
85 int height_; | 86 int height_; |
86 | 87 |
87 // Whether we are currently animating to close. This is used to ignore | 88 // Whether we are currently animating to close. This is used to ignore |
88 // ExtensionView::PreferredSizeChanged notifications. | 89 // ExtensionView::PreferredSizeChanged notifications. |
89 bool closing_; | 90 bool closing_; |
90 | 91 |
91 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); | 92 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); |
92 }; | 93 }; |
93 | 94 |
94 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |