| 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/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 case blink::WebNavigationPolicyCurrentTab: | 548 case blink::WebNavigationPolicyCurrentTab: |
| 549 return CURRENT_TAB; | 549 return CURRENT_TAB; |
| 550 case blink::WebNavigationPolicyNewBackgroundTab: | 550 case blink::WebNavigationPolicyNewBackgroundTab: |
| 551 return NEW_BACKGROUND_TAB; | 551 return NEW_BACKGROUND_TAB; |
| 552 case blink::WebNavigationPolicyNewForegroundTab: | 552 case blink::WebNavigationPolicyNewForegroundTab: |
| 553 return NEW_FOREGROUND_TAB; | 553 return NEW_FOREGROUND_TAB; |
| 554 case blink::WebNavigationPolicyNewWindow: | 554 case blink::WebNavigationPolicyNewWindow: |
| 555 return NEW_WINDOW; | 555 return NEW_WINDOW; |
| 556 case blink::WebNavigationPolicyNewPopup: | 556 case blink::WebNavigationPolicyNewPopup: |
| 557 return NEW_POPUP; | 557 return NEW_POPUP; |
| 558 case blink::WebNavigationPolicyPresentationWindow: |
| 559 return PRESENTATION_WINDOW; |
| 558 default: | 560 default: |
| 559 NOTREACHED() << "Unexpected WebNavigationPolicy"; | 561 NOTREACHED() << "Unexpected WebNavigationPolicy"; |
| 560 return IGNORE_ACTION; | 562 return IGNORE_ACTION; |
| 561 } | 563 } |
| 562 } | 564 } |
| 563 | 565 |
| 564 // Returns true if the device scale is high enough that losing subpixel | 566 // Returns true if the device scale is high enough that losing subpixel |
| 565 // antialiasing won't have a noticeable effect on text quality. | 567 // antialiasing won't have a noticeable effect on text quality. |
| 566 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { | 568 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { |
| 567 #if defined(OS_ANDROID) | 569 #if defined(OS_ANDROID) |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 params.frame_name = frame_name; | 2231 params.frame_name = frame_name; |
| 2230 params.opener_frame_id = creator->identifier(); | 2232 params.opener_frame_id = creator->identifier(); |
| 2231 params.opener_url = creator->document().url(); | 2233 params.opener_url = creator->document().url(); |
| 2232 params.opener_top_level_frame_url = creator->top()->document().url(); | 2234 params.opener_top_level_frame_url = creator->top()->document().url(); |
| 2233 GURL security_url(creator->document().securityOrigin().toString().utf8()); | 2235 GURL security_url(creator->document().securityOrigin().toString().utf8()); |
| 2234 if (!security_url.is_valid()) | 2236 if (!security_url.is_valid()) |
| 2235 security_url = GURL(); | 2237 security_url = GURL(); |
| 2236 params.opener_security_origin = security_url; | 2238 params.opener_security_origin = security_url; |
| 2237 params.opener_suppressed = suppress_opener; | 2239 params.opener_suppressed = suppress_opener; |
| 2238 params.disposition = NavigationPolicyToDisposition(policy); | 2240 params.disposition = NavigationPolicyToDisposition(policy); |
| 2241 |
| 2239 if (!request.isNull()) { | 2242 if (!request.isNull()) { |
| 2240 params.target_url = request.url(); | 2243 params.target_url = request.url(); |
| 2241 params.referrer = GetReferrerFromRequest(creator, request); | 2244 params.referrer = GetReferrerFromRequest(creator, request); |
| 2242 } | 2245 } |
| 2243 params.features = features; | 2246 params.features = features; |
| 2244 | 2247 |
| 2245 for (size_t i = 0; i < features.additionalFeatures.size(); ++i) | 2248 for (size_t i = 0; i < features.additionalFeatures.size(); ++i) |
| 2246 params.additional_features.push_back(features.additionalFeatures[i]); | 2249 params.additional_features.push_back(features.additionalFeatures[i]); |
| 2247 | 2250 |
| 2248 int32 routing_id = MSG_ROUTING_NONE; | 2251 int32 routing_id = MSG_ROUTING_NONE; |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2875 } | 2878 } |
| 2876 did_show_ = true; | 2879 did_show_ = true; |
| 2877 | 2880 |
| 2878 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 2881 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
| 2879 | 2882 |
| 2880 // Force new windows to a popup if they were not opened with a user gesture. | 2883 // Force new windows to a popup if they were not opened with a user gesture. |
| 2881 if (!opened_by_user_gesture_) { | 2884 if (!opened_by_user_gesture_) { |
| 2882 // We exempt background tabs for compat with older versions of Chrome. | 2885 // We exempt background tabs for compat with older versions of Chrome. |
| 2883 // TODO(darin): This seems bogus. These should have a user gesture, so | 2886 // TODO(darin): This seems bogus. These should have a user gesture, so |
| 2884 // we probably don't need this check. | 2887 // we probably don't need this check. |
| 2885 if (policy != blink::WebNavigationPolicyNewBackgroundTab) | 2888 if (policy != blink::WebNavigationPolicyNewBackgroundTab || |
| 2889 policy != blink::WebNavigationPolicyPresentationWindow) |
| 2886 policy = blink::WebNavigationPolicyNewPopup; | 2890 policy = blink::WebNavigationPolicyNewPopup; |
| 2887 } | 2891 } |
| 2888 | 2892 |
| 2889 // NOTE: initial_pos_ may still have its default values at this point, but | 2893 // NOTE: initial_pos_ may still have its default values at this point, but |
| 2890 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 2894 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
| 2891 // browser process will impose a default position otherwise. | 2895 // browser process will impose a default position otherwise. |
| 2896 |
| 2892 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, | 2897 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, |
| 2893 NavigationPolicyToDisposition(policy), initial_pos_, | 2898 NavigationPolicyToDisposition(policy), initial_pos_, |
| 2894 opened_by_user_gesture_)); | 2899 opened_by_user_gesture_)); |
| 2900 |
| 2895 SetPendingWindowRect(initial_pos_); | 2901 SetPendingWindowRect(initial_pos_); |
| 2896 } | 2902 } |
| 2897 | 2903 |
| 2898 void RenderViewImpl::runModal() { | 2904 void RenderViewImpl::runModal() { |
| 2899 DCHECK(did_show_) << "should already have shown the view"; | 2905 DCHECK(did_show_) << "should already have shown the view"; |
| 2900 | 2906 |
| 2901 // Don't allow further dialogs if we are waiting to swap out, since the | 2907 // Don't allow further dialogs if we are waiting to swap out, since the |
| 2902 // PageGroupLoadDeferrer in our stack prevents it. | 2908 // PageGroupLoadDeferrer in our stack prevents it. |
| 2903 if (suppress_dialogs_until_swap_out_) | 2909 if (suppress_dialogs_until_swap_out_) |
| 2904 return; | 2910 return; |
| (...skipping 3532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6437 for (size_t i = 0; i < icon_urls.size(); i++) { | 6443 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6438 WebURL url = icon_urls[i].iconURL(); | 6444 WebURL url = icon_urls[i].iconURL(); |
| 6439 if (!url.isEmpty()) | 6445 if (!url.isEmpty()) |
| 6440 urls.push_back(FaviconURL(url, | 6446 urls.push_back(FaviconURL(url, |
| 6441 ToFaviconType(icon_urls[i].iconType()))); | 6447 ToFaviconType(icon_urls[i].iconType()))); |
| 6442 } | 6448 } |
| 6443 SendUpdateFaviconURL(urls); | 6449 SendUpdateFaviconURL(urls); |
| 6444 } | 6450 } |
| 6445 | 6451 |
| 6446 } // namespace content | 6452 } // namespace content |
| OLD | NEW |