Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2211713002: Remove dependency of c/b/loader on c/b/host_zoom_map_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 input_handler_manager->RegisterRoutingID(GetRoutingID()); 1249 input_handler_manager->RegisterRoutingID(GetRoutingID());
1250 } 1250 }
1251 } 1251 }
1252 1252
1253 void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) { 1253 void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) {
1254 DCHECK(!blame_context_); 1254 DCHECK(!blame_context_);
1255 blame_context_ = base::WrapUnique(new FrameBlameContext(this, parent_frame)); 1255 blame_context_ = base::WrapUnique(new FrameBlameContext(this, parent_frame));
1256 blame_context_->Initialize(); 1256 blame_context_->Initialize();
1257 } 1257 }
1258 1258
1259 void RenderFrameImpl::OnGotZoomLevel(const GURL& url, double zoom_level) {
1260 // TODO(wjmaclean): We should see if this restriction is really necessary,
1261 // since it isn't enforced in other parts of the page zoom system (e.g.
1262 // when a users changes the zoom of a currently displayed page). Android
1263 // has no UI for this, so in theory the following code would normally just use
1264 // the default zoom anyways.
1265 #if !defined(OS_ANDROID)
1266 // On Android, page zoom isn't used, and in case of WebView, text zoom is used
1267 // for legacy WebView text scaling emulation. Thus, the code that resets
1268 // the zoom level from this map will be effectively resetting text zoom level.
1269 host_zoom_levels_[url] = zoom_level;
1270 #endif
1271 }
1272
1259 RenderWidget* RenderFrameImpl::GetRenderWidget() { 1273 RenderWidget* RenderFrameImpl::GetRenderWidget() {
1260 RenderFrameImpl* local_root = 1274 RenderFrameImpl* local_root =
1261 RenderFrameImpl::FromWebFrame(frame_->localRoot()); 1275 RenderFrameImpl::FromWebFrame(frame_->localRoot());
1262 return local_root->render_widget_.get(); 1276 return local_root->render_widget_.get();
1263 } 1277 }
1264 1278
1265 #if defined(ENABLE_PLUGINS) 1279 #if defined(ENABLE_PLUGINS)
1266 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { 1280 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) {
1267 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 1281 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
1268 DidCreatePepperPlugin(host)); 1282 DidCreatePepperPlugin(host));
(...skipping 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); 4143 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault);
4130 } else { 4144 } else {
4131 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), 4145 request.setHTTPHeaderField(WebString::fromUTF8(i.name()),
4132 WebString::fromUTF8(i.values())); 4146 WebString::fromUTF8(i.values()));
4133 } 4147 }
4134 } 4148 }
4135 } 4149 }
4136 4150
4137 if (!render_view_->renderer_preferences_.enable_referrers) 4151 if (!render_view_->renderer_preferences_.enable_referrers)
4138 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); 4152 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault);
4153
4154 if (extra_data->is_main_frame() && RenderThreadImpl::current()) {
4155 RenderThreadImpl::current()
4156 ->render_frame_message_filter()
4157 ->GetHostZoomLevel(render_view_->GetRoutingID(), request_url,
4158 base::Bind(&RenderFrameImpl::OnGotZoomLevel,
4159 weak_factory_.GetWeakPtr(), request_url));
4160 }
4139 } 4161 }
4140 4162
4141 void RenderFrameImpl::didReceiveResponse( 4163 void RenderFrameImpl::didReceiveResponse(
4142 unsigned identifier, 4164 unsigned identifier,
4143 const blink::WebURLResponse& response) { 4165 const blink::WebURLResponse& response) {
4144 // Only do this for responses that correspond to a provisional data source 4166 // Only do this for responses that correspond to a provisional data source
4145 // of the top-most frame. If we have a provisional data source, then we 4167 // of the top-most frame. If we have a provisional data source, then we
4146 // can't have any sub-resources yet, so we know that this response must 4168 // can't have any sub-resources yet, so we know that this response must
4147 // correspond to a frame load. 4169 // correspond to a frame load.
4148 if (!frame_->provisionalDataSource() || frame_->parent()) 4170 if (!frame_->provisionalDataSource() || frame_->parent())
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 // Reset the zoom limits in case a plugin had changed them previously. This 4698 // Reset the zoom limits in case a plugin had changed them previously. This
4677 // will also call us back which will cause us to send a message to 4699 // will also call us back which will cause us to send a message to
4678 // update WebContentsImpl. 4700 // update WebContentsImpl.
4679 render_view_->webview()->zoomLimitsChanged( 4701 render_view_->webview()->zoomLimitsChanged(
4680 ZoomFactorToZoomLevel(kMinimumZoomFactor), 4702 ZoomFactorToZoomLevel(kMinimumZoomFactor),
4681 ZoomFactorToZoomLevel(kMaximumZoomFactor)); 4703 ZoomFactorToZoomLevel(kMaximumZoomFactor));
4682 4704
4683 // Set zoom level, but don't do it for full-page plugin since they don't use 4705 // Set zoom level, but don't do it for full-page plugin since they don't use
4684 // the same zoom settings. 4706 // the same zoom settings.
4685 HostZoomLevels::iterator host_zoom = 4707 HostZoomLevels::iterator host_zoom =
4686 render_view_->host_zoom_levels_.find(GURL(request.url())); 4708 host_zoom_levels_.find(GURL(request.url()));
4687 if (render_view_->webview()->mainFrame()->isWebLocalFrame() && 4709 if (render_view_->webview()->mainFrame()->isWebLocalFrame() &&
4688 render_view_->webview()->mainFrame()->document().isPluginDocument()) { 4710 render_view_->webview()->mainFrame()->document().isPluginDocument()) {
4689 // Reset the zoom levels for plugins. 4711 // Reset the zoom levels for plugins.
4690 render_view_->SetZoomLevel(0); 4712 render_view_->SetZoomLevel(0);
4691 } else { 4713 } else {
4692 // If the zoom level is not found, then do nothing. In-page navigation 4714 // If the zoom level is not found, then do nothing. In-page navigation
4693 // relies on not changing the zoom level in this case. 4715 // relies on not changing the zoom level in this case.
4694 if (host_zoom != render_view_->host_zoom_levels_.end()) 4716 if (host_zoom != host_zoom_levels_.end())
4695 render_view_->SetZoomLevel(host_zoom->second); 4717 render_view_->SetZoomLevel(host_zoom->second);
4696 } 4718 }
4697 4719
4698 if (host_zoom != render_view_->host_zoom_levels_.end()) { 4720 if (host_zoom != host_zoom_levels_.end()) {
4699 // This zoom level was merely recorded transiently for this load. We can 4721 // This zoom level was merely recorded transiently for this load. We can
4700 // erase it now. If at some point we reload this page, the browser will 4722 // erase it now. If at some point we reload this page, the browser will
4701 // send us a new, up-to-date zoom level. 4723 // send us a new, up-to-date zoom level.
4702 render_view_->host_zoom_levels_.erase(host_zoom); 4724 host_zoom_levels_.erase(host_zoom);
4703 } 4725 }
4704 4726
4705 // Update contents MIME type for main frame. 4727 // Update contents MIME type for main frame.
4706 params.contents_mime_type = ds->response().mimeType().utf8(); 4728 params.contents_mime_type = ds->response().mimeType().utf8();
4707 4729
4708 params.transition = navigation_state->GetTransitionType(); 4730 params.transition = navigation_state->GetTransitionType();
4709 if (!ui::PageTransitionIsMainFrame(params.transition)) { 4731 if (!ui::PageTransitionIsMainFrame(params.transition)) {
4710 // If the main frame does a load, it should not be reported as a subframe 4732 // If the main frame does a load, it should not be reported as a subframe
4711 // navigation. This can occur in the following case: 4733 // navigation. This can occur in the following case:
4712 // 1. You're on a site with frames. 4734 // 1. You're on a site with frames.
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
6330 // event target. Potentially a Pepper plugin will receive the event. 6352 // event target. Potentially a Pepper plugin will receive the event.
6331 // In order to tell whether a plugin gets the last mouse event and which it 6353 // In order to tell whether a plugin gets the last mouse event and which it
6332 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6354 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6333 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6355 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6334 // |pepper_last_mouse_event_target_|. 6356 // |pepper_last_mouse_event_target_|.
6335 pepper_last_mouse_event_target_ = nullptr; 6357 pepper_last_mouse_event_target_ = nullptr;
6336 #endif 6358 #endif
6337 } 6359 }
6338 6360
6339 } // namespace content 6361 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698