| 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/blocked_content/popup_blocker_tab_helper.h" | 5 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.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 29 matching lines...) Expand all Loading... |
| 40 content::WebContents* web_contents) | 40 content::WebContents* web_contents) |
| 41 : content::WebContentsObserver(web_contents) { | 41 : content::WebContentsObserver(web_contents) { |
| 42 } | 42 } |
| 43 | 43 |
| 44 PopupBlockerTabHelper::~PopupBlockerTabHelper() { | 44 PopupBlockerTabHelper::~PopupBlockerTabHelper() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 void PopupBlockerTabHelper::DidFinishNavigation( | 47 void PopupBlockerTabHelper::DidFinishNavigation( |
| 48 content::NavigationHandle* navigation_handle) { | 48 content::NavigationHandle* navigation_handle) { |
| 49 // Clear all page actions, blocked content notifications and browser actions | 49 // Clear all page actions, blocked content notifications and browser actions |
| 50 // for this tab, unless this is an in-page navigation. Also only consider | 50 // for this tab, unless this is an same-document navigation. Also only |
| 51 // main frame navigations that successfully committed. | 51 // consider main frame navigations that successfully committed. |
| 52 if (!navigation_handle->IsInMainFrame() || | 52 if (!navigation_handle->IsInMainFrame() || |
| 53 !navigation_handle->HasCommitted() || | 53 !navigation_handle->HasCommitted() || |
| 54 navigation_handle->IsSamePage()) { | 54 navigation_handle->IsSameDocument()) { |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Close blocked popups. | 58 // Close blocked popups. |
| 59 if (!blocked_popups_.IsEmpty()) { | 59 if (!blocked_popups_.IsEmpty()) { |
| 60 blocked_popups_.Clear(); | 60 blocked_popups_.Clear(); |
| 61 PopupNotificationVisibilityChanged(false); | 61 PopupNotificationVisibilityChanged(false); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 PopupBlockerTabHelper::GetBlockedPopupRequests() { | 143 PopupBlockerTabHelper::GetBlockedPopupRequests() { |
| 144 PopupIdMap result; | 144 PopupIdMap result; |
| 145 for (IDMap<std::unique_ptr<BlockedRequest>>::const_iterator iter( | 145 for (IDMap<std::unique_ptr<BlockedRequest>>::const_iterator iter( |
| 146 &blocked_popups_); | 146 &blocked_popups_); |
| 147 !iter.IsAtEnd(); | 147 !iter.IsAtEnd(); |
| 148 iter.Advance()) { | 148 iter.Advance()) { |
| 149 result[iter.GetCurrentKey()] = iter.GetCurrentValue()->params.url; | 149 result[iter.GetCurrentKey()] = iter.GetCurrentValue()->params.url; |
| 150 } | 150 } |
| 151 return result; | 151 return result; |
| 152 } | 152 } |
| OLD | NEW |