| 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/api/infobars/confirm_infobar_delegate.h" |   9 #include "chrome/browser/api/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 class InfoBarTabService; |  15 class InfoBarService; | 
|  16  |  16  | 
|  17 namespace extensions { |  17 namespace extensions { | 
|  18 class Extension; |  18 class Extension; | 
|  19 class ExtensionHost; |  19 class ExtensionHost; | 
|  20 } |  20 } | 
|  21  |  21  | 
|  22 // The InfobarDelegate for creating and managing state for the ExtensionInfobar |  22 // The InfobarDelegate for creating and managing state for the ExtensionInfobar | 
|  23 // plus monitor when the extension goes away. |  23 // plus monitor when the extension goes away. | 
|  24 class ExtensionInfoBarDelegate : public InfoBarDelegate, |  24 class ExtensionInfoBarDelegate : public InfoBarDelegate, | 
|  25                                  public content::NotificationObserver { |  25                                  public content::NotificationObserver { | 
|  26  public: |  26  public: | 
|  27   // The observer for when the delegate dies. |  27   // The observer for when the delegate dies. | 
|  28   class DelegateObserver { |  28   class DelegateObserver { | 
|  29    public: |  29    public: | 
|  30     virtual void OnDelegateDeleted() = 0; |  30     virtual void OnDelegateDeleted() = 0; | 
|  31  |  31  | 
|  32    protected: |  32    protected: | 
|  33     virtual ~DelegateObserver() {} |  33     virtual ~DelegateObserver() {} | 
|  34   }; |  34   }; | 
|  35  |  35  | 
|  36   ExtensionInfoBarDelegate(Browser* browser, |  36   ExtensionInfoBarDelegate(Browser* browser, | 
|  37                            InfoBarTabService* infobar_service, |  37                            InfoBarService* infobar_service, | 
|  38                            const extensions::Extension* extension, |  38                            const extensions::Extension* extension, | 
|  39                            const GURL& url, |  39                            const GURL& url, | 
|  40                            int height); |  40                            int height); | 
|  41  |  41  | 
|  42   const extensions::Extension* extension() { return extension_; } |  42   const extensions::Extension* extension() { return extension_; } | 
|  43   extensions::ExtensionHost* extension_host() { return extension_host_.get(); } |  43   extensions::ExtensionHost* extension_host() { return extension_host_.get(); } | 
|  44   int height() { return height_; } |  44   int height() { return height_; } | 
|  45  |  45  | 
|  46   void set_observer(DelegateObserver* observer) { observer_ = observer; } |  46   void set_observer(DelegateObserver* observer) { observer_ = observer; } | 
|  47  |  47  | 
|  48   bool closing() const { return closing_; } |  48   bool closing() const { return closing_; } | 
|  49  |  49  | 
|  50  private: |  50  private: | 
|  51   virtual ~ExtensionInfoBarDelegate(); |  51   virtual ~ExtensionInfoBarDelegate(); | 
|  52  |  52  | 
|  53   // InfoBarDelegate: |  53   // InfoBarDelegate: | 
|  54   virtual InfoBar* CreateInfoBar(InfoBarTabService* owner) OVERRIDE; |  54   virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; | 
|  55   virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; |  55   virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; | 
|  56   virtual void InfoBarDismissed() OVERRIDE; |  56   virtual void InfoBarDismissed() OVERRIDE; | 
|  57   virtual Type GetInfoBarType() const OVERRIDE; |  57   virtual Type GetInfoBarType() const OVERRIDE; | 
|  58   virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; |  58   virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; | 
|  59  |  59  | 
|  60   // content::NotificationObserver: |  60   // content::NotificationObserver: | 
|  61   virtual void Observe(int type, |  61   virtual void Observe(int type, | 
|  62                        const content::NotificationSource& source, |  62                        const content::NotificationSource& source, | 
|  63                        const content::NotificationDetails& details) OVERRIDE; |  63                        const content::NotificationDetails& details) OVERRIDE; | 
|  64  |  64  | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|  80   int height_; |  80   int height_; | 
|  81  |  81  | 
|  82   // Whether we are currently animating to close. This is used to ignore |  82   // Whether we are currently animating to close. This is used to ignore | 
|  83   // ExtensionView::PreferredSizeChanged notifications. |  83   // ExtensionView::PreferredSizeChanged notifications. | 
|  84   bool closing_; |  84   bool closing_; | 
|  85  |  85  | 
|  86   DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); |  86   DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); | 
|  87 }; |  87 }; | 
|  88  |  88  | 
|  89 #endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |  89 #endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 
| OLD | NEW |