OLD | NEW |
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/bind.h" | 10 #include "base/bind.h" |
(...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2357 } | 2357 } |
2358 | 2358 |
2359 // We are supposed to get a single call to Show for a newly created RenderView | 2359 // We are supposed to get a single call to Show for a newly created RenderView |
2360 // that was created via RenderViewImpl::CreateWebView. So, we wait until this | 2360 // that was created via RenderViewImpl::CreateWebView. So, we wait until this |
2361 // point to dispatch the ShowView message. | 2361 // point to dispatch the ShowView message. |
2362 // | 2362 // |
2363 // This method provides us with the information about how to display the newly | 2363 // This method provides us with the information about how to display the newly |
2364 // created RenderView (i.e., as a blocked popup or as a new tab). | 2364 // created RenderView (i.e., as a blocked popup or as a new tab). |
2365 // | 2365 // |
2366 void RenderViewImpl::show(WebNavigationPolicy policy) { | 2366 void RenderViewImpl::show(WebNavigationPolicy policy) { |
2367 DCHECK(!did_show_) << "received extraneous Show call"; | 2367 if (did_show_) { |
| 2368 #if defined(OS_ANDROID) |
| 2369 // When supports_multiple_windows is disabled, popups are reusing |
| 2370 // the same view. In some scenarios, this makes WebKit to call show() twice. |
| 2371 if (!webkit_preferences_.supports_multiple_windows) |
| 2372 return; |
| 2373 #endif |
| 2374 NOTREACHED() << "received extraneous Show call"; |
| 2375 return; |
| 2376 } |
| 2377 did_show_ = true; |
| 2378 |
2368 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 2379 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
2369 | 2380 |
2370 if (did_show_) | |
2371 return; | |
2372 did_show_ = true; | |
2373 | |
2374 if (GetContentClient()->renderer()->AllowPopup(creator_url_)) | 2381 if (GetContentClient()->renderer()->AllowPopup(creator_url_)) |
2375 opened_by_user_gesture_ = true; | 2382 opened_by_user_gesture_ = true; |
2376 | 2383 |
2377 // Force new windows to a popup if they were not opened with a user gesture. | 2384 // Force new windows to a popup if they were not opened with a user gesture. |
2378 if (!opened_by_user_gesture_) { | 2385 if (!opened_by_user_gesture_) { |
2379 // We exempt background tabs for compat with older versions of Chrome. | 2386 // We exempt background tabs for compat with older versions of Chrome. |
2380 // TODO(darin): This seems bogus. These should have a user gesture, so | 2387 // TODO(darin): This seems bogus. These should have a user gesture, so |
2381 // we probably don't need this check. | 2388 // we probably don't need this check. |
2382 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) | 2389 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) |
2383 policy = WebKit::WebNavigationPolicyNewPopup; | 2390 policy = WebKit::WebNavigationPolicyNewPopup; |
(...skipping 3954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6338 } | 6345 } |
6339 #endif | 6346 #endif |
6340 | 6347 |
6341 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6348 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6342 TransportDIB::Handle dib_handle) { | 6349 TransportDIB::Handle dib_handle) { |
6343 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6350 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6344 RenderProcess::current()->ReleaseTransportDIB(dib); | 6351 RenderProcess::current()->ReleaseTransportDIB(dib); |
6345 } | 6352 } |
6346 | 6353 |
6347 } // namespace content | 6354 } // namespace content |
OLD | NEW |