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

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

Issue 2020633003: Revert of Add FrameHost mojo service (patchset #23 id:490001 of https://codereview.chromium.org/196… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 // embedder can call GetWebFrame on any RenderFrame. 1174 // embedder can call GetWebFrame on any RenderFrame.
1175 GetContentClient()->renderer()->RenderFrameCreated(this); 1175 GetContentClient()->renderer()->RenderFrameCreated(this);
1176 } 1176 }
1177 1177
1178 void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) { 1178 void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) {
1179 DCHECK(!blame_context_); 1179 DCHECK(!blame_context_);
1180 blame_context_ = new FrameBlameContext(this, parent_frame); 1180 blame_context_ = new FrameBlameContext(this, parent_frame);
1181 blame_context_->Initialize(); 1181 blame_context_->Initialize();
1182 } 1182 }
1183 1183
1184 void RenderFrameImpl::OnGotZoomLevel(const GURL& url, double zoom_level) {
1185 // TODO(wjmaclean): We should see if this restriction is really necessary,
1186 // since it isn't enforced in other parts of the page zoom system (e.g.
1187 // when a users changes the zoom of a currently displayed page). Android
1188 // has no UI for this, so in theory the following code would normally just use
1189 // the default zoom anyways.
1190 #if !defined(OS_ANDROID)
1191 // On Android, page zoom isn't used, and in case of WebView, text zoom is used
1192 // for legacy WebView text scaling emulation. Thus, the code that resets
1193 // the zoom level from this map will be effectively resetting text zoom level.
1194 host_zoom_levels_[url] = zoom_level;
1195 #endif
1196 }
1197
1198 RenderWidget* RenderFrameImpl::GetRenderWidget() { 1184 RenderWidget* RenderFrameImpl::GetRenderWidget() {
1199 RenderFrameImpl* local_root = 1185 RenderFrameImpl* local_root =
1200 RenderFrameImpl::FromWebFrame(frame_->localRoot()); 1186 RenderFrameImpl::FromWebFrame(frame_->localRoot());
1201 return local_root->render_widget_.get(); 1187 return local_root->render_widget_.get();
1202 } 1188 }
1203 1189
1204 #if defined(ENABLE_PLUGINS) 1190 #if defined(ENABLE_PLUGINS)
1205 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { 1191 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) {
1206 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 1192 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
1207 DidCreatePepperPlugin(host)); 1193 DidCreatePepperPlugin(host));
(...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after
3957 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); 3943 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault);
3958 } else { 3944 } else {
3959 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), 3945 request.setHTTPHeaderField(WebString::fromUTF8(i.name()),
3960 WebString::fromUTF8(i.values())); 3946 WebString::fromUTF8(i.values()));
3961 } 3947 }
3962 } 3948 }
3963 } 3949 }
3964 3950
3965 if (!render_view_->renderer_preferences_.enable_referrers) 3951 if (!render_view_->renderer_preferences_.enable_referrers)
3966 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); 3952 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault);
3967
3968 if (extra_data->is_main_frame()) {
3969 frame_host_->GetHostZoomLevel(
3970 request_url, base::Bind(&RenderFrameImpl::OnGotZoomLevel,
3971 weak_factory_.GetWeakPtr(), request_url));
3972 }
3973 } 3953 }
3974 3954
3975 void RenderFrameImpl::didReceiveResponse( 3955 void RenderFrameImpl::didReceiveResponse(
3976 unsigned identifier, 3956 unsigned identifier,
3977 const blink::WebURLResponse& response) { 3957 const blink::WebURLResponse& response) {
3978 // Only do this for responses that correspond to a provisional data source 3958 // Only do this for responses that correspond to a provisional data source
3979 // of the top-most frame. If we have a provisional data source, then we 3959 // of the top-most frame. If we have a provisional data source, then we
3980 // can't have any sub-resources yet, so we know that this response must 3960 // can't have any sub-resources yet, so we know that this response must
3981 // correspond to a frame load. 3961 // correspond to a frame load.
3982 if (!frame_->provisionalDataSource() || frame_->parent()) 3962 if (!frame_->provisionalDataSource() || frame_->parent())
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
4534 // Reset the zoom limits in case a plugin had changed them previously. This 4514 // Reset the zoom limits in case a plugin had changed them previously. This
4535 // will also call us back which will cause us to send a message to 4515 // will also call us back which will cause us to send a message to
4536 // update WebContentsImpl. 4516 // update WebContentsImpl.
4537 render_view_->webview()->zoomLimitsChanged( 4517 render_view_->webview()->zoomLimitsChanged(
4538 ZoomFactorToZoomLevel(kMinimumZoomFactor), 4518 ZoomFactorToZoomLevel(kMinimumZoomFactor),
4539 ZoomFactorToZoomLevel(kMaximumZoomFactor)); 4519 ZoomFactorToZoomLevel(kMaximumZoomFactor));
4540 4520
4541 // Set zoom level, but don't do it for full-page plugin since they don't use 4521 // Set zoom level, but don't do it for full-page plugin since they don't use
4542 // the same zoom settings. 4522 // the same zoom settings.
4543 HostZoomLevels::iterator host_zoom = 4523 HostZoomLevels::iterator host_zoom =
4544 host_zoom_levels_.find(GURL(request.url())); 4524 render_view_->host_zoom_levels_.find(GURL(request.url()));
4545 if (render_view_->webview()->mainFrame()->isWebLocalFrame() && 4525 if (render_view_->webview()->mainFrame()->isWebLocalFrame() &&
4546 render_view_->webview()->mainFrame()->document().isPluginDocument()) { 4526 render_view_->webview()->mainFrame()->document().isPluginDocument()) {
4547 // Reset the zoom levels for plugins. 4527 // Reset the zoom levels for plugins.
4548 render_view_->SetZoomLevel(0); 4528 render_view_->SetZoomLevel(0);
4549 } else { 4529 } else {
4550 // If the zoom level is not found, then do nothing. In-page navigation 4530 // If the zoom level is not found, then do nothing. In-page navigation
4551 // relies on not changing the zoom level in this case. 4531 // relies on not changing the zoom level in this case.
4552 if (host_zoom != host_zoom_levels_.end()) 4532 if (host_zoom != render_view_->host_zoom_levels_.end())
4553 render_view_->SetZoomLevel(host_zoom->second); 4533 render_view_->SetZoomLevel(host_zoom->second);
4554 } 4534 }
4555 4535
4556 if (host_zoom != host_zoom_levels_.end()) { 4536 if (host_zoom != render_view_->host_zoom_levels_.end()) {
4557 // This zoom level was merely recorded transiently for this load. We can 4537 // This zoom level was merely recorded transiently for this load. We can
4558 // erase it now. If at some point we reload this page, the browser will 4538 // erase it now. If at some point we reload this page, the browser will
4559 // send us a new, up-to-date zoom level. 4539 // send us a new, up-to-date zoom level.
4560 host_zoom_levels_.erase(host_zoom); 4540 render_view_->host_zoom_levels_.erase(host_zoom);
4561 } 4541 }
4562 4542
4563 // Update contents MIME type for main frame. 4543 // Update contents MIME type for main frame.
4564 params.contents_mime_type = ds->response().mimeType().utf8(); 4544 params.contents_mime_type = ds->response().mimeType().utf8();
4565 4545
4566 params.transition = navigation_state->GetTransitionType(); 4546 params.transition = navigation_state->GetTransitionType();
4567 if (!ui::PageTransitionIsMainFrame(params.transition)) { 4547 if (!ui::PageTransitionIsMainFrame(params.transition)) {
4568 // If the main frame does a load, it should not be reported as a subframe 4548 // If the main frame does a load, it should not be reported as a subframe
4569 // navigation. This can occur in the following case: 4549 // navigation. This can occur in the following case:
4570 // 1. You're on a site with frames. 4550 // 1. You're on a site with frames.
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
6028 #endif 6008 #endif
6029 return decoder_factory_.get(); 6009 return decoder_factory_.get();
6030 } 6010 }
6031 6011
6032 void RenderFrameImpl::RegisterMojoServices() { 6012 void RenderFrameImpl::RegisterMojoServices() {
6033 // Only main frame have ImageDownloader service. 6013 // Only main frame have ImageDownloader service.
6034 if (!frame_->parent()) { 6014 if (!frame_->parent()) {
6035 GetServiceRegistry()->AddService(base::Bind( 6015 GetServiceRegistry()->AddService(base::Bind(
6036 &ImageDownloaderImpl::CreateMojoService, base::Unretained(this))); 6016 &ImageDownloaderImpl::CreateMojoService, base::Unretained(this)));
6037 } 6017 }
6038
6039 GetServiceRegistry()->ConnectToRemoteService(mojo::GetProxy(&frame_host_));
6040 } 6018 }
6041 6019
6042 template <typename Interface> 6020 template <typename Interface>
6043 void RenderFrameImpl::GetInterface(mojo::InterfaceRequest<Interface> request) { 6021 void RenderFrameImpl::GetInterface(mojo::InterfaceRequest<Interface> request) {
6044 GetServiceRegistry()->ConnectToRemoteService(std::move(request)); 6022 GetServiceRegistry()->ConnectToRemoteService(std::move(request));
6045 } 6023 }
6046 6024
6047 shell::mojom::InterfaceProviderPtr RenderFrameImpl::ConnectToApplication( 6025 shell::mojom::InterfaceProviderPtr RenderFrameImpl::ConnectToApplication(
6048 const GURL& url) { 6026 const GURL& url) {
6049 if (!connector_) 6027 if (!connector_)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
6157 // event target. Potentially a Pepper plugin will receive the event. 6135 // event target. Potentially a Pepper plugin will receive the event.
6158 // In order to tell whether a plugin gets the last mouse event and which it 6136 // In order to tell whether a plugin gets the last mouse event and which it
6159 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6137 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6160 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6138 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6161 // |pepper_last_mouse_event_target_|. 6139 // |pepper_last_mouse_event_target_|.
6162 pepper_last_mouse_event_target_ = nullptr; 6140 pepper_last_mouse_event_target_ = nullptr;
6163 #endif 6141 #endif
6164 } 6142 }
6165 6143
6166 } // namespace content 6144 } // 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