| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/infobar_delegate.h" | 8 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 9 | 9 |
| 10 class Browser; | 10 class Browser; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ExtensionInfoBarDelegate(Browser* browser, TabContents* contents, | 26 ExtensionInfoBarDelegate(Browser* browser, TabContents* contents, |
| 27 Extension* extension, const GURL& url); | 27 Extension* extension, const GURL& url); |
| 28 ~ExtensionInfoBarDelegate(); | 28 ~ExtensionInfoBarDelegate(); |
| 29 | 29 |
| 30 Extension* extension() { return extension_; } | 30 Extension* extension() { return extension_; } |
| 31 ExtensionHost* extension_host() { return extension_host_.get(); } | 31 ExtensionHost* extension_host() { return extension_host_.get(); } |
| 32 | 32 |
| 33 void set_observer(DelegateObserver* observer) { observer_ = observer; } | 33 void set_observer(DelegateObserver* observer) { observer_ = observer; } |
| 34 | 34 |
| 35 // Overridden from InfoBarDelegate: | 35 // Overridden from InfoBarDelegate: |
| 36 virtual void InfoBarDismissed() { closing_ = true; } |
| 36 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; | 37 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; |
| 37 virtual void InfoBarClosed(); | 38 virtual void InfoBarClosed(); |
| 38 virtual InfoBar* CreateInfoBar(); | 39 virtual InfoBar* CreateInfoBar(); |
| 39 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() { | 40 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() { |
| 40 return this; | 41 return this; |
| 41 } | 42 } |
| 42 virtual Type GetInfoBarType() { | 43 virtual Type GetInfoBarType() { |
| 43 return PAGE_ACTION_TYPE; | 44 return PAGE_ACTION_TYPE; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Overridden from NotificationObserver: | 47 // Overridden from NotificationObserver: |
| 47 virtual void Observe(NotificationType type, | 48 virtual void Observe(NotificationType type, |
| 48 const NotificationSource& source, | 49 const NotificationSource& source, |
| 49 const NotificationDetails& details); | 50 const NotificationDetails& details); |
| 50 | 51 |
| 52 bool closing() { return closing_; } |
| 51 private: | 53 private: |
| 52 // The extension host we are showing the InfoBar for. The delegate needs to | 54 // The extension host we are showing the InfoBar for. The delegate needs to |
| 53 // own this since the InfoBar gets deleted and recreated when you switch tabs | 55 // own this since the InfoBar gets deleted and recreated when you switch tabs |
| 54 // and come back (and we don't want the user's interaction with the InfoBar to | 56 // and come back (and we don't want the user's interaction with the InfoBar to |
| 55 // get lost at that point. | 57 // get lost at that point. |
| 56 scoped_ptr<ExtensionHost> extension_host_; | 58 scoped_ptr<ExtensionHost> extension_host_; |
| 57 | 59 |
| 58 // The observer monitoring when the delegate dies. | 60 // The observer monitoring when the delegate dies. |
| 59 DelegateObserver* observer_; | 61 DelegateObserver* observer_; |
| 60 | 62 |
| 61 Extension* extension_; | 63 Extension* extension_; |
| 62 | 64 |
| 63 TabContents* tab_contents_; | 65 TabContents* tab_contents_; |
| 64 | 66 |
| 65 NotificationRegistrar registrar_; | 67 NotificationRegistrar registrar_; |
| 66 | 68 |
| 69 // Whether we are currently animating to close. This is used to ignore |
| 70 // ExtensionView::PreferredSizeChanged notifications. |
| 71 bool closing_; |
| 72 |
| 67 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 76 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
| OLD | NEW |