| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/blocked_popup_container.h" | 5 #include "chrome/browser/blocked_popup_container.h" |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents.h" | 7 #include "chrome/browser/tab_contents/tab_contents.h" |
| 8 #include "gfx/rect.h" |
| 8 | 9 |
| 9 // static | 10 // static |
| 10 const size_t BlockedPopupContainer::kImpossibleNumberOfPopups = 30; | 11 const size_t BlockedPopupContainer::kImpossibleNumberOfPopups = 30; |
| 11 | 12 |
| 13 struct BlockedPopupContainer::BlockedPopup { |
| 14 BlockedPopup(TabContents* tab_contents, |
| 15 const gfx::Rect& bounds) |
| 16 : tab_contents(tab_contents), bounds(bounds) { |
| 17 } |
| 18 |
| 19 TabContents* tab_contents; |
| 20 gfx::Rect bounds; |
| 21 }; |
| 22 |
| 12 BlockedPopupContainer::BlockedPopupContainer(TabContents* owner) | 23 BlockedPopupContainer::BlockedPopupContainer(TabContents* owner) |
| 13 : owner_(owner) { | 24 : owner_(owner) { |
| 14 } | 25 } |
| 15 | 26 |
| 16 void BlockedPopupContainer::AddTabContents(TabContents* tab_contents, | 27 void BlockedPopupContainer::AddTabContents(TabContents* tab_contents, |
| 17 const gfx::Rect& bounds) { | 28 const gfx::Rect& bounds) { |
| 18 if (blocked_popups_.size() == (kImpossibleNumberOfPopups - 1)) { | 29 if (blocked_popups_.size() == (kImpossibleNumberOfPopups - 1)) { |
| 19 delete tab_contents; | 30 delete tab_contents; |
| 20 LOG(INFO) << "Warning: Renderer is sending more popups to us than should " | 31 LOG(INFO) << "Warning: Renderer is sending more popups to us than should " |
| 21 "be possible. Renderer compromised?"; | 32 "be possible. Renderer compromised?"; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 122 } |
| 112 | 123 |
| 113 bool BlockedPopupContainer::IsPopup(const TabContents* source) const { | 124 bool BlockedPopupContainer::IsPopup(const TabContents* source) const { |
| 114 return true; | 125 return true; |
| 115 } | 126 } |
| 116 | 127 |
| 117 TabContents* BlockedPopupContainer::GetConstrainingContents( | 128 TabContents* BlockedPopupContainer::GetConstrainingContents( |
| 118 TabContents* source) { | 129 TabContents* source) { |
| 119 return owner_; | 130 return owner_; |
| 120 } | 131 } |
| OLD | NEW |