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 -1, 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 content::WebContents* web_contents() { | 102 content::WebContents* web_contents() { |
| 103 return owner_ ? owner_->web_contents() : NULL; | 103 return owner_ ? owner_->web_contents() : NULL; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Return the icon to be shown for this InfoBar. If the returned Image is | |
| 107 // NULL, no icon is shown. | |
|
sky
2013/05/14 21:02:03
nit: document ownership here.
Is there a reason w
gone
2013/05/14 22:31:44
I think it's because the ResourceBundle caches eve
Peter Kasting
2013/05/15 00:18:52
How does returning an Image instead of an Image* m
| |
| 108 gfx::Image* GetIcon() const; | |
| 109 | |
| 106 protected: | 110 protected: |
| 107 // If |contents| is non-NULL, its active entry's unique ID will be stored | 111 // If |contents| is non-NULL, its active entry's unique ID will be stored |
| 108 // using StoreActiveEntryUniqueID automatically. | 112 // using StoreActiveEntryUniqueID automatically. |
| 109 explicit InfoBarDelegate(InfoBarService* infobar_service); | 113 explicit InfoBarDelegate(InfoBarService* infobar_service); |
| 110 | 114 |
| 111 // Store the unique id for the active entry in our WebContents, to be used | 115 // Store the unique id for the active entry in our WebContents, to be used |
| 112 // later upon navigation to determine if this InfoBarDelegate should be | 116 // later upon navigation to determine if this InfoBarDelegate should be |
| 113 // expired. | 117 // expired. |
| 114 void StoreActiveEntryUniqueID(); | 118 void StoreActiveEntryUniqueID(); |
| 115 | 119 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 128 // opened for. Used to help expire on navigations. | 132 // opened for. Used to help expire on navigations. |
| 129 int contents_unique_id_; | 133 int contents_unique_id_; |
| 130 | 134 |
| 131 // TODO(pkasting): Remove. | 135 // TODO(pkasting): Remove. |
| 132 InfoBarService* owner_; | 136 InfoBarService* owner_; |
| 133 | 137 |
| 134 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 138 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
| 135 }; | 139 }; |
| 136 | 140 |
| 137 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ | 141 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ |
| OLD | NEW |