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_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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 PopupBlockedInfoBarDelegate::AsPopupBlockedInfoBarDelegate() { | 55 PopupBlockedInfoBarDelegate::AsPopupBlockedInfoBarDelegate() { |
56 return this; | 56 return this; |
57 } | 57 } |
58 | 58 |
59 PopupBlockedInfoBarDelegate::PopupBlockedInfoBarDelegate( | 59 PopupBlockedInfoBarDelegate::PopupBlockedInfoBarDelegate( |
60 int num_popups, | 60 int num_popups, |
61 const GURL& url, | 61 const GURL& url, |
62 HostContentSettingsMap* map) | 62 HostContentSettingsMap* map) |
63 : ConfirmInfoBarDelegate(), num_popups_(num_popups), url_(url), map_(map) { | 63 : ConfirmInfoBarDelegate(), num_popups_(num_popups), url_(url), map_(map) { |
64 content_settings::SettingInfo setting_info; | 64 content_settings::SettingInfo setting_info; |
65 scoped_ptr<base::Value> setting( | 65 scoped_ptr<base::Value> setting = map->GetWebsiteSetting( |
66 map->GetWebsiteSetting( | 66 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string(), &setting_info); |
67 url, | |
68 url, | |
69 CONTENT_SETTINGS_TYPE_POPUPS, | |
70 std::string(), | |
71 &setting_info)); | |
72 can_show_popups_ = | 67 can_show_popups_ = |
73 setting_info.source != content_settings::SETTING_SOURCE_POLICY; | 68 setting_info.source != content_settings::SETTING_SOURCE_POLICY; |
74 } | 69 } |
75 | 70 |
76 base::string16 PopupBlockedInfoBarDelegate::GetMessageText() const { | 71 base::string16 PopupBlockedInfoBarDelegate::GetMessageText() const { |
77 return l10n_util::GetStringFUTF16Int(IDS_POPUPS_BLOCKED_INFOBAR_TEXT, | 72 return l10n_util::GetStringFUTF16Int(IDS_POPUPS_BLOCKED_INFOBAR_TEXT, |
78 num_popups_); | 73 num_popups_); |
79 } | 74 } |
80 | 75 |
81 int PopupBlockedInfoBarDelegate::GetButtons() const { | 76 int PopupBlockedInfoBarDelegate::GetButtons() const { |
(...skipping 22 matching lines...) Expand all Loading... |
104 PopupBlockerTabHelper::FromWebContents(web_contents); | 99 PopupBlockerTabHelper::FromWebContents(web_contents); |
105 DCHECK(popup_blocker_helper); | 100 DCHECK(popup_blocker_helper); |
106 PopupBlockerTabHelper::PopupIdMap blocked_popups = | 101 PopupBlockerTabHelper::PopupIdMap blocked_popups = |
107 popup_blocker_helper->GetBlockedPopupRequests(); | 102 popup_blocker_helper->GetBlockedPopupRequests(); |
108 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); | 103 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); |
109 it != blocked_popups.end(); ++it) | 104 it != blocked_popups.end(); ++it) |
110 popup_blocker_helper->ShowBlockedPopup(it->first); | 105 popup_blocker_helper->ShowBlockedPopup(it->first); |
111 | 106 |
112 return true; | 107 return true; |
113 } | 108 } |
OLD | NEW |