OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/blocked_content/blocked_content_tab_helper.h" | 5 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.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/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // page. For this reason, we can't use GetURL() to get the opener URL, | 103 // page. For this reason, we can't use GetURL() to get the opener URL, |
104 // because it returns the active entry. | 104 // because it returns the active entry. |
105 NavigationEntry* entry = | 105 NavigationEntry* entry = |
106 web_contents()->GetController().GetLastCommittedEntry(); | 106 web_contents()->GetController().GetLastCommittedEntry(); |
107 GURL creator = entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); | 107 GURL creator = entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); |
108 Profile* profile = | 108 Profile* profile = |
109 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 109 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
110 | 110 |
111 if (creator.is_valid() && | 111 if (creator.is_valid() && |
112 profile->GetHostContentSettingsMap()->GetContentSetting( | 112 profile->GetHostContentSettingsMap()->GetContentSetting( |
113 creator, | 113 creator, creator, CONTENT_SETTINGS_TYPE_POPUPS, std::string()) == |
114 creator, | 114 CONTENT_SETTING_ALLOW) { |
115 CONTENT_SETTINGS_TYPE_POPUPS, | |
116 "") == CONTENT_SETTING_ALLOW) { | |
117 content::WebContentsDelegate* delegate = web_contents()->GetDelegate(); | 115 content::WebContentsDelegate* delegate = web_contents()->GetDelegate(); |
118 if (delegate) { | 116 if (delegate) { |
119 delegate->AddNewContents(web_contents(), | 117 delegate->AddNewContents(web_contents(), |
120 new_contents, | 118 new_contents, |
121 disposition, | 119 disposition, |
122 initial_pos, | 120 initial_pos, |
123 true, // user_gesture | 121 true, // user_gesture |
124 NULL); | 122 NULL); |
125 } | 123 } |
126 } else { | 124 } else { |
(...skipping 18 matching lines...) Expand all Loading... |
145 } | 143 } |
146 | 144 |
147 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { | 145 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { |
148 return blocked_contents_->GetBlockedContentsCount(); | 146 return blocked_contents_->GetBlockedContentsCount(); |
149 } | 147 } |
150 | 148 |
151 void BlockedContentTabHelper::GetBlockedContents( | 149 void BlockedContentTabHelper::GetBlockedContents( |
152 std::vector<content::WebContents*>* blocked_contents) const { | 150 std::vector<content::WebContents*>* blocked_contents) const { |
153 blocked_contents_->GetBlockedContents(blocked_contents); | 151 blocked_contents_->GetBlockedContents(blocked_contents); |
154 } | 152 } |
OLD | NEW |