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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 527913002: Don't change the window disposition for new windows without a user gesture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 3 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
« no previous file with comments | « chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc ('k') | 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 // When supports_multiple_windows is disabled, popups are reusing 2020 // When supports_multiple_windows is disabled, popups are reusing
2021 // the same view. In some scenarios, this makes WebKit to call show() twice. 2021 // the same view. In some scenarios, this makes WebKit to call show() twice.
2022 if (webkit_preferences_.supports_multiple_windows) 2022 if (webkit_preferences_.supports_multiple_windows)
2023 NOTREACHED() << "received extraneous Show call"; 2023 NOTREACHED() << "received extraneous Show call";
2024 return; 2024 return;
2025 } 2025 }
2026 did_show_ = true; 2026 did_show_ = true;
2027 2027
2028 DCHECK(opener_id_ != MSG_ROUTING_NONE); 2028 DCHECK(opener_id_ != MSG_ROUTING_NONE);
2029 2029
2030 // Force new windows to a popup if they were not opened with a user gesture.
2031 if (!opened_by_user_gesture_) {
2032 // We exempt background tabs for compat with older versions of Chrome.
2033 // TODO(darin): This seems bogus. These should have a user gesture, so
2034 // we probably don't need this check.
2035 if (policy != blink::WebNavigationPolicyNewBackgroundTab)
2036 policy = blink::WebNavigationPolicyNewPopup;
2037 }
2038
2039 // NOTE: initial_pos_ may still have its default values at this point, but 2030 // NOTE: initial_pos_ may still have its default values at this point, but
2040 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the 2031 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the
2041 // browser process will impose a default position otherwise. 2032 // browser process will impose a default position otherwise.
2042 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, 2033 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_,
2043 NavigationPolicyToDisposition(policy), initial_pos_, 2034 NavigationPolicyToDisposition(policy), initial_pos_,
2044 opened_by_user_gesture_)); 2035 opened_by_user_gesture_));
2045 SetPendingWindowRect(initial_pos_); 2036 SetPendingWindowRect(initial_pos_);
2046 } 2037 }
2047 2038
2048 void RenderViewImpl::runModal() { 2039 void RenderViewImpl::runModal() {
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 std::vector<gfx::Size> sizes; 4191 std::vector<gfx::Size> sizes;
4201 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4192 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4202 if (!url.isEmpty()) 4193 if (!url.isEmpty())
4203 urls.push_back( 4194 urls.push_back(
4204 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4195 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4205 } 4196 }
4206 SendUpdateFaviconURL(urls); 4197 SendUpdateFaviconURL(urls);
4207 } 4198 }
4208 4199
4209 } // namespace content 4200 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698