diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-03 16:47:10 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-03 16:47:10 +0000 |
commit | bdc586d588b98b249e675b1d7c5493bb576a916e (patch) | |
tree | 9241bb3fd0a7ad7e863dbb5f926d2125b72f7f63 /chrome/browser/blocked_popup_container.cc | |
parent | 5590b304d9f814e7be2f867270e962e582a48a34 (diff) | |
download | chromium_src-bdc586d588b98b249e675b1d7c5493bb576a916e.zip chromium_src-bdc586d588b98b249e675b1d7c5493bb576a916e.tar.gz chromium_src-bdc586d588b98b249e675b1d7c5493bb576a916e.tar.bz2 |
Rewrite chunks of the blocked popup container code:
* Fix an off-by-one error in menu rendering if a renderer actually sent us kImpossibleNumberOfPopups.
* Be clearer and stricter about item indexes and sanity checking. Hopefully, this or the previous item fix a crash we saw (no bug filed).
* Add notice support (as much as exists for Windows) to GTK and Mac.
* Make the implementations in the three platforms mirror each other a little more precisely.
* Fix (expected, actual) mis-ordering in Mac unittest.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/260005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/blocked_popup_container.cc')
-rw-r--r-- | chrome/browser/blocked_popup_container.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome/browser/blocked_popup_container.cc b/chrome/browser/blocked_popup_container.cc index c82998b..4744fb5 100644 --- a/chrome/browser/blocked_popup_container.cc +++ b/chrome/browser/blocked_popup_container.cc @@ -58,7 +58,7 @@ void BlockedPopupContainer::AddTabContents(TabContents* tab_contents, unblocked_popups_[tab_contents] = host; } else { - if (blocked_popups_.size() >= kImpossibleNumberOfPopups) { + if (blocked_popups_.size() == (kImpossibleNumberOfPopups - 1)) { delete tab_contents; LOG(INFO) << "Warning: Renderer is sending more popups to us than should " "be possible. Renderer compromised?"; @@ -125,8 +125,9 @@ void BlockedPopupContainer::AddBlockedNotice(const GURL& url, owner_->PopupNotificationVisibilityChanged(true); } -void BlockedPopupContainer::GetHostAndReasonForNotice( - size_t index, std::string* host, string16* reason) const { +void BlockedPopupContainer::GetHostAndReasonForNotice(size_t index, + std::string* host, + string16* reason) const { DCHECK(host); DCHECK(reason); *host = blocked_notices_[index].url_.host(); @@ -142,8 +143,7 @@ size_t BlockedPopupContainer::GetBlockedNoticeCount() const { } bool BlockedPopupContainer::IsHostWhitelisted(size_t index) const { - PopupHosts::const_iterator i(ConvertHostIndexToIterator(index)); - return (i == popup_hosts_.end()) ? false : i->second; + return ConvertHostIndexToIterator(index)->second; } void BlockedPopupContainer::ToggleWhitelistingForHost(size_t index) { |