| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void BlockedContentTabHelper::AddPopup(TabContentsWrapper* new_contents, | 73 void BlockedContentTabHelper::AddPopup(TabContentsWrapper* new_contents, |
| 74 const gfx::Rect& initial_pos, | 74 const gfx::Rect& initial_pos, |
| 75 bool user_gesture) { | 75 bool user_gesture) { |
| 76 // A page can't spawn popups (or do anything else, either) until its load | 76 // A page can't spawn popups (or do anything else, either) until its load |
| 77 // commits, so when we reach here, the popup was spawned by the | 77 // commits, so when we reach here, the popup was spawned by the |
| 78 // NavigationController's last committed entry, not the active entry. For | 78 // NavigationController's last committed entry, not the active entry. For |
| 79 // example, if a page opens a popup in an onunload() handler, then the active | 79 // example, if a page opens a popup in an onunload() handler, then the active |
| 80 // entry is the page to be loaded as we navigate away from the unloading | 80 // entry is the page to be loaded as we navigate away from the unloading |
| 81 // page. For this reason, we can't use GetURL() to get the opener URL, | 81 // page. For this reason, we can't use GetURL() to get the opener URL, |
| 82 // because it returns the active entry. | 82 // because it returns the active entry. |
| 83 NavigationEntry* entry = tab_contents()->controller().GetLastCommittedEntry(); | 83 NavigationEntry* entry = |
| 84 tab_contents()->GetController().GetLastCommittedEntry(); |
| 84 GURL creator = entry ? entry->virtual_url() : GURL::EmptyGURL(); | 85 GURL creator = entry ? entry->virtual_url() : GURL::EmptyGURL(); |
| 85 Profile* profile = | 86 Profile* profile = |
| 86 Profile::FromBrowserContext(tab_contents()->browser_context()); | 87 Profile::FromBrowserContext(tab_contents()->browser_context()); |
| 87 | 88 |
| 88 if (creator.is_valid() && | 89 if (creator.is_valid() && |
| 89 profile->GetHostContentSettingsMap()->GetContentSetting( | 90 profile->GetHostContentSettingsMap()->GetContentSetting( |
| 90 creator, | 91 creator, |
| 91 creator, | 92 creator, |
| 92 CONTENT_SETTINGS_TYPE_POPUPS, | 93 CONTENT_SETTINGS_TYPE_POPUPS, |
| 93 "") == CONTENT_SETTING_ALLOW) { | 94 "") == CONTENT_SETTING_ALLOW) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 115 } | 116 } |
| 116 | 117 |
| 117 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { | 118 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { |
| 118 return blocked_contents_->GetBlockedContentsCount(); | 119 return blocked_contents_->GetBlockedContentsCount(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void BlockedContentTabHelper::GetBlockedContents( | 122 void BlockedContentTabHelper::GetBlockedContents( |
| 122 std::vector<TabContentsWrapper*>* blocked_contents) const { | 123 std::vector<TabContentsWrapper*>* blocked_contents) const { |
| 123 blocked_contents_->GetBlockedContents(blocked_contents); | 124 blocked_contents_->GetBlockedContents(blocked_contents); |
| 124 } | 125 } |
| OLD | NEW |