| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 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 // Implementation of BlockedPopupContainer and its corresponding View | 5 // Implementation of BlockedPopupContainer and its corresponding View |
| 6 // class. The BlockedPopupContainer is the sort of Model class which owns the | 6 // class. The BlockedPopupContainer is the sort of Model class which owns the |
| 7 // blocked popups' TabContents (but like most Chromium interface code, it there | 7 // blocked popups' TabContents (but like most Chromium interface code, it there |
| 8 // isn't a strict Model/View separation), and BlockedPopupContainerView | 8 // isn't a strict Model/View separation), and BlockedPopupContainerView |
| 9 // presents the user interface controls, creates and manages the popup menu. | 9 // presents the user interface controls, creates and manages the popup menu. |
| 10 | 10 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 CloseAllPopups(); | 291 CloseAllPopups(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 int BlockedPopupContainer::GetTabContentsCount() const { | 294 int BlockedPopupContainer::GetTabContentsCount() const { |
| 295 return blocked_popups_.size(); | 295 return blocked_popups_.size(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 std::wstring BlockedPopupContainer::GetDisplayStringForItem(int index) { | 298 std::wstring BlockedPopupContainer::GetDisplayStringForItem(int index) { |
| 299 const GURL& url = blocked_popups_[index].first->GetURL().GetOrigin(); | 299 const GURL& url = blocked_popups_[index].first->GetURL().GetOrigin(); |
| 300 | 300 |
| 301 std::wstring label = | 301 std::wstring label = l10n_util::GetStringF( |
| 302 l10n_util::GetStringF(IDS_POPUP_TITLE_FORMAT, | 302 IDS_POPUP_TITLE_FORMAT, |
| 303 UTF8ToWide(url.possibly_invalid_spec()), | 303 UTF8ToWide(url.possibly_invalid_spec()), |
| 304 blocked_popups_[index].first->GetTitle()); | 304 UTF16ToWideHack(blocked_popups_[index].first->GetTitle())); |
| 305 return label; | 305 return label; |
| 306 } | 306 } |
| 307 | 307 |
| 308 void BlockedPopupContainer::CloseAllPopups() { | 308 void BlockedPopupContainer::CloseAllPopups() { |
| 309 CloseEachTabContents(); | 309 CloseEachTabContents(); |
| 310 owner_->PopupNotificationVisibilityChanged(false); | 310 owner_->PopupNotificationVisibilityChanged(false); |
| 311 container_view_->UpdatePopupCountLabel(); | 311 container_view_->UpdatePopupCountLabel(); |
| 312 HideSelf(); | 312 HideSelf(); |
| 313 } | 313 } |
| 314 | 314 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 498 |
| 499 void BlockedPopupContainer::CloseEachTabContents() { | 499 void BlockedPopupContainer::CloseEachTabContents() { |
| 500 while (!blocked_popups_.empty()) { | 500 while (!blocked_popups_.empty()) { |
| 501 blocked_popups_.back().first->set_delegate(NULL); | 501 blocked_popups_.back().first->set_delegate(NULL); |
| 502 blocked_popups_.back().first->CloseContents(); | 502 blocked_popups_.back().first->CloseContents(); |
| 503 blocked_popups_.pop_back(); | 503 blocked_popups_.pop_back(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 blocked_popups_.clear(); | 506 blocked_popups_.clear(); |
| 507 } | 507 } |
| OLD | NEW |