| 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.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 InfoBarButton button) const { | 68 InfoBarButton button) const { |
| 69 return l10n_util::GetStringUTF16(IDS_POPUPS_BLOCKED_INFOBAR_BUTTON_SHOW); | 69 return l10n_util::GetStringUTF16(IDS_POPUPS_BLOCKED_INFOBAR_BUTTON_SHOW); |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool PopupBlockedInfoBarDelegate::Accept() { | 72 bool PopupBlockedInfoBarDelegate::Accept() { |
| 73 // Create exceptions. | 73 // Create exceptions. |
| 74 const GURL& url = web_contents()->GetURL(); | 74 const GURL& url = web_contents()->GetURL(); |
| 75 Profile* profile = Profile::FromBrowserContext( | 75 Profile* profile = Profile::FromBrowserContext( |
| 76 web_contents()->GetBrowserContext()); | 76 web_contents()->GetBrowserContext()); |
| 77 profile->GetHostContentSettingsMap()->AddExceptionForURL( | 77 profile->GetHostContentSettingsMap()->AddExceptionForURL( |
| 78 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string(), | 78 url, url, CONTENT_SETTINGS_TYPE_POPUPS, CONTENT_SETTING_ALLOW); |
| 79 CONTENT_SETTING_ALLOW); | |
| 80 | 79 |
| 81 // Launch popups. | 80 // Launch popups. |
| 82 PopupBlockerTabHelper* popup_blocker_helper = | 81 PopupBlockerTabHelper* popup_blocker_helper = |
| 83 PopupBlockerTabHelper::FromWebContents(web_contents()); | 82 PopupBlockerTabHelper::FromWebContents(web_contents()); |
| 84 DCHECK(popup_blocker_helper); | 83 DCHECK(popup_blocker_helper); |
| 85 PopupBlockerTabHelper::PopupIdMap blocked_popups = | 84 PopupBlockerTabHelper::PopupIdMap blocked_popups = |
| 86 popup_blocker_helper->GetBlockedPopupRequests(); | 85 popup_blocker_helper->GetBlockedPopupRequests(); |
| 87 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); | 86 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); |
| 88 it != blocked_popups.end(); ++it) | 87 it != blocked_popups.end(); ++it) |
| 89 popup_blocker_helper->ShowBlockedPopup(it->first); | 88 popup_blocker_helper->ShowBlockedPopup(it->first); |
| 90 | 89 |
| 91 return true; | 90 return true; |
| 92 } | 91 } |
| 93 | 92 |
| OLD | NEW |