| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 // embedder can call GetWebFrame on any RenderFrame. | 1139 // embedder can call GetWebFrame on any RenderFrame. |
| 1140 GetContentClient()->renderer()->RenderFrameCreated(this); | 1140 GetContentClient()->renderer()->RenderFrameCreated(this); |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) { | 1143 void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) { |
| 1144 DCHECK(!blame_context_); | 1144 DCHECK(!blame_context_); |
| 1145 blame_context_ = new FrameBlameContext(this, parent_frame); | 1145 blame_context_ = new FrameBlameContext(this, parent_frame); |
| 1146 blame_context_->Initialize(); | 1146 blame_context_->Initialize(); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void RenderFrameImpl::OnGotZoomLevel(const GURL& url, double zoom_level) { |
| 1150 host_zoom_levels_[url] = zoom_level; |
| 1151 } |
| 1152 |
| 1149 RenderWidget* RenderFrameImpl::GetRenderWidget() { | 1153 RenderWidget* RenderFrameImpl::GetRenderWidget() { |
| 1150 RenderFrameImpl* local_root = | 1154 RenderFrameImpl* local_root = |
| 1151 RenderFrameImpl::FromWebFrame(frame_->localRoot()); | 1155 RenderFrameImpl::FromWebFrame(frame_->localRoot()); |
| 1152 return local_root->render_widget_.get(); | 1156 return local_root->render_widget_.get(); |
| 1153 } | 1157 } |
| 1154 | 1158 |
| 1155 #if defined(ENABLE_PLUGINS) | 1159 #if defined(ENABLE_PLUGINS) |
| 1156 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { | 1160 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { |
| 1157 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 1161 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, |
| 1158 DidCreatePepperPlugin(host)); | 1162 DidCreatePepperPlugin(host)); |
| (...skipping 2734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3893 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); | 3897 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); |
| 3894 } else { | 3898 } else { |
| 3895 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), | 3899 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), |
| 3896 WebString::fromUTF8(i.values())); | 3900 WebString::fromUTF8(i.values())); |
| 3897 } | 3901 } |
| 3898 } | 3902 } |
| 3899 } | 3903 } |
| 3900 | 3904 |
| 3901 if (!render_view_->renderer_preferences_.enable_referrers) | 3905 if (!render_view_->renderer_preferences_.enable_referrers) |
| 3902 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); | 3906 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); |
| 3907 |
| 3908 if (extra_data->is_main_frame()) { |
| 3909 if (!host_zoom_level_.is_bound()) { |
| 3910 RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService( |
| 3911 mojo::GetProxy(&host_zoom_level_)); |
| 3912 } |
| 3913 host_zoom_level_->GetZoomLevel(request_url, render_view_->GetRoutingID(), |
| 3914 base::Bind(&RenderFrameImpl::OnGotZoomLevel, |
| 3915 weak_factory_.GetWeakPtr())); |
| 3916 } |
| 3903 } | 3917 } |
| 3904 | 3918 |
| 3905 void RenderFrameImpl::didReceiveResponse( | 3919 void RenderFrameImpl::didReceiveResponse( |
| 3906 unsigned identifier, | 3920 unsigned identifier, |
| 3907 const blink::WebURLResponse& response) { | 3921 const blink::WebURLResponse& response) { |
| 3908 // Only do this for responses that correspond to a provisional data source | 3922 // Only do this for responses that correspond to a provisional data source |
| 3909 // of the top-most frame. If we have a provisional data source, then we | 3923 // of the top-most frame. If we have a provisional data source, then we |
| 3910 // can't have any sub-resources yet, so we know that this response must | 3924 // can't have any sub-resources yet, so we know that this response must |
| 3911 // correspond to a frame load. | 3925 // correspond to a frame load. |
| 3912 if (!frame_->provisionalDataSource() || frame_->parent()) | 3926 if (!frame_->provisionalDataSource() || frame_->parent()) |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4488 // Reset the zoom limits in case a plugin had changed them previously. This | 4502 // Reset the zoom limits in case a plugin had changed them previously. This |
| 4489 // will also call us back which will cause us to send a message to | 4503 // will also call us back which will cause us to send a message to |
| 4490 // update WebContentsImpl. | 4504 // update WebContentsImpl. |
| 4491 render_view_->webview()->zoomLimitsChanged( | 4505 render_view_->webview()->zoomLimitsChanged( |
| 4492 ZoomFactorToZoomLevel(kMinimumZoomFactor), | 4506 ZoomFactorToZoomLevel(kMinimumZoomFactor), |
| 4493 ZoomFactorToZoomLevel(kMaximumZoomFactor)); | 4507 ZoomFactorToZoomLevel(kMaximumZoomFactor)); |
| 4494 | 4508 |
| 4495 // Set zoom level, but don't do it for full-page plugin since they don't use | 4509 // Set zoom level, but don't do it for full-page plugin since they don't use |
| 4496 // the same zoom settings. | 4510 // the same zoom settings. |
| 4497 HostZoomLevels::iterator host_zoom = | 4511 HostZoomLevels::iterator host_zoom = |
| 4498 render_view_->host_zoom_levels_.find(GURL(request.url())); | 4512 host_zoom_levels_.find(GURL(request.url())); |
| 4499 if (render_view_->webview()->mainFrame()->isWebLocalFrame() && | 4513 if (render_view_->webview()->mainFrame()->isWebLocalFrame() && |
| 4500 render_view_->webview()->mainFrame()->document().isPluginDocument()) { | 4514 render_view_->webview()->mainFrame()->document().isPluginDocument()) { |
| 4501 // Reset the zoom levels for plugins. | 4515 // Reset the zoom levels for plugins. |
| 4502 render_view_->webview()->setZoomLevel(0); | 4516 render_view_->webview()->setZoomLevel(0); |
| 4503 } else { | 4517 } else { |
| 4504 // If the zoom level is not found, then do nothing. In-page navigation | 4518 // If the zoom level is not found, then do nothing. In-page navigation |
| 4505 // relies on not changing the zoom level in this case. | 4519 // relies on not changing the zoom level in this case. |
| 4506 if (host_zoom != render_view_->host_zoom_levels_.end()) | 4520 if (host_zoom != host_zoom_levels_.end()) |
| 4507 render_view_->SetZoomLevel(host_zoom->second); | 4521 render_view_->SetZoomLevel(host_zoom->second); |
| 4508 } | 4522 } |
| 4509 | 4523 |
| 4510 if (host_zoom != render_view_->host_zoom_levels_.end()) { | 4524 if (host_zoom != host_zoom_levels_.end()) { |
| 4511 // This zoom level was merely recorded transiently for this load. We can | 4525 // This zoom level was merely recorded transiently for this load. We can |
| 4512 // erase it now. If at some point we reload this page, the browser will | 4526 // erase it now. If at some point we reload this page, the browser will |
| 4513 // send us a new, up-to-date zoom level. | 4527 // send us a new, up-to-date zoom level. |
| 4514 render_view_->host_zoom_levels_.erase(host_zoom); | 4528 host_zoom_levels_.erase(host_zoom); |
| 4515 } | 4529 } |
| 4516 | 4530 |
| 4517 // Update contents MIME type for main frame. | 4531 // Update contents MIME type for main frame. |
| 4518 params.contents_mime_type = ds->response().mimeType().utf8(); | 4532 params.contents_mime_type = ds->response().mimeType().utf8(); |
| 4519 | 4533 |
| 4520 params.transition = navigation_state->GetTransitionType(); | 4534 params.transition = navigation_state->GetTransitionType(); |
| 4521 if (!ui::PageTransitionIsMainFrame(params.transition)) { | 4535 if (!ui::PageTransitionIsMainFrame(params.transition)) { |
| 4522 // If the main frame does a load, it should not be reported as a subframe | 4536 // If the main frame does a load, it should not be reported as a subframe |
| 4523 // navigation. This can occur in the following case: | 4537 // navigation. This can occur in the following case: |
| 4524 // 1. You're on a site with frames. | 4538 // 1. You're on a site with frames. |
| (...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6048 int match_count, | 6062 int match_count, |
| 6049 int ordinal, | 6063 int ordinal, |
| 6050 const WebRect& selection_rect, | 6064 const WebRect& selection_rect, |
| 6051 bool final_status_update) { | 6065 bool final_status_update) { |
| 6052 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6066 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
| 6053 selection_rect, ordinal, | 6067 selection_rect, ordinal, |
| 6054 final_status_update)); | 6068 final_status_update)); |
| 6055 } | 6069 } |
| 6056 | 6070 |
| 6057 } // namespace content | 6071 } // namespace content |
| OLD | NEW |