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

Side by Side Diff: Source/web/ChromeClientImpl.cpp

Issue 730013002: Disallow background tabs without matching user gesture for createWindow() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest& r, const WindowFeatures& features, 223 Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest& r, const WindowFeatures& features,
224 NavigationPolicy navigationPolicy, ShouldSendReferrer shouldSendReferrer) 224 NavigationPolicy navigationPolicy, ShouldSendReferrer shouldSendReferrer)
225 { 225 {
226 if (!m_webView->client()) 226 if (!m_webView->client())
227 return 0; 227 return 0;
228 228
229 WebNavigationPolicy policy = static_cast<WebNavigationPolicy>(navigationPoli cy); 229 WebNavigationPolicy policy = static_cast<WebNavigationPolicy>(navigationPoli cy);
230 if (policy == WebNavigationPolicyIgnore) 230 if (policy == WebNavigationPolicyIgnore)
231 policy = getNavigationPolicy(); 231 policy = getNavigationPolicy();
232 else if (policy == WebNavigationPolicyNewBackgroundTab && getNavigationPolic y() != WebNavigationPolicyNewBackgroundTab)
233 policy = WebNavigationPolicyNewForegroundTab;
232 234
233 ASSERT(frame->document()); 235 ASSERT(frame->document());
234 Fullscreen::fullyExitFullscreen(*frame->document()); 236 Fullscreen::fullyExitFullscreen(*frame->document());
235 237
236 WebViewImpl* newView = toWebViewImpl( 238 WebViewImpl* newView = toWebViewImpl(
237 m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), Wra ppedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shoul dSendReferrer == NeverSendReferrer)); 239 m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), Wra ppedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shoul dSendReferrer == NeverSendReferrer));
238 if (!newView) 240 if (!newView)
239 return 0; 241 return 0;
240 return newView->page(); 242 return newView->page();
241 } 243 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 296 }
295 297
296 void ChromeClientImpl::show(NavigationPolicy navigationPolicy) 298 void ChromeClientImpl::show(NavigationPolicy navigationPolicy)
297 { 299 {
298 if (!m_webView->client()) 300 if (!m_webView->client())
299 return; 301 return;
300 302
301 WebNavigationPolicy policy = static_cast<WebNavigationPolicy>(navigationPoli cy); 303 WebNavigationPolicy policy = static_cast<WebNavigationPolicy>(navigationPoli cy);
302 if (policy == WebNavigationPolicyIgnore) 304 if (policy == WebNavigationPolicyIgnore)
303 policy = getNavigationPolicy(); 305 policy = getNavigationPolicy();
306 else if (policy == WebNavigationPolicyNewBackgroundTab && getNavigationPolic y() != WebNavigationPolicyNewBackgroundTab)
307 policy = WebNavigationPolicyNewForegroundTab;
Mike West 2014/11/17 09:43:32 Nit: Maybe extract this out to a helper so you don
304 m_webView->client()->show(policy); 308 m_webView->client()->show(policy);
305 } 309 }
306 310
307 bool ChromeClientImpl::canRunModal() 311 bool ChromeClientImpl::canRunModal()
308 { 312 {
309 return !!m_webView->client(); 313 return !!m_webView->client();
310 } 314 }
311 315
312 void ChromeClientImpl::runModal() 316 void ChromeClientImpl::runModal()
313 { 317 {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 m_webView->autofillClient()->textFieldDidEndEditing(WebInputElement(&inp utElement)); 855 m_webView->autofillClient()->textFieldDidEndEditing(WebInputElement(&inp utElement));
852 } 856 }
853 857
854 void ChromeClientImpl::openTextDataListChooser(HTMLInputElement& input) 858 void ChromeClientImpl::openTextDataListChooser(HTMLInputElement& input)
855 { 859 {
856 if (m_webView->autofillClient()) 860 if (m_webView->autofillClient())
857 m_webView->autofillClient()->openTextDataListChooser(WebInputElement(&in put)); 861 m_webView->autofillClient()->openTextDataListChooser(WebInputElement(&in put));
858 } 862 }
859 863
860 } // namespace blink 864 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698