| 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 = | 83 NavigationEntry* entry = tab_contents()->controller().GetLastCommittedEntry(); |
| 84 tab_contents()->GetController().GetLastCommittedEntry(); | |
| 85 GURL creator = entry ? entry->virtual_url() : GURL::EmptyGURL(); | 84 GURL creator = entry ? entry->virtual_url() : GURL::EmptyGURL(); |
| 86 Profile* profile = | 85 Profile* profile = |
| 87 Profile::FromBrowserContext(tab_contents()->browser_context()); | 86 Profile::FromBrowserContext(tab_contents()->browser_context()); |
| 88 | 87 |
| 89 if (creator.is_valid() && | 88 if (creator.is_valid() && |
| 90 profile->GetHostContentSettingsMap()->GetContentSetting( | 89 profile->GetHostContentSettingsMap()->GetContentSetting( |
| 91 creator, | 90 creator, |
| 92 creator, | 91 creator, |
| 93 CONTENT_SETTINGS_TYPE_POPUPS, | 92 CONTENT_SETTINGS_TYPE_POPUPS, |
| 94 "") == CONTENT_SETTING_ALLOW) { | 93 "") == CONTENT_SETTING_ALLOW) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 116 } | 115 } |
| 117 | 116 |
| 118 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { | 117 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { |
| 119 return blocked_contents_->GetBlockedContentsCount(); | 118 return blocked_contents_->GetBlockedContentsCount(); |
| 120 } | 119 } |
| 121 | 120 |
| 122 void BlockedContentTabHelper::GetBlockedContents( | 121 void BlockedContentTabHelper::GetBlockedContents( |
| 123 std::vector<TabContentsWrapper*>* blocked_contents) const { | 122 std::vector<TabContentsWrapper*>* blocked_contents) const { |
| 124 blocked_contents_->GetBlockedContents(blocked_contents); | 123 blocked_contents_->GetBlockedContents(blocked_contents); |
| 125 } | 124 } |
| OLD | NEW |