Chromium Code Reviews| 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_INFOBARS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // Returns true if the InfoBar should be closed automatically after the page | 71 // Returns true if the InfoBar should be closed automatically after the page |
| 72 // is navigated. By default this returns true if the navigation is to a new | 72 // is navigated. By default this returns true if the navigation is to a new |
| 73 // page (not including reloads). Subclasses wishing to change this behavior | 73 // page (not including reloads). Subclasses wishing to change this behavior |
| 74 // can override either this function or ShouldExpireInternal(), depending on | 74 // can override either this function or ShouldExpireInternal(), depending on |
| 75 // what level of control they need. | 75 // what level of control they need. |
| 76 virtual bool ShouldExpire(const content::LoadCommittedDetails& details) const; | 76 virtual bool ShouldExpire(const content::LoadCommittedDetails& details) const; |
| 77 | 77 |
| 78 // Called when the user clicks on the close button to dismiss the infobar. | 78 // Called when the user clicks on the close button to dismiss the infobar. |
| 79 virtual void InfoBarDismissed(); | 79 virtual void InfoBarDismissed(); |
| 80 | 80 |
| 81 // Return the icon to be shown for this InfoBar. If the returned Image is | 81 // Return the resource ID of the icon to be shown for this InfoBar. If the |
| 82 // NULL, no icon is shown. | 82 // value is equal to |kNoIconID|, no icon is shown. |
| 83 virtual gfx::Image* GetIcon() const; | 83 virtual int GetIconID() const; |
| 84 | 84 |
| 85 // Returns the type of the infobar. The type determines the appearance (such | 85 // Returns the type of the infobar. The type determines the appearance (such |
| 86 // as background color) of the infobar. | 86 // as background color) of the infobar. |
| 87 virtual Type GetInfoBarType() const; | 87 virtual Type GetInfoBarType() const; |
| 88 | 88 |
| 89 // Type-checking downcast routines: | 89 // Type-checking downcast routines: |
| 90 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate(); | 90 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate(); |
| 91 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate(); | 91 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate(); |
| 92 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate(); | 92 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate(); |
| 93 virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate(); | 93 virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate(); |
| 94 virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate(); | 94 virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate(); |
| 95 virtual RegisterProtocolHandlerInfoBarDelegate* | 95 virtual RegisterProtocolHandlerInfoBarDelegate* |
| 96 AsRegisterProtocolHandlerInfoBarDelegate(); | 96 AsRegisterProtocolHandlerInfoBarDelegate(); |
| 97 virtual ScreenCaptureInfoBarDelegate* AsScreenCaptureInfoBarDelegate(); | 97 virtual ScreenCaptureInfoBarDelegate* AsScreenCaptureInfoBarDelegate(); |
| 98 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); | 98 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); |
| 99 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate(); | 99 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate(); |
| 100 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); | 100 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); |
| 101 | 101 |
| 102 // Value to use when the InfoBar has no icon to show. | |
| 103 static const int kNoIconID = 0; | |
|
sky
2013/05/15 20:47:06
nit: constants should be above destructor.
gone
2013/05/15 21:43:00
Done.
| |
| 104 | |
| 105 // Return the icon to be shown for this InfoBar. If the returned Image is | |
| 106 // empty, no icon is shown. | |
| 107 gfx::Image GetIcon() const; | |
| 108 | |
| 102 content::WebContents* web_contents() { | 109 content::WebContents* web_contents() { |
| 103 return owner_ ? owner_->web_contents() : NULL; | 110 return owner_ ? owner_->web_contents() : NULL; |
| 104 } | 111 } |
| 105 | 112 |
| 106 protected: | 113 protected: |
| 107 // If |contents| is non-NULL, its active entry's unique ID will be stored | 114 // If |contents| is non-NULL, its active entry's unique ID will be stored |
| 108 // using StoreActiveEntryUniqueID automatically. | 115 // using StoreActiveEntryUniqueID automatically. |
| 109 explicit InfoBarDelegate(InfoBarService* infobar_service); | 116 explicit InfoBarDelegate(InfoBarService* infobar_service); |
| 110 | 117 |
| 111 // Store the unique id for the active entry in our WebContents, to be used | 118 // Store the unique id for the active entry in our WebContents, to be used |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 128 // opened for. Used to help expire on navigations. | 135 // opened for. Used to help expire on navigations. |
| 129 int contents_unique_id_; | 136 int contents_unique_id_; |
| 130 | 137 |
| 131 // TODO(pkasting): Remove. | 138 // TODO(pkasting): Remove. |
| 132 InfoBarService* owner_; | 139 InfoBarService* owner_; |
| 133 | 140 |
| 134 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 141 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
| 135 }; | 142 }; |
| 136 | 143 |
| 137 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ | 144 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ |
| OLD | NEW |