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/content_setting_bubble_model.h" | 5 #include "chrome/browser/content_setting_bubble_model.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/blocked_popup_container.h" | 10 #include "chrome/browser/blocked_popup_container.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { | 311 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { |
312 public: | 312 public: |
313 ContentSettingPopupBubbleModel(TabContents* tab_contents, Profile* profile, | 313 ContentSettingPopupBubbleModel(TabContents* tab_contents, Profile* profile, |
314 ContentSettingsType content_type) | 314 ContentSettingsType content_type) |
315 : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) { | 315 : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) { |
316 SetPopups(); | 316 SetPopups(); |
317 } | 317 } |
318 | 318 |
319 private: | 319 private: |
320 void SetPopups() { | 320 void SetPopups() { |
| 321 // check for crbug.com/53176 |
| 322 if (!tab_contents()->blocked_popup_container()) |
| 323 return; |
321 BlockedPopupContainer::BlockedContents blocked_contents; | 324 BlockedPopupContainer::BlockedContents blocked_contents; |
322 DCHECK(tab_contents()->blocked_popup_container()); | |
323 tab_contents()->blocked_popup_container()->GetBlockedContents( | 325 tab_contents()->blocked_popup_container()->GetBlockedContents( |
324 &blocked_contents); | 326 &blocked_contents); |
325 for (BlockedPopupContainer::BlockedContents::const_iterator | 327 for (BlockedPopupContainer::BlockedContents::const_iterator |
326 i(blocked_contents.begin()); i != blocked_contents.end(); ++i) { | 328 i(blocked_contents.begin()); i != blocked_contents.end(); ++i) { |
327 std::string title(UTF16ToUTF8((*i)->GetTitle())); | 329 std::string title(UTF16ToUTF8((*i)->GetTitle())); |
328 // The popup may not have committed a load yet, in which case it won't | 330 // The popup may not have committed a load yet, in which case it won't |
329 // have a URL or title. | 331 // have a URL or title. |
330 if (title.empty()) | 332 if (title.empty()) |
331 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); | 333 title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); |
332 PopupItem popup_item; | 334 PopupItem popup_item; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 bubble_content_.resource_identifiers.insert(resource_identifier); | 469 bubble_content_.resource_identifiers.insert(resource_identifier); |
468 } | 470 } |
469 | 471 |
470 void ContentSettingBubbleModel::Observe(NotificationType type, | 472 void ContentSettingBubbleModel::Observe(NotificationType type, |
471 const NotificationSource& source, | 473 const NotificationSource& source, |
472 const NotificationDetails& details) { | 474 const NotificationDetails& details) { |
473 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); | 475 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); |
474 DCHECK(source == Source<TabContents>(tab_contents_)); | 476 DCHECK(source == Source<TabContents>(tab_contents_)); |
475 tab_contents_ = NULL; | 477 tab_contents_ = NULL; |
476 } | 478 } |
OLD | NEW |