diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-02 10:40:49 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-02 10:40:49 +0000 |
commit | 8cc8d4914c363a3308fdbae1415e2a3fbbce8e9e (patch) | |
tree | f2b38543aa09fd9945341376bfca465b7efbbf92 /chrome/browser/views/content_blocked_bubble_contents.h | |
parent | 458788376076d57d182ca22060b335d2e5f2e18f (diff) | |
download | chromium_src-8cc8d4914c363a3308fdbae1415e2a3fbbce8e9e.zip chromium_src-8cc8d4914c363a3308fdbae1415e2a3fbbce8e9e.tar.gz chromium_src-8cc8d4914c363a3308fdbae1415e2a3fbbce8e9e.tar.bz2 |
Wire popup blocking UI to the new machinery and port over the user's old whitelist.
Notably, this removes the UI entirely for Mac and Linux. We need to rebuild it.
This also guts the old system's testing, since most of it disappeared or changed radically. We should test the new stuff. I will file a followup bug for that.
There are various tiny edge cases, like if you click the address bar icon really quickly, sometimes you'll get popups without any title yet, which makes them leave gaps in the bubble that appears. We can fix that sort of thing. The critical bit I tried to ensure was that we never try to open a dead popup or use a dead TabContents, no matter what.
BUG=33314
TEST=Go visit some sites with popups and play with things
Review URL: http://codereview.chromium.org/562013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/content_blocked_bubble_contents.h')
-rw-r--r-- | chrome/browser/views/content_blocked_bubble_contents.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/chrome/browser/views/content_blocked_bubble_contents.h b/chrome/browser/views/content_blocked_bubble_contents.h index 7b7c434..f7ffe1b 100644 --- a/chrome/browser/views/content_blocked_bubble_contents.h +++ b/chrome/browser/views/content_blocked_bubble_contents.h @@ -5,9 +5,11 @@ #ifndef CHROME_BROWSER_VIEWS_CONTENT_BLOCKED_BUBBLE_CONTENTS_H_ #define CHROME_BROWSER_VIEWS_CONTENT_BLOCKED_BUBBLE_CONTENTS_H_ +#include <map> #include <string> #include "chrome/common/content_settings_types.h" +#include "chrome/common/notification_registrar.h" #include "views/controls/button/button.h" #include "views/controls/link.h" @@ -23,6 +25,7 @@ class InfoBubble; class Profile; +class TabContents; namespace views { class NativeButton; @@ -31,14 +34,23 @@ class RadioButton; class ContentBlockedBubbleContents : public views::View, public views::ButtonListener, - public views::LinkController { + public views::LinkController, + public NotificationObserver { public: ContentBlockedBubbleContents(ContentSettingsType content_type, const std::string& host, const std::wstring& display_host, - Profile* profile); + Profile* profile, + TabContents* tab_contents); virtual ~ContentBlockedBubbleContents(); + // Sets |info_bubble_|, so we can close the bubble if needed. The caller owns + // the bubble and must keep it alive. + void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; } + + private: + typedef std::map<views::Link*, TabContents*> PopupLinks; + // Overridden from views::View: virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); @@ -48,11 +60,11 @@ class ContentBlockedBubbleContents : public views::View, // views::LinkController: virtual void LinkActivated(views::Link* source, int event_flags); - // Sets |info_bubble_|, so we can close the bubble if needed. The caller owns - // the bubble and must keep it alive. - void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; } + // NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); - private: // Creates the child views. void InitControlLayout(); @@ -66,11 +78,18 @@ class ContentBlockedBubbleContents : public views::View, // The active profile. Profile* profile_; + // The active tab contents. + TabContents* tab_contents_; + + // A registrar for listening for TAB_CONTENTS_DESTROYED notifications. + NotificationRegistrar registrar_; + // The InfoBubble holding us. InfoBubble* info_bubble_; // Some of our controls, so we can tell what's been clicked when we get a // message. + PopupLinks popup_links_; views::RadioButton* allow_radio_; views::RadioButton* block_radio_; views::NativeButton* close_button_; |