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

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

Issue 23264020: Move Android to use new Popup Blocker API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added NOTIMPLEMENTED Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/android/tab_model/tab_model_list.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.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"
11 #include "chrome/browser/ui/browser_navigator.h" 11 #include "chrome/browser/ui/browser_navigator.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
14 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
15 #include "content/public/browser/navigation_details.h" 15 #include "content/public/browser/navigation_details.h"
16 #include "content/public/browser/navigation_entry.h" 16 #include "content/public/browser/navigation_entry.h"
17 #include "content/public/browser/render_view_host.h" 17 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "content/public/browser/web_contents_delegate.h" 19 #include "content/public/browser/web_contents_delegate.h"
20 #include "content/public/browser/web_contents_view.h" 20 #include "content/public/browser/web_contents_view.h"
21 #include "third_party/WebKit/public/web/WebWindowFeatures.h" 21 #include "third_party/WebKit/public/web/WebWindowFeatures.h"
22 22
23 #if defined(OS_ANDROID)
24 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
25 #endif
26
23 using WebKit::WebWindowFeatures; 27 using WebKit::WebWindowFeatures;
24 28
25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PopupBlockerTabHelper); 29 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PopupBlockerTabHelper);
26 30
27 struct PopupBlockerTabHelper::BlockedRequest { 31 struct PopupBlockerTabHelper::BlockedRequest {
28 BlockedRequest(const chrome::NavigateParams& params, 32 BlockedRequest(const chrome::NavigateParams& params,
29 const WebWindowFeatures& window_features) 33 const WebWindowFeatures& window_features)
30 : params(params), window_features(window_features) {} 34 : params(params), window_features(window_features) {}
31 35
32 chrome::NavigateParams params; 36 chrome::NavigateParams params;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 136
133 blocked_popups_.Add(new BlockedRequest(nav_params, features)); 137 blocked_popups_.Add(new BlockedRequest(nav_params, features));
134 TabSpecificContentSettings::FromWebContents(web_contents())-> 138 TabSpecificContentSettings::FromWebContents(web_contents())->
135 OnContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS, std::string()); 139 OnContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS, std::string());
136 } 140 }
137 141
138 void PopupBlockerTabHelper::ShowBlockedPopup(int32 id) { 142 void PopupBlockerTabHelper::ShowBlockedPopup(int32 id) {
139 BlockedRequest* popup = blocked_popups_.Lookup(id); 143 BlockedRequest* popup = blocked_popups_.Lookup(id);
140 if (!popup) 144 if (!popup)
141 return; 145 return;
146 #if defined(OS_ANDROID)
147 TabModelList::HandlePopupNavigation(&popup->params);
148 #else
142 chrome::Navigate(&popup->params); 149 chrome::Navigate(&popup->params);
150 #endif
143 if (popup->params.target_contents) { 151 if (popup->params.target_contents) {
144 popup->params.target_contents->Send(new ChromeViewMsg_SetWindowFeatures( 152 popup->params.target_contents->Send(new ChromeViewMsg_SetWindowFeatures(
145 popup->params.target_contents->GetRoutingID(), popup->window_features)); 153 popup->params.target_contents->GetRoutingID(), popup->window_features));
146 } 154 }
147 blocked_popups_.Remove(id); 155 blocked_popups_.Remove(id);
148 if (blocked_popups_.IsEmpty()) 156 if (blocked_popups_.IsEmpty())
149 PopupNotificationVisibilityChanged(false); 157 PopupNotificationVisibilityChanged(false);
150 } 158 }
151 159
152 size_t PopupBlockerTabHelper::GetBlockedPopupsCount() const { 160 size_t PopupBlockerTabHelper::GetBlockedPopupsCount() const {
153 return blocked_popups_.size(); 161 return blocked_popups_.size();
154 } 162 }
155 163
156 std::map<int32, GURL> PopupBlockerTabHelper::GetBlockedPopupRequests() { 164 std::map<int32, GURL> PopupBlockerTabHelper::GetBlockedPopupRequests() {
157 std::map<int32, GURL> result; 165 std::map<int32, GURL> result;
158 for (IDMap<BlockedRequest, IDMapOwnPointer>::const_iterator iter( 166 for (IDMap<BlockedRequest, IDMapOwnPointer>::const_iterator iter(
159 &blocked_popups_); 167 &blocked_popups_);
160 !iter.IsAtEnd(); 168 !iter.IsAtEnd();
161 iter.Advance()) { 169 iter.Advance()) {
162 result[iter.GetCurrentKey()] = iter.GetCurrentValue()->params.url; 170 result[iter.GetCurrentKey()] = iter.GetCurrentValue()->params.url;
163 } 171 }
164 return result; 172 return result;
165 } 173 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/tab_model/tab_model_list.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698