Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Make changes requested by danakj, fix a few more headers Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/content_settings/host_content_settings_map_factory.h" 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" 10 #include "chrome/browser/ui/blocked_content/blocked_window_params.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 AddBlockedPopup(params.CreateNavigateParams(web_contents()), 100 AddBlockedPopup(params.CreateNavigateParams(web_contents()),
101 params.features()); 101 params.features());
102 } 102 }
103 103
104 void PopupBlockerTabHelper::AddBlockedPopup( 104 void PopupBlockerTabHelper::AddBlockedPopup(
105 const chrome::NavigateParams& params, 105 const chrome::NavigateParams& params,
106 const WebWindowFeatures& window_features) { 106 const WebWindowFeatures& window_features) {
107 if (blocked_popups_.size() >= kMaximumNumberOfPopups) 107 if (blocked_popups_.size() >= kMaximumNumberOfPopups)
108 return; 108 return;
109 109
110 blocked_popups_.Add(new BlockedRequest(params, window_features)); 110 blocked_popups_.Add(
111 base::MakeUnique<BlockedRequest>(params, window_features));
111 TabSpecificContentSettings::FromWebContents(web_contents())-> 112 TabSpecificContentSettings::FromWebContents(web_contents())->
112 OnContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS); 113 OnContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS);
113 } 114 }
114 115
115 void PopupBlockerTabHelper::ShowBlockedPopup(int32_t id) { 116 void PopupBlockerTabHelper::ShowBlockedPopup(int32_t id) {
116 BlockedRequest* popup = blocked_popups_.Lookup(id); 117 BlockedRequest* popup = blocked_popups_.Lookup(id);
117 if (!popup) 118 if (!popup)
118 return; 119 return;
119 // We set user_gesture to true here, so the new popup gets correctly focused. 120 // We set user_gesture to true here, so the new popup gets correctly focused.
120 popup->params.user_gesture = true; 121 popup->params.user_gesture = true;
(...skipping 19 matching lines...) Expand all
140 PopupBlockerTabHelper::GetBlockedPopupRequests() { 141 PopupBlockerTabHelper::GetBlockedPopupRequests() {
141 PopupIdMap result; 142 PopupIdMap result;
142 for (IDMap<BlockedRequest, IDMapOwnPointer>::const_iterator iter( 143 for (IDMap<BlockedRequest, IDMapOwnPointer>::const_iterator iter(
143 &blocked_popups_); 144 &blocked_popups_);
144 !iter.IsAtEnd(); 145 !iter.IsAtEnd();
145 iter.Advance()) { 146 iter.Advance()) {
146 result[iter.GetCurrentKey()] = iter.GetCurrentValue()->params.url; 147 result[iter.GetCurrentKey()] = iter.GetCurrentValue()->params.url;
147 } 148 }
148 return result; 149 return result;
149 } 150 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_manager.cc ('k') | chrome/browser/ui/tab_contents/core_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698