OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/android/content_settings/popup_blocked_infobar_deleg
ate.h" | 5 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg
ate.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 base::string16 PopupBlockedInfoBarDelegate::GetButtonLabel( | 86 base::string16 PopupBlockedInfoBarDelegate::GetButtonLabel( |
87 InfoBarButton button) const { | 87 InfoBarButton button) const { |
88 return l10n_util::GetStringUTF16(IDS_POPUPS_BLOCKED_INFOBAR_BUTTON_SHOW); | 88 return l10n_util::GetStringUTF16(IDS_POPUPS_BLOCKED_INFOBAR_BUTTON_SHOW); |
89 } | 89 } |
90 | 90 |
91 bool PopupBlockedInfoBarDelegate::Accept() { | 91 bool PopupBlockedInfoBarDelegate::Accept() { |
92 DCHECK(can_show_popups_); | 92 DCHECK(can_show_popups_); |
93 | 93 |
94 // Create exceptions. | 94 // Create exceptions. |
95 map_->AddExceptionForURL( | 95 map_->SetNarrowestContentSetting(url_, url_, CONTENT_SETTINGS_TYPE_POPUPS, |
96 url_, url_, CONTENT_SETTINGS_TYPE_POPUPS, CONTENT_SETTING_ALLOW); | 96 CONTENT_SETTING_ALLOW); |
97 | 97 |
98 // Launch popups. | 98 // Launch popups. |
99 content::WebContents* web_contents = | 99 content::WebContents* web_contents = |
100 InfoBarService::WebContentsFromInfoBar(infobar()); | 100 InfoBarService::WebContentsFromInfoBar(infobar()); |
101 PopupBlockerTabHelper* popup_blocker_helper = | 101 PopupBlockerTabHelper* popup_blocker_helper = |
102 PopupBlockerTabHelper::FromWebContents(web_contents); | 102 PopupBlockerTabHelper::FromWebContents(web_contents); |
103 DCHECK(popup_blocker_helper); | 103 DCHECK(popup_blocker_helper); |
104 PopupBlockerTabHelper::PopupIdMap blocked_popups = | 104 PopupBlockerTabHelper::PopupIdMap blocked_popups = |
105 popup_blocker_helper->GetBlockedPopupRequests(); | 105 popup_blocker_helper->GetBlockedPopupRequests(); |
106 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); | 106 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); |
107 it != blocked_popups.end(); ++it) | 107 it != blocked_popups.end(); ++it) |
108 popup_blocker_helper->ShowBlockedPopup(it->first); | 108 popup_blocker_helper->ShowBlockedPopup(it->first); |
109 | 109 |
110 return true; | 110 return true; |
111 } | 111 } |
OLD | NEW |