OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 // Defines the public interface for the blocked popup notifications. This | 5 // Defines the public interface for the blocked popup notifications. This |
6 // interface should only be used by TabContents. Users and subclasses of | 6 // interface should only be used by TabContents. Users and subclasses of |
7 // TabContents should use the appropriate methods on TabContents to access | 7 // TabContents should use the appropriate methods on TabContents to access |
8 // information about blocked popups. | 8 // information about blocked popups. |
9 | 9 |
10 // TODO(idanan): Rename class to BlockedContentContainer. | 10 // TODO(idanan): Rename class to BlockedContentContainer. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Sets the text in the blocked popup label. | 46 // Sets the text in the blocked popup label. |
47 virtual void UpdateLabel() = 0; | 47 virtual void UpdateLabel() = 0; |
48 | 48 |
49 // Hides the blocked popup view / Animates the blocked popup view out. | 49 // Hides the blocked popup view / Animates the blocked popup view out. |
50 virtual void HideView() = 0; | 50 virtual void HideView() = 0; |
51 | 51 |
52 // Called by the BlockedPopupContainer that owns us. Destroys the view or | 52 // Called by the BlockedPopupContainer that owns us. Destroys the view or |
53 // starts a delayed Task to destroy the View at some later time. | 53 // starts a delayed Task to destroy the View at some later time. |
54 virtual void Destroy() = 0; | 54 virtual void Destroy() = 0; |
55 protected: | |
56 ~BlockedPopupContainerView() {} | |
57 }; | 55 }; |
58 | 56 |
59 // Takes ownership of TabContents that are unrequested popup windows and | 57 // Takes ownership of TabContents that are unrequested popup windows and |
60 // presents an interface to the user for launching them. (Or never showing them | 58 // presents an interface to the user for launching them. (Or never showing them |
61 // again). This class contains all the cross-platform bits that can be used in | 59 // again). This class contains all the cross-platform bits that can be used in |
62 // all ports. | 60 // all ports. |
63 // | 61 // |
64 // +- BlockedPopupContainer ---+ +- BlockedPopupContainerView -----+ | 62 // +- BlockedPopupContainer ---+ +- BlockedPopupContainerView -----+ |
65 // | All model logic | +--->| Abstract cross platform | | 63 // | All model logic | +--->| Abstract cross platform | |
66 // | | | | interface | | 64 // | | | | interface | |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Overridden from TabContentsDelegate: | 139 // Overridden from TabContentsDelegate: |
142 | 140 |
143 // Forwards OpenURLFromTab to our |owner_|. | 141 // Forwards OpenURLFromTab to our |owner_|. |
144 virtual void OpenURLFromTab(TabContents* source, | 142 virtual void OpenURLFromTab(TabContents* source, |
145 const GURL& url, const GURL& referrer, | 143 const GURL& url, const GURL& referrer, |
146 WindowOpenDisposition disposition, | 144 WindowOpenDisposition disposition, |
147 PageTransition::Type transition); | 145 PageTransition::Type transition); |
148 | 146 |
149 // Ignored; BlockedPopupContainer doesn't display a throbber. | 147 // Ignored; BlockedPopupContainer doesn't display a throbber. |
150 virtual void NavigationStateChanged(const TabContents* source, | 148 virtual void NavigationStateChanged(const TabContents* source, |
151 unsigned changed_flags) {} | 149 unsigned changed_flags) { } |
152 | 150 |
153 // Forwards AddNewContents to our |owner_|. | 151 // Forwards AddNewContents to our |owner_|. |
154 virtual void AddNewContents(TabContents* source, | 152 virtual void AddNewContents(TabContents* source, |
155 TabContents* new_contents, | 153 TabContents* new_contents, |
156 WindowOpenDisposition disposition, | 154 WindowOpenDisposition disposition, |
157 const gfx::Rect& initial_position, | 155 const gfx::Rect& initial_position, |
158 bool user_gesture); | 156 bool user_gesture); |
159 | 157 |
160 // Ignore activation requests from the TabContents we're blocking. | 158 // Ignore activation requests from the TabContents we're blocking. |
161 virtual void ActivateContents(TabContents* contents) {} | 159 virtual void ActivateContents(TabContents* contents) { } |
162 | 160 |
163 // Ignored; BlockedPopupContainer doesn't display a throbber. | 161 // Ignored; BlockedPopupContainer doesn't display a throbber. |
164 virtual void LoadingStateChanged(TabContents* source) {} | 162 virtual void LoadingStateChanged(TabContents* source) { } |
165 | 163 |
166 // Removes |source| from our internal list of blocked popups. | 164 // Removes |source| from our internal list of blocked popups. |
167 virtual void CloseContents(TabContents* source); | 165 virtual void CloseContents(TabContents* source); |
168 | 166 |
169 // Changes the opening rectangle associated with |source|. | 167 // Changes the opening rectangle associated with |source|. |
170 virtual void MoveContents(TabContents* source, const gfx::Rect& new_bounds); | 168 virtual void MoveContents(TabContents* source, const gfx::Rect& new_bounds); |
171 | 169 |
172 // Always returns true. | 170 // Always returns true. |
173 virtual bool IsPopup(TabContents* source); | 171 virtual bool IsPopup(TabContents* source); |
174 | 172 |
175 // Returns our |owner_|. | 173 // Returns our |owner_|. |
176 virtual TabContents* GetConstrainingContents(TabContents* source); | 174 virtual TabContents* GetConstrainingContents(TabContents* source); |
177 | 175 |
178 // Ignored; BlockedPopupContainer doesn't display a toolbar. | 176 // Ignored; BlockedPopupContainer doesn't display a toolbar. |
179 virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {} | 177 virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) { } |
180 | 178 |
181 // Ignored; BlockedPopupContainer doesn't display a bookmarking star. | 179 // Ignored; BlockedPopupContainer doesn't display a bookmarking star. |
182 virtual void URLStarredChanged(TabContents* source, bool starred) {} | 180 virtual void URLStarredChanged(TabContents* source, bool starred) { } |
183 | 181 |
184 // Ignored; BlockedPopupContainer doesn't display a URL bar. | 182 // Ignored; BlockedPopupContainer doesn't display a URL bar. |
185 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} | 183 virtual void UpdateTargetURL(TabContents* source, const GURL& url) { } |
186 | 184 |
187 // A number larger than the internal popup count on the Renderer; meant for | 185 // A number larger than the internal popup count on the Renderer; meant for |
188 // preventing a compromised renderer from exhausting GDI memory by spawning | 186 // preventing a compromised renderer from exhausting GDI memory by spawning |
189 // infinite windows. | 187 // infinite windows. |
190 static const size_t kImpossibleNumberOfPopups = 30; | 188 static const size_t kImpossibleNumberOfPopups = 30; |
191 | 189 |
192 protected: | 190 protected: |
193 struct BlockedPopup { | 191 struct BlockedPopup { |
194 BlockedPopup(TabContents* tab_contents, | 192 BlockedPopup(TabContents* tab_contents, |
195 const gfx::Rect& bounds, | 193 const gfx::Rect& bounds, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Our platform specific view. | 276 // Our platform specific view. |
279 BlockedPopupContainerView* view_; | 277 BlockedPopupContainerView* view_; |
280 | 278 |
281 // The profile for the browser associated with the container. | 279 // The profile for the browser associated with the container. |
282 Profile* profile_; | 280 Profile* profile_; |
283 | 281 |
284 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedPopupContainer); | 282 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedPopupContainer); |
285 }; | 283 }; |
286 | 284 |
287 #endif // CHROME_BROWSER_BLOCKED_POPUP_CONTAINER_H_ | 285 #endif // CHROME_BROWSER_BLOCKED_POPUP_CONTAINER_H_ |
OLD | NEW |