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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2411 } | 2411 } |
2412 | 2412 |
2413 // We are supposed to get a single call to Show for a newly created RenderView | 2413 // We are supposed to get a single call to Show for a newly created RenderView |
2414 // that was created via RenderViewImpl::CreateWebView. So, we wait until this | 2414 // that was created via RenderViewImpl::CreateWebView. So, we wait until this |
2415 // point to dispatch the ShowView message. | 2415 // point to dispatch the ShowView message. |
2416 // | 2416 // |
2417 // This method provides us with the information about how to display the newly | 2417 // This method provides us with the information about how to display the newly |
2418 // created RenderView (i.e., as a blocked popup or as a new tab). | 2418 // created RenderView (i.e., as a blocked popup or as a new tab). |
2419 // | 2419 // |
2420 void RenderViewImpl::show(WebNavigationPolicy policy) { | 2420 void RenderViewImpl::show(WebNavigationPolicy policy) { |
2421 #if !defined(OS_ANDROID) | |
joth
2012/10/18 20:06:00
Maybe easier to follow as:
if (did_show_) {
#if d
mnaganov (inactive)
2012/10/19 15:46:39
Changed to an alternative shorter version.
mnaganov (inactive)
2012/10/19 16:22:56
Ouch. My approach doesn't always compile, changing
| |
2421 DCHECK(!did_show_) << "received extraneous Show call"; | 2422 DCHECK(!did_show_) << "received extraneous Show call"; |
2422 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 2423 #else |
2424 DCHECK(!did_show_ || !webkit_preferences_.support_multiple_windows) << | |
2425 "received extraneous Show call"; | |
2426 #endif | |
2423 | 2427 |
2424 if (did_show_) | 2428 if (did_show_) |
2425 return; | 2429 return; |
2426 did_show_ = true; | 2430 did_show_ = true; |
2427 | 2431 |
2432 DCHECK(opener_id_ != MSG_ROUTING_NONE); | |
2433 | |
2428 if (content::GetContentClient()->renderer()->AllowPopup(creator_url_)) | 2434 if (content::GetContentClient()->renderer()->AllowPopup(creator_url_)) |
2429 opened_by_user_gesture_ = true; | 2435 opened_by_user_gesture_ = true; |
2430 | 2436 |
2431 // Force new windows to a popup if they were not opened with a user gesture. | 2437 // Force new windows to a popup if they were not opened with a user gesture. |
2432 if (!opened_by_user_gesture_) { | 2438 if (!opened_by_user_gesture_) { |
2433 // We exempt background tabs for compat with older versions of Chrome. | 2439 // We exempt background tabs for compat with older versions of Chrome. |
2434 // TODO(darin): This seems bogus. These should have a user gesture, so | 2440 // TODO(darin): This seems bogus. These should have a user gesture, so |
2435 // we probably don't need this check. | 2441 // we probably don't need this check. |
2436 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) | 2442 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) |
2437 policy = WebKit::WebNavigationPolicyNewPopup; | 2443 policy = WebKit::WebNavigationPolicyNewPopup; |
(...skipping 3991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6429 transport_dib->id())); | 6435 transport_dib->id())); |
6430 | 6436 |
6431 return true; | 6437 return true; |
6432 } | 6438 } |
6433 | 6439 |
6434 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6440 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6435 TransportDIB::Handle dib_handle) { | 6441 TransportDIB::Handle dib_handle) { |
6436 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6442 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6437 RenderProcess::current()->ReleaseTransportDIB(dib); | 6443 RenderProcess::current()->ReleaseTransportDIB(dib); |
6438 } | 6444 } |
OLD | NEW |