| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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_CRASHED_EXTENSION_INFOBAR_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/browser/tab_contents/infobar_delegate.h" | 12 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 13 | 13 |
| 14 class Extension; | 14 class Extension; |
| 15 class ExtensionService; | 15 class ExtensionService; |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 | 17 |
| 18 // This infobar will be displayed when an extension process crashes. It allows | 18 // This infobar will be displayed when an extension process crashes. It allows |
| 19 // the user to reload the crashed extension. | 19 // the user to reload the crashed extension. |
| 20 class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate { | 20 class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 21 public: | 21 public: |
| 22 // |tab_contents| should point to the TabContents the infobar will be added | 22 // |tab_contents| should point to the TabContents the infobar will be added |
| 23 // to. |extension| should be the crashed extension, and |extensions_service| | 23 // to. |extension| should be the crashed extension, and |extensions_service| |
| 24 // the ExtensionService which manages that extension. | 24 // the ExtensionService which manages that extension. |
| 25 CrashedExtensionInfoBarDelegate(TabContents* tab_contents, | 25 CrashedExtensionInfoBarDelegate(TabContents* tab_contents, |
| 26 ExtensionService* extensions_service, | 26 ExtensionService* extensions_service, |
| 27 const Extension* extension); | 27 const Extension* extension); |
| 28 | 28 |
| 29 const std::string extension_id() { return extension_id_; } | 29 const std::string extension_id() { return extension_id_; } |
| 30 | 30 |
| 31 // InfoBarDelegate | 31 private: |
| 32 virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate(); | 32 virtual ~CrashedExtensionInfoBarDelegate(); |
| 33 |
| 34 // ConfirmInfoBarDelegate |
| 33 virtual bool ShouldExpire( | 35 virtual bool ShouldExpire( |
| 34 const NavigationController::LoadCommittedDetails& details) const; | 36 const NavigationController::LoadCommittedDetails& details) const; |
| 35 | |
| 36 // ConfirmInfoBarDelegate | |
| 37 virtual string16 GetMessageText() const; | |
| 38 virtual void InfoBarClosed(); | 37 virtual void InfoBarClosed(); |
| 39 virtual SkBitmap* GetIcon() const; | 38 virtual SkBitmap* GetIcon() const; |
| 39 virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate(); |
| 40 virtual string16 GetMessageText() const; |
| 40 virtual int GetButtons() const; | 41 virtual int GetButtons() const; |
| 41 virtual string16 GetButtonLabel( | 42 virtual string16 GetButtonLabel( |
| 42 ConfirmInfoBarDelegate::InfoBarButton button) const; | 43 ConfirmInfoBarDelegate::InfoBarButton button) const; |
| 43 virtual bool Accept(); | 44 virtual bool Accept(); |
| 44 | 45 |
| 45 private: | |
| 46 ExtensionService* extensions_service_; | 46 ExtensionService* extensions_service_; |
| 47 | 47 |
| 48 const std::string extension_id_; | 48 const std::string extension_id_; |
| 49 const std::string extension_name_; | 49 const std::string extension_name_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(CrashedExtensionInfoBarDelegate); | 51 DISALLOW_COPY_AND_ASSIGN(CrashedExtensionInfoBarDelegate); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 #endif // CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_ | 54 #endif // CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_ |
| OLD | NEW |