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 3936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3947 | 3947 |
3948 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { | 3948 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { |
3949 return ZoomLevelToZoomFactor(zoom_level); | 3949 return ZoomLevelToZoomFactor(zoom_level); |
3950 } | 3950 } |
3951 | 3951 |
3952 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { | 3952 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { |
3953 return ZoomFactorToZoomLevel(factor); | 3953 return ZoomFactorToZoomLevel(factor); |
3954 } | 3954 } |
3955 | 3955 |
3956 void RenderViewImpl::registerProtocolHandler(const WebString& scheme, | 3956 void RenderViewImpl::registerProtocolHandler(const WebString& scheme, |
3957 const WebURL& base_url, | |
3958 const WebURL& url, | 3957 const WebURL& url, |
3959 const WebString& title) { | 3958 const WebString& title) { |
3960 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 3959 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
3961 GURL base(base_url); | |
3962 GURL absolute_url = base.Resolve(base::UTF16ToUTF8(url.string())); | |
3963 if (base.GetOrigin() != absolute_url.GetOrigin()) { | |
3964 return; | |
3965 } | |
3966 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_, | 3960 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_, |
3967 base::UTF16ToUTF8(scheme), | 3961 base::UTF16ToUTF8(scheme), |
3968 absolute_url, | 3962 url, |
3969 title, | 3963 title, |
3970 user_gesture)); | 3964 user_gesture)); |
3971 } | 3965 } |
3972 | 3966 |
3973 void RenderViewImpl::unregisterProtocolHandler(const WebString& scheme, | 3967 void RenderViewImpl::unregisterProtocolHandler(const WebString& scheme, |
3974 const WebURL& base_url, | |
3975 const WebURL& url) { | 3968 const WebURL& url) { |
3976 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 3969 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
3977 GURL base(base_url); | |
3978 GURL absolute_url = base.Resolve(base::UTF16ToUTF8(url.string())); | |
3979 if (base.GetOrigin() != absolute_url.GetOrigin()) | |
3980 return; | |
3981 Send(new ViewHostMsg_UnregisterProtocolHandler(routing_id_, | 3970 Send(new ViewHostMsg_UnregisterProtocolHandler(routing_id_, |
3982 base::UTF16ToUTF8(scheme), | 3971 base::UTF16ToUTF8(scheme), |
3983 absolute_url, | 3972 url, |
3984 user_gesture)); | 3973 user_gesture)); |
3985 } | 3974 } |
3986 | 3975 |
3987 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { | 3976 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { |
3988 blink::WebPageVisibilityState current_state = is_hidden() ? | 3977 blink::WebPageVisibilityState current_state = is_hidden() ? |
3989 blink::WebPageVisibilityStateHidden : | 3978 blink::WebPageVisibilityStateHidden : |
3990 blink::WebPageVisibilityStateVisible; | 3979 blink::WebPageVisibilityStateVisible; |
3991 blink::WebPageVisibilityState override_state = current_state; | 3980 blink::WebPageVisibilityState override_state = current_state; |
3992 // TODO(jam): move this method to WebFrameClient. | 3981 // TODO(jam): move this method to WebFrameClient. |
3993 if (GetContentClient()->renderer()-> | 3982 if (GetContentClient()->renderer()-> |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4300 std::vector<gfx::Size> sizes; | 4289 std::vector<gfx::Size> sizes; |
4301 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4290 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4302 if (!url.isEmpty()) | 4291 if (!url.isEmpty()) |
4303 urls.push_back( | 4292 urls.push_back( |
4304 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4293 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4305 } | 4294 } |
4306 SendUpdateFaviconURL(urls); | 4295 SendUpdateFaviconURL(urls); |
4307 } | 4296 } |
4308 | 4297 |
4309 } // namespace content | 4298 } // namespace content |
OLD | NEW |