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

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

Issue 2773573002: window.open() should gate new tab/new popup based on toolbar visibility. (Closed)
Patch Set: buttons Created 3 years, 9 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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 // User and app agree that we want a new window; let the app override the 325 // User and app agree that we want a new window; let the app override the
326 // decorations. 326 // decorations.
327 if (userPolicy == NavigationPolicyNewWindow && 327 if (userPolicy == NavigationPolicyNewWindow &&
328 *policy == NavigationPolicyNewPopup) 328 *policy == NavigationPolicyNewPopup)
329 return; 329 return;
330 *policy = userPolicy; 330 *policy = userPolicy;
331 } 331 }
332 332
333 WebNavigationPolicy getNavigationPolicy(const WindowFeatures& features) { 333 WebNavigationPolicy getNavigationPolicy(const WindowFeatures& features) {
334 // If our default configuration was modified by a script or wasn't 334 // If the window features didn't enable the toolbar, or this window wasn't
335 // created by a user gesture, then show as a popup. Else, let this 335 // created by a user gesture, show as a popup instead of a new tab.
336 // new window be opened as a toplevel window. 336 //
337 bool asPopup = !features.toolBarVisible || !features.statusBarVisible || 337 // Note: this previously also checked that menubar, resizable, scrollbar, and
338 !features.scrollbarsVisible || !features.menuBarVisible || 338 // statusbar are enabled too. When no feature string is specified, these
339 !features.resizable; 339 // features default to enabled (and the window opens as a new tab). However,
340 // when a feature string is specified, any *unspecified* features default to
341 // disabled, often causing the window to open as a popup instead.
342 //
343 // As specifying menubar, resizable, scrollbar, and statusbar have no effect
344 // on the UI, just ignore them and only consider whether or not the toolbar is
345 // enabled, which matches Firefox's behavior.
346 bool asPopup = !features.toolBarVisible;
340 347
341 NavigationPolicy policy = NavigationPolicyNewForegroundTab; 348 NavigationPolicy policy = NavigationPolicyNewForegroundTab;
342 if (asPopup) 349 if (asPopup)
343 policy = NavigationPolicyNewPopup; 350 policy = NavigationPolicyNewPopup;
344 updatePolicyForEvent(WebViewImpl::currentInputEvent(), &policy); 351 updatePolicyForEvent(WebViewImpl::currentInputEvent(), &policy);
345 352
346 return static_cast<WebNavigationPolicy>(policy); 353 return static_cast<WebNavigationPolicy>(policy);
347 } 354 }
348 355
349 WebNavigationPolicy effectiveNavigationPolicy(NavigationPolicy navigationPolicy, 356 WebNavigationPolicy effectiveNavigationPolicy(NavigationPolicy navigationPolicy,
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 PresentationController::provideTo(frame, client->presentationClient()); 1230 PresentationController::provideTo(frame, client->presentationClient());
1224 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { 1231 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) {
1225 provideAudioOutputDeviceClientTo(frame, 1232 provideAudioOutputDeviceClientTo(frame,
1226 new AudioOutputDeviceClientImpl(frame)); 1233 new AudioOutputDeviceClientImpl(frame));
1227 } 1234 }
1228 if (RuntimeEnabledFeatures::installedAppEnabled()) 1235 if (RuntimeEnabledFeatures::installedAppEnabled())
1229 InstalledAppController::provideTo(frame, client->relatedAppsFetcher()); 1236 InstalledAppController::provideTo(frame, client->relatedAppsFetcher());
1230 } 1237 }
1231 1238
1232 } // namespace blink 1239 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698