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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 HostContentSettingsMap* map) | 74 HostContentSettingsMap* map) |
75 : ConfirmInfoBarDelegate(), num_popups_(num_popups), url_(url), map_(map) { | 75 : ConfirmInfoBarDelegate(), num_popups_(num_popups), url_(url), map_(map) { |
76 content_settings::SettingInfo setting_info; | 76 content_settings::SettingInfo setting_info; |
77 std::unique_ptr<base::Value> setting = map->GetWebsiteSetting( | 77 std::unique_ptr<base::Value> setting = map->GetWebsiteSetting( |
78 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string(), &setting_info); | 78 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string(), &setting_info); |
79 can_show_popups_ = | 79 can_show_popups_ = |
80 setting_info.source != content_settings::SETTING_SOURCE_POLICY; | 80 setting_info.source != content_settings::SETTING_SOURCE_POLICY; |
81 } | 81 } |
82 | 82 |
83 base::string16 PopupBlockedInfoBarDelegate::GetMessageText() const { | 83 base::string16 PopupBlockedInfoBarDelegate::GetMessageText() const { |
84 return l10n_util::GetStringFUTF16Int(IDS_POPUPS_BLOCKED_INFOBAR_TEXT, | 84 return l10n_util::GetPluralStringFUTF16(IDS_POPUPS_BLOCKED_INFOBAR_TEXT, |
85 num_popups_); | 85 num_popups_); |
86 } | 86 } |
87 | 87 |
88 int PopupBlockedInfoBarDelegate::GetButtons() const { | 88 int PopupBlockedInfoBarDelegate::GetButtons() const { |
89 if (!can_show_popups_) | 89 if (!can_show_popups_) |
90 return 0; | 90 return 0; |
91 | 91 |
92 return BUTTON_OK; | 92 return BUTTON_OK; |
93 } | 93 } |
94 | 94 |
95 base::string16 PopupBlockedInfoBarDelegate::GetButtonLabel( | 95 base::string16 PopupBlockedInfoBarDelegate::GetButtonLabel( |
(...skipping 15 matching lines...) Expand all Loading... |
111 PopupBlockerTabHelper::FromWebContents(web_contents); | 111 PopupBlockerTabHelper::FromWebContents(web_contents); |
112 DCHECK(popup_blocker_helper); | 112 DCHECK(popup_blocker_helper); |
113 PopupBlockerTabHelper::PopupIdMap blocked_popups = | 113 PopupBlockerTabHelper::PopupIdMap blocked_popups = |
114 popup_blocker_helper->GetBlockedPopupRequests(); | 114 popup_blocker_helper->GetBlockedPopupRequests(); |
115 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); | 115 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); |
116 it != blocked_popups.end(); ++it) | 116 it != blocked_popups.end(); ++it) |
117 popup_blocker_helper->ShowBlockedPopup(it->first); | 117 popup_blocker_helper->ShowBlockedPopup(it->first); |
118 | 118 |
119 return true; | 119 return true; |
120 } | 120 } |
OLD | NEW |