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_API_INFOBARS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_API_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 "webkit/glue/window_open_disposition.h" | 10 #include "webkit/glue/window_open_disposition.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 AsRegisterProtocolHandlerInfoBarDelegate(); | 107 AsRegisterProtocolHandlerInfoBarDelegate(); |
108 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); | 108 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); |
109 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate(); | 109 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate(); |
110 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); | 110 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); |
111 | 111 |
112 protected: | 112 protected: |
113 // If |contents| is non-NULL, its active entry's unique ID will be stored | 113 // If |contents| is non-NULL, its active entry's unique ID will be stored |
114 // using StoreActiveEntryUniqueID automatically. | 114 // using StoreActiveEntryUniqueID automatically. |
115 explicit InfoBarDelegate(InfoBarService* infobar_service); | 115 explicit InfoBarDelegate(InfoBarService* infobar_service); |
116 | 116 |
117 // Store the unique id for the active entry in the specified WebContents, to | 117 // Store the unique id for the active entry in our WebContents, to be used |
118 // be used later upon navigation to determine if this InfoBarDelegate should | 118 // later upon navigation to determine if this InfoBarDelegate should be |
119 // be expired from |contents_|. | 119 // expired. |
120 void StoreActiveEntryUniqueID(InfoBarService* infobar_service); | 120 void StoreActiveEntryUniqueID(); |
121 | 121 |
122 // Direct accessors for subclasses that need to do something special. | |
123 int contents_unique_id() const { return contents_unique_id_; } | 122 int contents_unique_id() const { return contents_unique_id_; } |
124 void set_contents_unique_id(int contents_unique_id) { | |
125 contents_unique_id_ = contents_unique_id; | |
126 } | |
127 | 123 |
128 // Returns true if the navigation is to a new URL or a reload occured. | 124 // Returns true if the navigation is to a new URL or a reload occured. |
129 virtual bool ShouldExpireInternal( | 125 virtual bool ShouldExpireInternal( |
130 const content::LoadCommittedDetails& details) const; | 126 const content::LoadCommittedDetails& details) const; |
131 | 127 |
132 // Removes ourself from |owner_| if we haven't already been removed. | 128 // Removes ourself from |owner_| if we haven't already been removed. |
133 // TODO(pkasting): Move to InfoBar. | 129 // TODO(pkasting): Move to InfoBar. |
134 void RemoveSelf(); | 130 void RemoveSelf(); |
135 | 131 |
136 private: | 132 private: |
137 // The unique id of the active NavigationEntry of the WebContents that we were | 133 // The unique id of the active NavigationEntry of the WebContents that we were |
138 // opened for. Used to help expire on navigations. | 134 // opened for. Used to help expire on navigations. |
139 int contents_unique_id_; | 135 int contents_unique_id_; |
140 | 136 |
141 // TODO(pkasting): Remove. | 137 // TODO(pkasting): Remove. |
142 InfoBarService* owner_; | 138 InfoBarService* owner_; |
143 | 139 |
144 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 140 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
145 }; | 141 }; |
146 | 142 |
147 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ | 143 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ |
OLD | NEW |