| 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 #ifndef CHROME_BROWSER_BLOCKED_POPUP_CONTAINER_H_ | 10 #ifndef CHROME_BROWSER_BLOCKED_POPUP_CONTAINER_H_ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Getting here will take multiple patches. | 74 // Getting here will take multiple patches. |
| 75 class BlockedPopupContainer : public TabContentsDelegate, | 75 class BlockedPopupContainer : public TabContentsDelegate, |
| 76 public NotificationObserver { | 76 public NotificationObserver { |
| 77 public: | 77 public: |
| 78 // Creates a BlockedPopupContainer, anchoring the container to the lower | 78 // Creates a BlockedPopupContainer, anchoring the container to the lower |
| 79 // right corner. | 79 // right corner. |
| 80 static BlockedPopupContainer* Create(TabContents* owner, Profile* profile); | 80 static BlockedPopupContainer* Create(TabContents* owner, Profile* profile); |
| 81 | 81 |
| 82 static void RegisterUserPrefs(PrefService* prefs); | 82 static void RegisterUserPrefs(PrefService* prefs); |
| 83 | 83 |
| 84 // Returns the profile associated with the Browser this container exists in. |
| 85 Profile* profile() const { return profile_; } |
| 86 |
| 84 // Sets this BlockedPopupContainer's view. BlockedPopupContainer now owns | 87 // Sets this BlockedPopupContainer's view. BlockedPopupContainer now owns |
| 85 // |view| and is responsible for calling Destroy() on it. | 88 // |view| and is responsible for calling Destroy() on it. |
| 86 void set_view(BlockedPopupContainerView* view) { view_ = view; } | 89 void set_view(BlockedPopupContainerView* view) { view_ = view; } |
| 87 | 90 |
| 88 // Adds a popup to this container. |bounds| are the window bounds requested by | 91 // Adds a popup to this container. |bounds| are the window bounds requested by |
| 89 // the popup window. | 92 // the popup window. |
| 90 void AddTabContents(TabContents* tab_contents, | 93 void AddTabContents(TabContents* tab_contents, |
| 91 const gfx::Rect& bounds, | 94 const gfx::Rect& bounds, |
| 92 const std::string& host); | 95 const std::string& host); |
| 93 | 96 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 225 |
| 223 private: | 226 private: |
| 224 friend class BlockedPopupContainerImpl; | 227 friend class BlockedPopupContainerImpl; |
| 225 friend class BlockedPopupContainerTest; | 228 friend class BlockedPopupContainerTest; |
| 226 friend class BlockedPopupContainerControllerTest; | 229 friend class BlockedPopupContainerControllerTest; |
| 227 | 230 |
| 228 // string is hostname. | 231 // string is hostname. |
| 229 typedef std::set<std::string> Whitelist; | 232 typedef std::set<std::string> Whitelist; |
| 230 | 233 |
| 231 // Creates a container for a certain TabContents: | 234 // Creates a container for a certain TabContents: |
| 232 BlockedPopupContainer(TabContents* owner, PrefService* prefs); | 235 BlockedPopupContainer(TabContents* owner, Profile* profile); |
| 233 | 236 |
| 234 // Either hides the view if there are no popups, or updates the label if | 237 // Either hides the view if there are no popups, or updates the label if |
| 235 // there are. | 238 // there are. |
| 236 void UpdateView(); | 239 void UpdateView(); |
| 237 | 240 |
| 238 // Overridden from notificationObserver: | 241 // Overridden from notificationObserver: |
| 239 virtual void Observe(NotificationType type, | 242 virtual void Observe(NotificationType type, |
| 240 const NotificationSource& source, | 243 const NotificationSource& source, |
| 241 const NotificationDetails& details); | 244 const NotificationDetails& details); |
| 242 | 245 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 260 | 263 |
| 261 // Information about all unblocked popups. | 264 // Information about all unblocked popups. |
| 262 UnblockedPopups unblocked_popups_; | 265 UnblockedPopups unblocked_popups_; |
| 263 | 266 |
| 264 // Information about all popup hosts. | 267 // Information about all popup hosts. |
| 265 PopupHosts popup_hosts_; | 268 PopupHosts popup_hosts_; |
| 266 | 269 |
| 267 // Our platform specific view. | 270 // Our platform specific view. |
| 268 BlockedPopupContainerView* view_; | 271 BlockedPopupContainerView* view_; |
| 269 | 272 |
| 273 // The profile for the browser associated with the container. |
| 274 Profile* profile_; |
| 275 |
| 270 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedPopupContainer); | 276 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedPopupContainer); |
| 271 }; | 277 }; |
| 272 | 278 |
| 273 #endif // CHROME_BROWSER_BLOCKED_POPUP_CONTAINER_H_ | 279 #endif // CHROME_BROWSER_BLOCKED_POPUP_CONTAINER_H_ |
| OLD | NEW |